私は4つのタブを含むタブホストアプリケーションに取り組んでいます。各タブにはアイテムを一覧表示する個々のアクティビティがあります。各タブの項目クリックで、同じタブのホスト画面レイアウトでクリックされたリスト項目の詳細を表示する別のアクティビティが表示されます。以前の活動が得られない
タブホストから項目をクリックして戻るボタンを押すと、アプリケーションは終了します。しかし、私は以前に届いたリストとタブにアクセスする必要があります。これを達成する方法は?アドバンス
のおかげでは、これは私のサンプルコードです -
ListAdapter adapter = new SimpleAdapter(this, mylist , R.layout.list,
new String[] { "title","shortdescription"},
new int[] { R.id.titleTextView,R.id.descriptionTextView});
ListView list = (ListView)findViewById(R.id.statutesListView);
list.setAdapter(adapter);
list.setOnItemClickListener(new OnItemClickListener()
{
public void onItemClick(AdapterView<?> parent, View view, int position, long id)
{
HashMap<String, String> hashMap = new HashMap<String, String>();
hashMap = (HashMap<String, String>) parent.getItemAtPosition(position);
String newstitle = hashMap.get("title");
String newsdesc = hashMap.get("shortdescription");
//Get the new Activity to tab.
Intent intent = new Intent(getApplicationContext(), detailedview.class);
Bundle bundle = new Bundle();
bundle.putString("title", newstitle);
bundle.putString("desc", newsdesc);
intent.putExtras(bundle);
View setview = getLocalActivityManager().startActivity("statutes", intent).getDecorView();
setContentView(setview);
}
});
これはできません:set setview = getLocalActivityManager()。startActivity( "statutes"、intent).getDecorView(); setContentView(setview); –
はい、それは動作していますが、私は戻るボタンを押して、私のアプリを終了します – Praveenkumar