Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2014
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. package com.example.myfirstapp;
  2.  
  3. import android.support.v7.app.ActionBarActivity;
  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 ActionBarActivity {
  10. public final static String EXTRA_MESSAGE = "com.example.myfirstapp.MESSAGE";
  11. /** Called when the activity is first created. */
  12. @Override
  13. public void onCreate(Bundle savedInstanceState)
  14. {
  15. super.onCreate(savedInstanceState);
  16. setContentView(R.layout.main);
  17. }
  18. /** Called when the user clicks the Send button */
  19. public void sendMessage(View view) {
  20. Intent intent = new Intent(this, DisplayMessageActivity.class);
  21. EditText editText = (EditText) findViewById(R.id.edit_message);
  22. String message = editText.getText().toString();
  23. intent.putExtra(EXTRA_MESSAGE, message);
  24. startActivity(intent);
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement