Why do you not use the default shared preferences? PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext());
On Monday, November 26, 2012 3:26:36 AM UTC-5, SIVAKUMAR.J wrote: > > > Dear All, > > I had android doubt. > getSharedPreferences(sharedprefname, Context.MODE_PRIVATE) in a broad cast > receiver returns null pointer > exception?<http://stackoverflow.com/questions/13560707/getsharedpreferencessharedprefname-context-mode-private-in-a-broad-cast-recei> > > *I'm developing an android application.Im using Android SDK 2.2* > I'm using 2 Broadcast receivers.Receiver A start a service S1 > Receiver B starts a service S2. > Both the recievers invoked at a time interval of 1 hour > Receiver A is invoked @ a time 9.00,10.00 ,etc > Receiver B is invoked @ a time 8.50,9.50 ,etc > In a service s1 im storing some data in shared preferences > Im storing some data in shared preferences in the receiver B. > Im using the below code in the BroadCastReceiver for getting shared > preference.But it throws null pointer exeption > > The coding snippet given belo > > *context.getApplicationContext().getSharedPreferences("myPrefs_capture_gps_per_hour", > Context.MODE_PRIVATE); > > > *in the above code *context* is the object of the class BusinessModel.This > BusinessModel class is the child class of the > *Application(android.app.Application)* > > > > Give ur ideas > > > > -- > *Thanks & Regards, > Sivakumar.J* > > > > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

