單擊列表項時,它不會啟動新的Activity 。 為什麼其他人已經實現了相同的代碼並且程序運行正常。 這個問題我該怎麼處理? 下面是代碼:public class Menu extends ListActivity {
String classes[]={"StartingPoint","Splash","You","Dumb"};
@Override
protected void onCreate(Bundle savedInstanceState) {
//TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setListAdapter(new ArrayAdapter(this, android.R.layout.simple_list_item_1, classes));
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
//TODO Auto-generated method stub
super.onListItemClick(l, v, position, id);
String cheese = classes[position];
try {
Class ourclass = Class.forName("com.umer.splashscreenwithsound." + cheese);
//Class ourclass = Class.forName("com.umer.splashscreenwithsound.StartingPoint");
Intent myintent = new Intent(Menu.this,ourclass);
startActivity(myintent);
} catch(ClassNotFoundException e) {
e.printStackTrace();
}
}
}
請幫助。