To capture actions performed on one Activity within another requires three steps.

Launch the secondary Activity (your 'camera Activity') as a subactivity by using startActivityForResult instead of startActivity.

Intent i = new Intent(this,CameraActivity.class);
startActivityForResult(i, STATIC_INTEGER_VALUE);

Within the subactivity (camera Activity), rather than just closing the Activity when a user clicks the different tab image, you need to create a new Intent and include the index of the tab to display when you return to the parent app using the extras bundle. To pass it back to the parent call setResult before calling finish to close the camera Activity.

resultIntent = new Intent(null);
resultIntent.putExtra(PUBLIC_STATIC_STRING_IDENTIFIER, tabIndexValue);
setResult(Activity.RESULT_OK, resultIntent);
finish();

The final step is in the calling Activity, override onActivityResult to listen for callbacks from the camera Activity. Get the extra from the returned Intent to determine the index of the tab you should be displaying.

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch(requestCode) {
case (STATIC_INTEGER_VALUE) : {
if (resultCode == Activity.RESULT_OK) {
int tabIndex = data.getIntExtra(PUBLIC_STATIC_STRING_IDENTIFIER);
// TODO Switch tabs using the index.
}
break;
}
}
}

更多相关文章

  1. 代码中设置drawableleft
  2. android 3.0 隐藏 系统标题栏
  3. Android开发中activity切换动画的实现
  4. Android(安卓)学习 笔记_05. 文件下载
  5. Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
  6. 技术博客汇总
  7. android 2.3 wifi (一)
  8. AndRoid Notification的清空和修改
  9. Android中的Chronometer

随机推荐

  1. Android(安卓)学习论坛博客及网站推荐
  2. 一步步探索学习Android(安卓)Touch事件分
  3. Android中shape的使用
  4. Android帮助文档翻译——开发指南(十五)获
  5. Android预定义样式?android:attr/attribu
  6. android之CalendarView日历视图
  7. Android之隐式意图(Intent)如何查找匹配
  8. Android开发之如何获取Android手机屏幕的
  9. 【android开发】解析xml文件①
  10. Android(安卓)imageview图片缩放实现