0
public class DataHelper extends Activity{
TextView tvRslt;
public static int insert(String firstFB, String firstRL) {
// TODO Auto-generated method stub
Integer a = new Integer(firstFB).intValue();
Integer b = new Integer(firstRL).intValue();
int firstResult = a/b;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.result);
我想設置整數「firstResult」以顯示在TextEdit「tvRslt」上。將TextView設置爲整數的值
我該怎麼做?
如果需要更多信息,請告訴我。
好的,這裏有太多的想法可以提供任何體面的答案。首先,變量firstResult在插入方法的最後一行中聲明,不是一個類變量,那麼你打算如何設置任何值到它的值?還有什麼是TextView對象和Bundle對象的源代碼? firstResult聲明也應該包裝在try/catch塊中,以除以零例外。 – 2012-01-09 18:20:30
tvRslt.setText(firstResult); – 2012-01-09 18:22:27
那好吧,我該如何將它設置爲一個類變量,以及如何設置異常嗎? – MiKenning 2012-01-09 18:24:25