Back to project page notes.
The source code is released under:
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004 Copyright (C) 2004 Sam Hocevar <sam@hocevar.net> Everyone is permitted to copy and distribute verbatim or...
If you think the Android project notes listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.iliakplv.notes; //from ww w . j av a2 s . co m import android.app.Application; import android.content.Context; import com.iliakplv.notes.analytics.EventTracker; import com.iliakplv.notes.notes.dropbox.DropboxHelper; import com.iliakplv.notes.notes.storage.Storage; import com.iliakplv.notes.utils.AppLog; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; public class NotesApplication extends Application { private static final String TAG = NotesApplication.class.getSimpleName(); private static Context context; private static final int NON_CORE_THREADS_KEEP_ALIVE_TIME_SECONDS = 1; private static ThreadPoolExecutor executor; @Override public void onCreate() { super.onCreate(); AppLog.d(TAG, "onCreate() call"); context = getApplicationContext(); initThreadPool(); EventTracker.setEnabled(false); initStorage(); } private void initStorage() { Storage.init(null); DropboxHelper.initSynchronization(); } private void initThreadPool() { final int processors = Runtime.getRuntime().availableProcessors(); AppLog.d(TAG, "Detected " + processors + " processors. Creating thread pool..."); executor = new ThreadPoolExecutor(processors, processors, NON_CORE_THREADS_KEEP_ALIVE_TIME_SECONDS, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>()); } @Override public void onTerminate() { AppLog.d(TAG, "onTerminate() call"); super.onTerminate(); } public static Context getContext() { return context; } public static void executeInBackground(Runnable task) { executor.execute(task); } }