package com.nkming.packageinfo;

import android.app.ActivityManager;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

import com.nkming.utils.graphic.BitmapCache;

public class MainActivity extends ActionBarActivity
		implements SearchDialog.SearchDialogListener
{
	@Override
	protected void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);

		int heapMb = ((ActivityManager)getSystemService(ACTIVITY_SERVICE))
				.getMemoryClass();
		BitmapCache.init(heapMb * 1024 * 1024 / 4);

		setContentView(R.layout.activity_main);
		if (savedInstanceState == null)
		{
			mFrag = new MainFragment();
			getSupportFragmentManager().beginTransaction()
					.add(R.id.container, mFrag)
					.commit();
		}
		getSupportActionBar().setElevation(getResources().getDimension(
				R.dimen.toolbar_z));
	}

	@Override
	public void onSearchRequest(AppFilter req)
	{
		mFrag.onSearchRequest(req);
	}

	private MainFragment mFrag;
}

@@ -77,16 +77,42 @@
 android.
+os.Bundle;%0Aimport android.
 support.
@@ -139,90 +139,8 @@
 vity
-;%0Aimport android.os.Bundle;%0Aimport android.view.Menu;%0Aimport android.view.MenuItem
 ;%0A%0Ai
@@ -743,16 +743,124 @@
 ();%0A%09%09%7D%0A
+%09%09else%0A%09%09%7B%0A%09%09%09mFrag = (MainFragment)getSupportFragmentManager().findFragmentById(%0A%09%09%09%09%09R.id.container);%0A%09%09%7D%0A
 %09%09getSup

Fix fragment instance not correctly assigned