2011-07-22 32 views
0

我是新来的android dev,我开发了一个名为数学的示例proj,我创建了两个窗口,一个输入值,第二个显示结果。但问题是,当我输入值并点击GO按钮时,它给了我一些错误。您可以从链接下载下面我凸出:帮我解决在运行时得到的错误

https://skydrive.live.com/?cid=12A251B09B8A1A55&id=12A251B09B8A1A55!112&sc=documents#!/?cid=12a251b09b8a1a55&sc=documents&id=12A251B09B8A1A55!114

感谢,

+1

如果你只是张贴您的logcat和代码段为细末程序你可能会得到更快的响应。有人可能会帮助你,虽然 – Idistic

+0

嗨,我已经附上我的代码在上面的链接PLZ看看。 – nag

回答

0

我解决你的错误,请使用以下两行的MathProjActivity

val1=Integer.parseInt(((EditText)findViewById(R.id.txtInput1)).getText().toString()); 
val2=Integer.parseInt(((EditText)findViewById(R.id.txtInput2)).getText().toString()); 

,而不是

val1=Integer.parseInt(((TextView)findViewById(R.id.txtInput1)).toString()); 
val2=Integer.parseInt(((TextView)findViewById(R.id.txtInput2)).toString()); 

并使用以下行

intent.putExtra("res",String.valueOf(res)); 

代替

intent.putExtra("res",res); 
+0

嗨surendra,非常感谢你的工作。 – nag

+0

请不要忘记把正确的勾号 – surendra

+0

完成。我可以知道你在哪里? – nag