Last active
December 30, 2015 06:29
-
-
Save shikajiro/7789950 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
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
package="jp.hoge" | |
android:versionCode="1" | |
android:versionName="1.0" > | |
<application | |
android:name=".AppImpl_" | |
android:allowBackup="true" | |
android:icon="@drawable/icon" | |
android:label="@string/app_name" | |
android:theme="@style/AppTheme" > | |
</application> | |
</manifest> |
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
@EApplication | |
public class AppImpl extends Application { | |
private DatabaseHelper dbHelper; | |
@Override | |
public void onCreate() { | |
super.onCreate(); | |
DeployGate.install(this); | |
createDB(); | |
// springでのhttpアクセスで必須の設定 | |
System.setProperty("http.keepAlive", "false"); | |
} | |
public void createDB() { | |
this.dbHelper = new DatabaseHelper(this, null); | |
} | |
public void closeDB() { | |
if (dbHelper != null) { | |
dbHelper.close(); | |
} | |
} | |
public DaoSession getDaoSession() { | |
return this.dbHelper.getDaoSession(); | |
} | |
} |
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
@EActivity(R.layout.activity_main) | |
public class MainActivity extends Activity { | |
@App AppImpl app; | |
@AfterViews | |
void onAfterViews(){ | |
ItemDao dao = app.getDaoSession().getItemDao(); | |
//hogehoge | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment