@Override protected void onStart() { super.onStart(); spiceManager.start(this); spiceManager.addListenerIfPending(ListTweets.class, JSON_CACHE_KEY, new TweetRequestListener()); spiceManager.getFromCache( ListTweets.class, JSON_CACHE_KEY, DurationInMillis.ALWAYS, new TweetRequestListener()); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mAdapter = new ArrayAdapter<String>(this, R.layout.view_item_white); // Let's set our list adapter to a simple ArrayAdapter. listView.setAdapter(mAdapter); getSupportActionBar().setTitle(getDemoTitle()); getSupportActionBar().setSubtitle(getDemoSubtitle()); webViewExplanation.loadUrl("file:///android_asset/" + getDemoExplanation()); ActivityManager activityManager = (ActivityManager) getSystemService(ACTIVITY_SERVICE); MemoryInfo mi = new MemoryInfo(); activityManager.getMemoryInfo(mi); bufferToFillMemoryFaster = new byte[(int) Math.max(mi.availMem / 100, SIZE_OF_BUFFER_TO_SIMULATE_OUT_OF_MEMORY)]; Log.v( getClass().getSimpleName(), "Keeping buffer in memory, size= " + bufferToFillMemoryFaster.length); textViewMemory.setText(getString(R.string.text_available_memory, mi.availMem / 1024)); }
@Override protected void onStop() { spiceManager.shouldStop(); super.onStop(); }