-3

私は3つの活動をしています。最初のアクティビティから 2 番目のアクティビティへの文字列値を取得しようとしています。そして、最初のアクティビティの文字列値と 3 番目のアクティビティの 2 番目のアクティビティの両方が必要です。

これを達成するには、アクティビティでコードをどのように表示する必要がありますか?

私のフローは、最初に最初のアクティビティを実行し、次に最初に 2 番目のアクティビティを開始し、最後に 2 番目に 3 番目のアクティビティを開始します。

ログ猫にエラーなしで、文字列値としてnullを取得しています。

onPost ExecuteのTopic.javaのダイアログでリストビューを見ることができませんが、arrayadapterを使用せずにデータを取得できます..

どんな助けでも大歓迎です。

4

3 に答える 3

1

現在、送信SuperSecretValueしておらずSuperSecretValue1、2 番目のアクティビティから 3 番目のアクティビティに 2 番目のアクティビティのインテントを次のように変更します。

Intent intent = new Intent(Topic.this, QuestionActivity.class);
 String superSecretValue = getIntent().getStringExtra("SuperSecretValue");
 String superSecretValue1 = getIntent().getStringExtra("SuperSecretValue1");

 intent.putExtra("AnotherSuperSecretValue", topicid);
 intent.putExtra("SuperSecretValue", superSecretValue);
 intent.putExtra("SuperSecretValue1", superSecretValue1);
 startActivity(intent);

編集 :

QuestionActivityボタンをクリックしてアクティビティを開始する場合はTopic.this.getIntent().getStringExtra("SuperSecretValue"); .... 、前のアクティビティからインテントを取得するために使用するか 、アクティビティの後のメソッドでgetIntentコードを移動しますonCreatesetContentView

于 2013-01-12T07:14:12.483 に答える
1

3 番目のアクティビティを開始するときに、2 番目のアクティビティに値を入れるのを忘れました。

Intent intent = new Intent(Topic.this, QuestionActivity.class);
String superSecretValue = getIntent().getStringExtra("SuperSecretValue");
String superSecretValue1 = getIntent().getStringExtra("SuperSecretValue1");
intent.putExtra("SuperSecretValue",superSecretValue );// here is missing
intent.putExtra("SuperSecretValue1",superSecretValue1 ); // here is missing
intent.putExtra("AnotherSuperSecretValue", topicid);
startActivity(intent);
于 2013-01-12T07:14:22.783 に答える
1
In second activity try this

Bundle bundle=getIntent().getExtras();

String superSecretValue = bundle.getString("SuperSecretValue");   
String superSecretValue1 =bundle.getString("SuperSecretValue1");

Intent intent = new Intent(Topic.this, QuestionActivity.class);  
intent.putExtra("AnotherSuperSecretValue", topicid);
intent.putExtra("SuperSecretValue",superSecretValue );
intent.putExtra("SuperSecretValue1",superSecretValue1 );  
startActivity(intent);

Again, in third activity, try this

Bundle bundle=getIntent().getExtras();  
String topicValue = bundle.getString("AnotherSuperSecretValue");  
String levelValue = bundle.getString("SuperSecretValue");  
String groupValue1 = bundle.getString("SuperSecretValue1");

System.out.println("Result:"+topicValue);  
System.out.println("Result:"+levelValue);  
System.out.println("Result:"+groupValue1);
于 2013-01-12T07:24:03.770 に答える