Advertisement
puggan

android setText

Jun 29th, 2014
343
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.56 KB | None | 0 0
  1. /* on click function */
  2. public void a(android.view.View view)
  3. {
  4.     android.widget.TextView b;
  5.    
  6.     Log.d(":-)", "Button Pressed");
  7.    
  8.     b = ((android.widget.TextView)
  9.         getLayoutInflater()
  10.         .inflate(R.layout.fragment_test, null)
  11.         .findViewById(R.id.button1));
  12.  
  13.     Log.d(":-)", "Text before: " +  b.getText());
  14.  
  15.     b.setText("APA");
  16.  
  17.     Log.d(":-)", "Text after: " +  b.getText());
  18. }
  19.  
  20. /* log output (pressed button 2 times in a row) */ /*
  21. Button Pressed
  22. Text before: Hello world!
  23. Text after: APA
  24. Button Pressed
  25. Text before: Hello world!
  26. Text after: APA
  27. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement