1

I'm trying to send a intent between to wactivites but seem to only get blank results when i try to pull the intent from the second activity.

Code :

Sending Class :

Intent intent = new Intent(Posten.this, DetailView.class);
    intent.putExtra("sporingsnummer",et_sporingsnummer.getText());
    startActivity(intent);

Reciving Class :

Bundle extras = getIntent().getExtras();
    if (extras != null) {
       String sporingsnummer = extras.getString("sporingsnummer");
    }

The sporingsnummer in the second class is null but when i look at the bundle i can find the right information at mExtras -> mMap -> [0] -> value

How can i get this to work ?

4

1 回答 1

4

我认为以下行:

intent.putExtra("sporingsnummer",et_sporingsnummer.getText());

需要是这样的:

intent.putExtra("sporingsnummer",et_sporingsnummer.getText().toString());

这些getText()方法只返回一个editable非字符串。您需要将可编辑转换为字符串。

于 2013-08-13T14:00:35.513 回答