xxxxxxxxxx
Intent intent = new Intent(MainActivity.this,MainActivity2.class);
intent.putExtra("key",value);
startActivity(intent);
////////////////////
String string =getIntent().getStringExtra("key");
xxxxxxxxxx
Button button = (Button) rootView.findViewById(R.id.button1);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(getActivity(), AnotherActivity.class);
startActivity(intent);
}
});
xxxxxxxxxx
Intent intent = new Intent(this, DisplayMessageActivity.class);
EditText editText = (EditText) findViewById(R.id.editTextTextPersonName);
String message = editText.getText().toString();
intent.putExtra(EXTRA_MESSAGE, message);
startActivity(intent);
/*this intent takes us to the activity named DisplayMessageActivity*/
/*it also carries with us the text message*/
xxxxxxxxxx
if (Platform.isAndroid) {
AndroidIntent intent = AndroidIntent(
action: 'action_view',
package: 'com.google.android.gm',
data:'mailto:test@gmail.com?subject=Issue'
);
intent.launch().catchError((e) {
print(e.toString());
});
}
else if (Platform.isIOS) {
launch("mailto:test@gmail.com?subject=Issue").catchError((e){
print(e.toString());
});
}
xxxxxxxxxx
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<EditText
android:id="@+id/editText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/btn"
android:text="Search"
android:onClick="search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/editText" />
</androidx.constraintlayout.widget.ConstraintLayout>