My SlidingScreenActivity code is,
private class SlideMenuClickListener implements
ListView.OnItemClickListener {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
long id) {
// display view for selected nav drawer item
displayView(position);
}
}
public void displayView(int position) {
Fragment fragment = null;
switch (position) {
case 0:
mDrawerLayout.closeDrawer(mDrawerList);
break;
case 1:
fragment=new HomeFragment();
break;
case 2:
fragment=new Mywallet();
break;
case 3:
fragment=new AboutUsFragment();
break;
default:
break;
}
}
if (fragment != null) {
FragmentManager fragmentManager = getSupportFragmentManager();
fragmentManager.beginTransaction()
.replace(R.id.frame_container, fragment).commit();
mDrawerList.setItemChecked(position, true);
mDrawerList.setSelection(position);
setTitle(navMenuTitles[position]);
mDrawerLayout.closeDrawer(mDrawerList);
} else {
mDrawerLayout.closeDrawer(mDrawerList);
Log.e("SlidingMainActivity", "Error in creating fragment");
}
}
Another Activity button listener,
btnWallet.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent mIntent=new Intent(this,SlidingScreenActivity.class);
startActivity(mIntent);
}
});
How can i openMyWallet fragment
that i have already declared in case 2: in SlidingScreenActivity.class
,when click on button in another activity through Intent?
could anyone help me?
Thanks in advance...
SlidingScreenActivity:
@Override
protected void onStart() {
super.onStart();
displayView(getIntent().getIntExtra("position", 2));
}
Another Activity button listener:
btnWallet.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent mIntent=new Intent(this,SlidingScreenActivity.class);
intent.putExtra("position", 2);
startActivity(mIntent);
}
});