The Content helps those who wish to program mobile applications using android platform. The content has been used to conduct mobile application boot camps using android platform on different regions in Tanzania
10. Android Intents
Android Key Concepts
Intent intent = new Intent(this, DisplayMessageActivity.class);
Parameters
Context
The Class of the app component to which the system should deliver the Intent (in
this case, the activity that should be started)
10/23/2013
KINU | Android Mobile BootCamp
11. Android Intents
Android Key Concepts
Carry Collection of Data to another Activity
extras
putExtra
public void sendMessage(View view) {
Intent intent = new Intent(this, DisplayMessageActivity.class);
EditText editText = (EditText) findViewById(R.id.edit_message);
String message = editText.getText().toString();
intent.putExtra(EXTRA_MESSAGE, message);
startActivity(intent);
}
Receive Intent
Intent intent = getIntent();
String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);
10/23/2013
KINU | Android Mobile BootCamp
12. XML codes
Android Key Concepts
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#008080">
10/23/2013
KINU | Android Mobile BootCamp