2

あるアクティビティから別のアクティビティに 3 つの文字列を渡したいのですが、うまくいきません。いろいろ試しましたが、なぜうまくいかないのか理解できません。これが最初のアクティビティです。

最初の活動

                          String[] g = new String[3];
                  g[0] = "information 1";
                g[1] = "information 2";
                g[2] = "information 3";
                Intent intent = new Intent(Entradas.this,Informacoes.class);
                Bundle bundle = new Bundle();
                bundle.putStringArray("some string",g);
                intent.putExtras(bundle);
                startActivity(intent);

第二の活動

        Bundle bundle = getIntent().getExtras();
    String[] abc = bundle.getStringArray("some string");
    TextView txtInfo= (TextView) findViewById(R.id.textViewInfo);
    txtInfo.setText(abc[0]);
    TextView txtNome= (TextView) findViewById(R.id.textViewNome);
    txtNome.setText(abc[1]);
    TextView txtPreco= (TextView) findViewById(R.id.textViewPreco);
    txtPreco.setText(abc[2]);

うまくいかないのですが、これを修正する方法はありますか?

4

1 に答える 1

1

3 つの要素がありますが、2 つ分のスペースが割り当てられています。最初にこれを修正しようとしましたか?

于 2012-11-10T16:23:33.510 に答える