Information Systems



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.

myView.getContext();

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