Code example for FragmentActivity

Methods: onPause, unregisterReceiver

0
		registerReceiver(netReceiver, netIntentFilter);
	} 
 
	@Override 
	public void onPause() { 
		unregisterReceiver(netReceiver);
		super.onPause(); 
	} 
 
	@Override 
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.main, menu);
		if (User.getInstance(getApplicationContext()).isLogin()) { 
			menu.findItem(R.id.action_login).setVisible(false);
			menu.findItem(R.id.action_logout).setVisible(true);
		} else { 
			menu.findItem(R.id.action_login).setVisible(true);
			menu.findItem(R.id.action_logout).setVisible(false);
		} 
		return true; 
	}