Skip to content

Commit

Permalink
added mainapplication class
Browse files Browse the repository at this point in the history
  • Loading branch information
nkanaev committed Jul 22, 2016
1 parent 45a7213 commit fa3a6cf
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
<application android:label="@string/app_name"
android:icon="@drawable/ic_launcher"
android:theme="@style/AppTheme"
android:largeHeap="true">
android:largeHeap="true"
android:name=".MainApplication">
<activity android:name=".activity.MainActivity"
android:label="@string/app_name">
<intent-filter>
Expand Down
24 changes: 24 additions & 0 deletions app/src/main/java/com/nkanaev/comics/MainApplication.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.nkanaev.comics;

import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;


public class MainApplication extends Application {
private static Context mContext;

@Override
public void onCreate() {
super.onCreate();
mContext = this;
}

public static Context getAppContext() {
return mContext;
}

public static SharedPreferences getPreferences() {
return mContext.getSharedPreferences(Constants.SETTINGS_NAME, 0);
}
}

0 comments on commit fa3a6cf

Please sign in to comment.