我有兩個活動,在activityA
我有一個圖標,單擊該圖標我發送意向到其他activityB
,這是調用Facebook頁面(自定義dailog),因爲fbdailog
是服用時間來加載我想實現progressdailog
,下面是我的代碼Android:如何使用意圖關閉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
仍清晰可見,我怎麼能拒絕來自activityA
的progreessdailog
。任何幫助表示讚賞
可以使用dialog.dismiss();在startActivity之後。 –