0

I am created a To Do List application for Android and have thus far implemented an action bar with a '+' button which causes a popup to appear where the user enters the name of a list they wish to create and it is then added to the ListView which displays the text.

What I am looking for is the ability to click on each list item and be taken to a new blank page, where the user can repeat the process but add list items, rather than actual lists. From here, they could use a Navigation Drawer to easily switch between Lists. How can I make it so that the navigation drawer shows the lists added on the first page?

Many thanks,

user2511675
  • 159
  • 2
  • 9

1 Answers1

1

Have you tried following the Android Developer Guide for Creating a Navigation Drawer? Once you create the drawer, you treat it as a listview add items in the same way as you would to a listview. Is there a specific issue that you are encountering with the navigation drawer?

UPDATE:

This was retrieved from Google's documentation on Navigation Drawer. There is a project you can download from here and I would highly suggest doing so.

public class MainActivity extends Activity {
private String[] mPlanetTitles;
private ListView mDrawerList;
...

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mPlanetTitles = getResources().getStringArray(R.array.planets_array);
    mDrawerList = (ListView) findViewById(R.id.left_drawer);

    // Set the adapter for the list view
    mDrawerList.setAdapter(new ArrayAdapter<String>(this,
            R.layout.drawer_list_item, mPlanetTitles));
    // Set the list's click listener
    mDrawerList.setOnItemClickListener(new DrawerItemClickListener());

    ...
}
}
buczek
  • 2,011
  • 7
  • 29
  • 40
  • So if I implement a Navigation Drawer, when I click on the '+' in my application, and create a new list which is displayed in a listview, it will automatically be added to the navigation drawer once its pulled out from the left? – user2511675 Jul 12 '13 at 20:39
  • You wont want to create a new list necessarily, but add to the list that the navigation drawer is already using. – buczek Jul 15 '13 at 15:39
  • How can I point the navigation drawer to read the data contained within the ListView? – user2511675 Jul 17 '13 at 11:51
  • I have edited the code, I highly suggest downloading the sample project. You will find there is a full implementation of the navigation drawer. – buczek Jul 17 '13 at 13:48