Convert number in textview to int

前端 未结 5 1649
渐次进展
渐次进展 2021-02-13 10:27

So, I am messing around with java/android programming and right now I am trying to make a really basic calculator. I am hung up on this issue though. This is the code I have r

5条回答
  •  伪装坚强ぢ
    2021-02-13 11:04

    this code actually works better:

    //this code to increment the value in the text view by 1
    
    TextView quantityTextView = (TextView)findViewById(R.id.quantity_text_view);
            CharSequence v1=quantityTextView.getText();
            int q=Integer.parseInt(v1.toString());
            q+=1;
            quantityTextView.setText(q +"");
    
    
    //I hope u like this
    

提交回复
热议问题