我是 android 的新手,我想在我的布局和代码中显示一个列表视图但它会抛出致命错误请建议我
活动代码:
String [] frnds = {"Ajay Kumar", "Atul kumar", "Deepak Arora", "Mamta kri", "Mimi"};
ListView frndlist;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setListAdapter(new ArrayAdapter<String>(MainActivity.this,android.R.layout.simple_list_item_1, frnds));
setContentView(R.layout.activity_main);
frndlist = (ListView)findViewById(R.id.listView1);
frndlist.setAdapter( new ArrayAdapter(MainActivity.this,android.R.layout.simple_list_item_1 ,frnds));
}