Мои первые отладки Действия исправляют выходы имени и адреса местоположения, однако второе действие дает мне нулевое значение. Помог бы кто-нибудь?Невозможно передать данные из активности в другую
FirstActivity
mySavedListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent next = new Intent(MyDestination.this, MyLocationDetail.class);
Bundle extra = getIntent().getExtras();
String locationName = myList.get(position).getLocation_name();
String address = myList.get(position).getAddress();
extra.putString("extra_location", locationName);
extra.putString("extra_address", address);
Log.d(TAG, "name is " + locationName);
Log.d(TAG, "address is "+ address);
intent.putExtras(extra);
startActivity(next);
}
});
SecondActivity
Bundle b = getIntent().getExtras();
String locationName = b.getString("extra_location");
String address = b.getString("extra_address");
Log.d(TAG, "location "+locationName);
'next.putExtras (дополнительный)' вместо 'intent.putExtras (дополнительного);' Где переменная намерение приходит? – WalterM
ой, позвольте мне попробовать. Спасибо – Tuan