I am having a problem when accessing shredPreferences from inside an IntentService
I Received error is:
java.lang.RuntimeException: service com.androidbook.btdt.hour6.QuizSettingsActivity $ UploaderService: java.lang.NullPointerException
Instant Unable to: The nullpointer exception occurs when
mGameSettings = getSharedPreferences (GAME_PREFERENCES, Context.MODE_PRIVATE);
This code is:
Public Static Class Uploader Service Intent Service {String DEBUG_TAG = UploaderService.class.getSimpleName (); Shared references mGameSettings; Personal Uploaded User Data Upload User Data; / ** * An IntentService creates the * * @ Ultimate Name included by your sub-class constructor, is used for the name of square thread, only important for debugging. * / Public Uploader service (name of string) {super (name); MGameSettings = Reciprocity References (GAME_PREFERENCES, References.MODE_PRIVATE); } Public Uploader Service () {Super (""); MGameSettings = Reciprocity References (GAME_PREFERENCES, References.MODE_PRIVATE); }
In this way I am starting Intent Service:
Intent upload service = new intent (this, UploaderService.class); StartService (uploadService);
I think you need to do that service in the startService function and the constructor No. I know at least for the time being activities that the context is not fully set, so too many calls will fail. I believe that there is only one way of services.
No comments:
Post a Comment