我正在構建一個簡單的菜單驅動的應用程序,我的意圖實現給了我幾個問題。Android ListView和Intents問題
我有3個菜單。 Menu1需要將信息傳遞給Menu2,而Menu2需要將信息從Menu1和Menu2傳遞給Menu3。爲此,我在這個意義上使用Intents。
String product = ((TextView) view).getText().toString();
// Launching new Activity on selecting single List Item
Intent i = new Intent(getApplicationContext(), AccountList.class);
// sending data to new activity
i.putExtra("product", product);
startActivity(i);
這應該通過ListSelection到下一個活動即爲accountList和爲accountList傳遞相同於SingleListItem如下
TextView txtProduct = (TextView) findViewById(R.id.list_label);
Intent i = getIntent();
// getting attached intent data
String product = i.getStringExtra("product");
// displaying selected product name
txtProduct.setText(product);
現在上述應顯示從爲accountList的ListSelection但很可惜,它不這樣做所以。任何援助,你可以提供將不勝感激。
嘗試getIntent()。getExtras()的getString( 「產品」) –