Reputation: 169
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,
Upvotes: 0
Views: 5987
Reputation: 2050
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());
...
}
}
Upvotes: 1