Last active
August 29, 2015 14:26
-
-
Save akexorcist/4198ed65a6e452a1d444 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.droidsans.photo.droidphoto; | |
import android.app.Application; | |
import android.content.Context; | |
public class BaseApplication extends Application { | |
private static Context context; | |
@Override | |
public void onCreate() { | |
super.onCreate(); | |
getContext(); | |
} | |
public static Context getContext() { | |
if(context == null) | |
context = getApplicationContext(); | |
return context; | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static boolean globalEmit(String event, JSONObject obj){ | |
... | |
Context context = BaseApplication.getContext(); | |
obj.put("_token", context.getSharedPreferences(context.getString(R.string.userdata), Context.MODE_PRIVATE).getString(context.getString(R.string.token), "")); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment