0

我有两个活动,在activityA我有一个图标,单击该图标我正在向其他人发送一个意图activityB,即调用 facebook 页面(自定义 dailog),因为fbdailog我正在尝试实现加载时间progressdailog,下面是我的代码

ImageView faceBookIntegration = (ImageView) activity
                .findViewById(R.id.facebookintegration);
        faceBookIntegration.setOnTouchListener(new OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                Constants.isLayoutTouched = true;
                switch (event.getAction()) {
                case MotionEvent.ACTION_DOWN: {

                    CityAttractions.this.runOnUiThread(new Runnable() {
                        public void run() {
                         dialog = ProgressDialog.show(CityAttractions.this, "","Please wait...", true);
                            dialog.show();
                        }
                    });

                    Intent menuSettingsIntent = new Intent(CityAttractions.this, ShareOnFacebook.class);
                    menuSettingsIntent.putExtra("facebookMessage", "Msg");
                    startActivityForResult(new Intent(menuSettingsIntent).addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT), 1);                  

                    break;              
                }                       
                case MotionEvent.ACTION_MOVE:
                    break;
                case MotionEvent.ACTION_UP:
                    break;
                }
                return false;
            }

        });

    }

问题是在发布或取消之后fbdailogprogressdailog仍然可见,我该如何关闭progreessdailogfrom activityA。任何帮助表示赞赏

4

1 回答 1

0

onActivityResult()ActivityA 中做:

if (dialog != null) {
    dialog.dismiss();
}
于 2012-12-27T13:34:21.543 回答