0

Android アプリケーションで戻るボタンの機能を開発する必要があります。

タブグループ アクティビティに 4 つのタブがあります。ここで、4 番目のタブを作成する必要があります。これは [戻る] です。

ここで i have to 4th tab は、4 番目のタブが前のアクティビティに移動することを意味します。

これらは私のタブグループアクティビティコードです:

intent = new Intent().setClass(this, MainGroupActivity.class);
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

    // Initialize a TabSpec for each tab and add it to the TabHost
    spec = tabhost.newTabSpec("Home").setIndicator("Home", 
                    res.getDrawable(R.drawable.arrow_up_float))
                    .setContent(intent);
    tabhost.addTab(spec);

    intent = new Intent().setClass(this, CartGroupActivity.class);
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

    // Initialize a TabSpec for each tab and add it to the TabHost
    spec = tabhost
            .newTabSpec("Cart")
            .setIndicator("Cart",
                    res.getDrawable(R.drawable.arrow_down_float))// debttab moretab
                                                        // expensestab
            .setContent(intent);
    tabhost.addTab(spec);

    intent = new Intent().setClass(this, LoginGroupActivty.class);
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    // Initialize a TabSpec for each tab and add it to the TabHost
    spec = tabhost.newTabSpec("Login").setIndicator("Login",
                   res.getDrawable(R.drawable.btn_default_small))
                   .setContent(intent);
    tabhost.addTab(spec);
    intent = new Intent().setClass(this, GoBackActivity.class);
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

    // Initialize a TabSpec for each tab and add it to the TabHost
    spec = tabhost
            .newTabSpec("Go Back")
            .setIndicator("Go Back",
                    res.getDrawable(R.drawable.arrow_down_float))// debttab moretab
                                                        // expensestab
            .setContent(intent);
    tabhost.addTab(spec);

ここで、MainGroupActivity には 2 つの子クラスがあります...つまり、メイン グループ アクティビティにはリストビューがあります。リストをクリックする必要があるということは、最初の子アクティビティに移動し、次の画面に 4 つのタブ (タブグループ) を含むリストビューが表示されていることを意味します。最初の子の任意のリストをクリックすると、2 番目の子ビューに移動し、4 つのタブ (タブグループ) でリストビューが表示されます。2 番目の子ビューで 4 番目のタブ (戻る) をクリックしたい場合は、前のアクティビティ (1 番目の子ビュー) に移動することを意味します。 ..どのようにできるのか ???私を助けてください...

4番目のタブの条件を書くにはどうすればいいですか.これらの目的のためのコードを教えてください.

4

1 に答える 1