getAssets(); from another class getAssets(); from another class android android

getAssets(); from another class


Is your other class also an Activity?getAssets() is a method of Context. If your class is not an activity, you'll need to pass a context into it and then call getAssets on that.

Like so:

public myClass(Context myContext) {    AssetManager mngr = myContext.getAssets();    InputStream is = mngr.open("textdb.txt");}