Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. package com.example.miltz.task02a;
  2.  
  3. import android.support.v7.app.AppCompatActivity;
  4. import android.os.Bundle;
  5. import android.content.Intent;
  6. import android.view.View;
  7. import android.widget.EditText;
  8.  
  9. public class MainActivity extends AppCompatActivity {
  10. public final static String EXTRA_MESSAGE = "HELLO THIS MY FIRST APP";
  11.  
  12.  
  13. @Override
  14. protected void onCreate(Bundle savedInstanceState) {
  15. super.onCreate(savedInstanceState);
  16. setContentView(R.layout.activity_main);
  17. }
  18.  
  19. /** When the user clicks the Send button this will be called*/
  20. public void sendMessage(View view) {
  21. /**An Intent is an object that provides runtime binding between separate components (such as two activities). */
  22. Intent intent = new Intent(this, DisplayMessageActivity.class);
  23. EditText editText = (EditText) findViewById(R.id.edit_message);
  24. String message = editText.getText().toString();
  25. intent.putExtra(EXTRA_MESSAGE, message);
  26. startActivity(intent);
  27.  
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement