public class MainActivity extends AppCompatActivity {
private ListView mDrawerList;
private ArrayAdapter mAdapter;
...
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mDrawerList = (ListView)findViewById(R.id.navList);
mDrawerLayout = (DrawerLayout)findViewById(R.id.drawer_layout);
addDrawerItems();
mDrawerList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView> parent, View view, int position, long id) {
final Dialog aboutDialog = new Dialog(MainActivity.this);
aboutDialog.setContentView(R.layout.about);
aboutDialog.setCancelable(true);
aboutDialog.show();
}
});
}
private void addDrawerItems() {
String[] osArray = { "Profil bearbeiten", "Ein Problem melden", "Nutzungsbedingungen", "Kontakt", "Über uns" };
mAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, osArray);
mDrawerList.setAdapter(mAdapter);
}
}
...