Guest User

Untitled

a guest
Jun 28th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. package com.example.android.menu;
  2.  
  3. import android.os.Bundle;
  4. import android.support.v7.app.AppCompatActivity;
  5. import android.util.Log;
  6. import android.view.View;
  7. import android.widget.TextView;
  8.  
  9.  
  10. public class MainActivity extends AppCompatActivity {
  11.  
  12. @Override
  13. protected void onCreate(Bundle savedInstanceState) {
  14. super.onCreate(savedInstanceState);
  15. setContentView(R.layout.activity_main);
  16. }
  17.  
  18. public void printToLogs(View view) {
  19. // Find first menu item TextView and print the text to the logs
  20. TextView textViewItem1 = (TextView) findViewById(R.id.menu_item_1);
  21. String menuItem1 = textViewItem1.getText().toString();
  22. Log.v("MainActivity", menuItem1);
  23.  
  24. // Find second menu item TextView and print the text to the logs
  25. TextView textViewItem2 = (TextView) findViewById(R.id.menu_item_2);
  26. String menuItem2 = textViewItem2.getText().toString();
  27. Log.v("MainActivity", menuItem2);
  28.  
  29. // Find third menu item TextView and print the text to the logs
  30. TextView textViewItem3 = (TextView) findViewById(R.id.menu_item_3);
  31. String menuItem3 = textViewItem3.getText().toString();
  32. Log.v("MainActivity", menuItem3);
  33. }
  34. }
Add Comment
Please, Sign In to add comment