• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps opening application files from broadcastreceiver

jaeela

Lurker
Hi, I was wondering if I could open the file input/output of my application through a broadcast receiver. Normally, I would use openFileOutput/Input(), but this can only be done through activities. Would it be more sensible to create my file in res/raw? or create an instance of the activity and call openFileOutput() on it?
Thanks,

Jaeela
 
openFileInput(String) and openFileOutput(String) are declared in android.content.Context, which is a superclass of Activity. Your broadcast receiver is given a context when it's onReceive(Context, Intent) is called. Does calling openFileOutput(String) or openFileInput(String) on the context parameter work for you?
 
Back
Top Bottom