操作栏中的后退导航

Back Navigation in Actionbar

我有一个导航抽屉(MainMenu.class 配置) 首先 MainMenu 加载 NewRadioFragment 然后我单击 NewRadioFragment 上的按钮开始到 ViewPager,ViewPager 有(PlayRadioFragment 和 BlogContentFragment)通过 ViewPagerActivity(FragmentActivity)查看。

现在,我希望操作栏中的后退按钮从 PlayRadioFragment 返回到 NewRadioFragment。

我需要帮助!

更新

private void setImageView(ImageView src, View rootView) {
        image_disk = (ImageView) rootView.findViewById(R.id.base);
        new Thread(new Runnable() {
            @Override
            public void run() {
                final Bitmap bimit = Utils.loadBitmap(image_url);
                image_disk.post(new Runnable() {
                    @Override
                    public void run() {
                        image_disk.setImageBitmap(bimit);
                        prg_loading.setVisibility(View.GONE);
                        tv_loading.setVisibility(View.GONE);
                        btnPlay.setVisibility(View.VISIBLE);
                    }
                });
            }
        }).start();
    }

当我点击函数时没有完成

你试过这个吗?

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    // Respond to the action bar's Up/Home button
    case android.R.id.home:

    Intent upIntent = NavUtils.getParentActivityIntent(this);
    if (NavUtils.shouldUpRecreateTask(this, upIntent)) {
        // This activity is NOT part of this app's task, so create a new task
        // when navigating up, with a synthesized back stack.
        TaskStackBuilder.create(this)
                // Add all of this activity's parents to the back stack
                .addNextIntentWithParentStack(upIntent)
                // Navigate up to the closest parent
                .startActivities();
    } else {
        // This activity is part of this app's task, so simply
        // navigate up to the logical parent activity.
        NavUtils.navigateUpTo(this, upIntent);
    }
    return true;
 }
  return super.onOptionsItemSelected(item);
}

或 试试这个

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    // Respond to the action bar's Up/Home button
    case android.R.id.home:
        NavUtils.navigateUpFromSameTask(this);
        return true;
    }
    return super.onOptionsItemSelected(item);
}

或 打电话

Finish();