Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Code from

kiruthigha rajan
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai im newbie to Android..
Im having some doubts in this code..

public class MainActivity extends Activity {
public final static String EXTRA_MESSAGE = "com.example.myfirstapp.MESSAGE";
Intent intent = new Intent(this, DisplayMessageActivity.class);
EditText editText = (EditText) findViewById(;
String message = editText.getText().toString();
intent.putExtra(EXTRA_MESSAGE, message);

1)Why we are using casting in EditText
2)What is putExtra(EXTRA_MESSAGE,message) and its use??
3)Why is MY_MESSAGE assigned to com.example.myfirstapp.MESSAGE? and What is com.example.myfirstapp.MESSAGE?
thanks in advance
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic