0
我開發一個小項目中,我得到了它,我無法來解決顯示強行關閉應用程序中的錯誤。任何一個可以幫助我
,這是我的SCREEN3代碼
public class screen3 extends ListActivity {
/** Called when the activity is first created. */
String[] names = new String[] { "India", "Malaysia"};
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.screen3);
// Create an array of Strings, that will be put to our ListActivity
// Use your own layout and point the adapter to the UI elements which
// contains the label
this.setListAdapter(new ArrayAdapter<String>(this, R.layout.screen3,
R.id.label, names));
Button b4=(Button)findViewById(R.id.click);
b4.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
Intent i2 =new Intent(screen3.this,screen4.class);
startActivity(i2);
}
});
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
// Get the item that was clicked
Object o = this.getListAdapter().getItem(position);
String keyword = o.toString();
if(keyword.equals("India"))
{
Intent i=new Intent(screen3.this,new21.class);
startActivity(i);
}
Toast.makeText(this, "You selected: " + keyword, Toast.LENGTH_LONG)
.show();
}
}
和 26行代碼是
public void onClick(View v) {
// TODO Auto-generated method stub
Intent i2 =new Intent(screen3.this,screen4.class);
startActivity(i2);
和我檢查,這是罰款
向我們顯示代碼in'optio n.matrix.screen3.onCreate()'(文件screen3.java),特別是第26行 –
,你真的認爲我們是魔術師嗎?如果你只提供logcat屏幕截圖,你希望我們如何幫助你。複製/粘貼一些煩擾你的代碼,也許我們將能夠幫助你。 – Umesh
對不起,我已經編輯它並粘貼screen3的所有代碼。感謝您的回覆 – radha