2つのフラグメントを保持する空のアクティビティが2つあります.1つのアクティビティにアダプタがあり、アダプタ内でTabactivityとして動作しています。バンドルオブジェクトを持つフラグメント間でデータを渡す
インテントと内部でデータを渡したいと思います。
:私は意図してバンドルを作成している :ユーザーアクティビティ1を押しボタンでメールアドレスを入力すると 、電子メールアクティビティ内のTextViewに表示する予定です2.ここ
は私が得る例外で
@Bind(R.id.btn_forgot)
AppCompatButton btn_forgot;
@Bind(R.id.forgot_edittext)
AppCompatEditText editEmail;
public void onButtonClick() {
Intent intent = new Intent(".presenter.view.activity.ForgotPasswordCompleted");
intent.putExtra("email", editEmail.getText().toString());
ForgotPasswordFragment fragment = new ForgotPasswordFragment();
Bundle bundle = new Bundle();
bundle.putString("email",editEmail.getText().toString());
fragment.setArguments(bundle);
startActivity(intent); }
はマニフェスト:
<activity android:name=".presenter.view.activity.ForgotPasswordCompleted"
android:label="Forgot"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name=".presenter.view.activity.ForgotPasswordCompleted"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
私はダガーでのTextViewをバインドされている、文字列のgetNameを追加し、目的を実施し、フラグメント2にバンドル:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = getActivity().getIntent();
Bundle bd = intent.getExtras();
if ((bd != null)){
String getName = (String) bd.get("email");
resentTxt.setText(getName);
}
あなたはonButtonClickで作成された意図も断片もなく何もしませんでした – Selvin
私は何をしようとしていましたが、どうしたらいいですか?@Selvin –