Football Fans: Download the 2012 Schedule App from Google Play!


Go Back   Android Forums > Android Development > Application Development > Developer 101

Developer 101 101 Tutorials



Reply
 
LinkBack Thread Tools
Old January 15th, 2012, 02:19 PM   #1 (permalink)
New Member
 
Join Date: Jan 2012
Posts: 4
 
Device(s):
Thanks: 0
Thanked 0 Times in 0 Posts
Default opening application files from broadcastreceiver

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

jaeela is offline  
Reply With Quote
Sponsors
Old January 16th, 2012, 01:04 AM   #2 (permalink)
Premium Member
 
Join Date: Oct 2011
Location: Sydney, Australia
Posts: 193
 
Device(s): Galaxy Nexus GSM
Thanks: 2
Thanked 37 Times in 33 Posts
Default

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?
jiminaus is offline  
Last edited by jiminaus; January 16th, 2012 at 01:07 AM.
Reply With Quote
Reply

Bookmarks


Go Back   Android Forums > Android Development > Application Development > Developer 101 User CP
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -5. The time now is 08:22 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Custom vBulletin Skins by: Relivo