0

I make an app that use navigation drawer layout.I need deeper navigations which are activities. So,I make main activity that implements drawer and other activities extend that main activity.But i have a problem is that other activites does not have drawer list when i click the drawer toggle button.Give me that best solution about that.I have an experience on android about one month.Thank you all.

Edit:

MainActivity.java create a navigation drawer which have list on left side.When clicking navigation drawer toggle button, it shows a list of 10 items. If an item in that list is clicked,i call another activity that extends ManiActivity. So, secondActivity.java has navigation drawer. But when i click toggle button, it doesn't show me list like in MainActivity.java. Here are some code.This is MainActivity.java...

public class DrawerItemClickListener implements ListView.OnItemClickListener {
    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
        selectItem(position);
    }
}

private void selectItem(int position) {

    if(position==1){
        this.startActivity(new Intent(this, secondActivity.class));
    }
    // update selected item and title, then close the drawer
    mDrawerList.setItemChecked(position, true);
    setTitle(mPlanetTitles[position]);
    mDrawerLayout.closeDrawer(mDrawerList);
}

`

This is secondActivity.java

public class secondActivity extends MainActivity {

@Override
public void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.search);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // TODO Auto-generated method stub
    return super.onCreateOptionsMenu(menu);
}

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    // TODO Auto-generated method stub
    return super.onPrepareOptionsMenu(menu);
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // TODO Auto-generated method stub
    return super.onOptionsItemSelected(item);
}

@Override
public void setTitle(CharSequence title) {
    // TODO Auto-generated method stub
    super.setTitle(title);
}

@Override
protected void onPostCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onPostCreate(savedInstanceState);
}

@Override
public void onConfigurationChanged(Configuration newConfig) {
    // TODO Auto-generated method stub
    super.onConfigurationChanged(newConfig);
}

@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
    // TODO Auto-generated method stub
    super.onItemClick(arg0, arg1, arg2, arg3);
}
}
Ondra Žižka
  • 43,948
  • 41
  • 217
  • 277
Kate
  • 11
  • 3

1 Answers1

0

Instead of opening Activities - why can't you use Fragments for navigation?

ExiRouS
  • 803
  • 1
  • 7
  • 9