Home Products QA Support Contact

How to get a context in Android

Context classes are used in Android to do things like open files. In order to get a Context any View should be able to do it, so using your main View should work.


FileOutputStream fos = myView.getContext().openFileOutput(name, Context.MODE_PRIVATE);