Advertisement
Guest User

Untitled

a guest
Feb 27th, 2015
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. String calorie = getIntent().getStringExtra("calorie");
  2. TextView textView1 = (TextView)findViewById(R.id.textView1);
  3. String strOldValue = textView1.getText().toString();
  4.  
  5. Integer oldValue;
  6. try{
  7. oldValue= Integer.parseInt(myString);
  8. }catch(NumberFormatException e){
  9. oldValue =0;
  10. }
  11.  
  12. Integer newValue;
  13. try{
  14. newValue= Integer.parseInt(calorie);
  15. }catch(NumberFormatException e){
  16. newValue =0;
  17. }
  18. textView1.setText((oldValue + newValue));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement