2012-01-28 3 views
0

私は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); 
      } 
     }); 
+0

これはできません:set setview = getLocalActivityManager()。startActivity( "statutes"、intent).getDecorView(); setContentView(setview); –

+0

はい、それは動作していますが、私は戻るボタンを押して、私のアプリを終了します – Praveenkumar

答えて

1

チェックこのリンクアウトし、ダウンロードサンプル・コード、それに設けられており、私はより多くの要件

multiple activities in single tab

このコードでのために知っていますこのリンクはあなたの問題も解決します

+0

はい、それは便利です – Praveenkumar

+0

私はこのメソッドの使用で1つのバグがあります。 – Praveenkumar

+0

私の友人に知らせてくれたどんな種類のバグ –

関連する問題