在下面的代码 spinet 中,我希望该对话框仅在我完成其工作的活动(意图)之后出现。我搜索了很多,但无法弄清楚如何做到这一点。:( 目前,当 Intent I 工作时弹出对话框。
有谁知道如何让对话框等到 Intent 我完成它的工作
谢谢
Intent i = new Intent(MainActivity.this, KeyFrame.class);
i.putExtra("keyFrame", filename1+"#"+duration);
//Log.e("Mobicom: Video Name" + MainActivity.videoDir + video_filename, MainActivity.videoDir + video_filename);
startActivity(i);
MainActivity.this.showDialog(MainActivity.GENRE_PREFERENCE_OPTION);
这是完整的代码。
@Override
public Dialog onCreateDialog(int id) {
switch (id) {
case VIDEO_OPTION_DIALOG:
Builder optionDialog = new AlertDialog.Builder(this);
optionDialog.setTitle("Options");
optionDialog.setItems(
new String[] { "Option1", "Option2", "Delete", "Cancel"},
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
String video_filename = MainActivity.mSelectedVideoFilename;
String filename1 = MainActivity.videoDir + video_filename;
switch (which) {
case OPTION_PREVIEW_ID:
// preview
startActivity(new Intent().setAction(android.content.Intent.ACTION_VIEW).setDataAndType(Uri.fromFile(new File(MainActivity.videoDir + video_filename)), "video/*"));
break;
case OPTION_PREVIEW_WITH_RECOM_ID:
Intent i = new Intent(MainActivity.this, KeyFrame.class);
i.putExtra("keyFrame", filename1+"#"+duration);
//Log.e("Mobicom: Video Name" + MainActivity.videoDir + video_filename, MainActivity.videoDir + video_filename);
startActivity(i);
MainActivity.this.showDialog(MainActivity.GENRE_PREFERENCE_OPTION);
//finish();
break;
}