jakiro

Android Plain Text

Mar 14th, 2020
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.76 KB | None | 0 0
  1. /*
  2. Getting text from plaintext with id = 'nameEditText' then adding log with given text using button
  3. */
  4.  
  5.  
  6. package com.example.uorjaipur.textbutton;
  7.  
  8. import android.support.v7.app.AppCompatActivity;
  9. import android.os.Bundle;
  10. import android.util.Log;
  11. import android.view.View;
  12. import android.widget.EditText;
  13.  
  14. public class MainActivity extends AppCompatActivity {
  15.  
  16.     public void click(View view){
  17.  
  18.         EditText nameEditText =(EditText) findViewById(R.id.nameEditText);
  19.         Log.i("Info","button click");
  20.         Log.i("Values",nameEditText.getText().toString());
  21.  
  22.     }
  23.     @Override
  24.     protected void onCreate(Bundle savedInstanceState) {
  25.         super.onCreate(savedInstanceState);
  26.         setContentView(R.layout.activity_main);
  27.     }
  28. }
Add Comment
Please, Sign In to add comment