public void onPass(View v)
{
String sn1=et1.getText().toString();
String sn2=et2.getText().toString();
int i1=Integer.parseInt(sn1);
int i2=Integer.parseInt(sn2);
Intent i=new Intent(this,Act2.class);
i.putExtra("k1",i1);
i.putExtra("k2", i2);
startActivity(i);
}
logcat的:錯誤:NumberFormatException的無法解析 '20'
E/AndroidRuntime(671): Caused by: java.lang.NumberFormatException: unable to parse '20 ' as integer
這樣做後,有一個新的錯誤,如logcat 05-14 14:51:34.018:E/AndroidRuntime(331):引起:android.content.res.Resources $ NotFoundException:字符串資源ID#0x4d2 – ceanan007 2013-05-14 09:26:33