regarding the Android Assets manager, is it possible to get a file from the assets without context? I read that I can initialize a File object with "file:///android_assets" kind of path, and then get the file from there, but it says that the file does not exist (Honeycomb).
What is the general workaround around this issue? There is no any way to get the context on the place I need the files from the assets.
Thanks
To get access to the Context where it's not present you can extend Application class and create the static reference to the Context. This way you can access it from anywhere within the application:
public class MyApp extends Application {
public static Context context;
@Override
public void onCreate() {
super.onCreate();
context = getApplicationContext();
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With