Android:如何使用意图关闭progressdailog

时间:2012-12-27 10:25:35

标签: android android-intent progressdialog

我有两个活动,在activityA我有一个图标,点击该图标我发送意图到其他activityB,即调用facebook页面(自定义dailog),因为{{ 1}}需要时间来加载我正在尝试实现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; } }); } 后,fbdailog仍然可见,我如何从progressdailog中解除progreessdailog。任何帮助表示赞赏

1 个答案:

答案 0 :(得分:0)

在ActivityA的onActivityResult()中执行:

if (dialog != null) {
    dialog.dismiss();
}