0

ユーザーが写真を撮ってウェブサイトにアップロードするアプリがあります。

私は今このコードを持っています:

@Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        if (requestCode == CAMERA_PIC_REQUESTED) {
            if(resultCode == RESULT_OK) {   
                // Maybe add the additional code here?          

                picture = convertImageUriToFile(imageUri, this);


                Thread thread = new Thread(null, uploader, "MagentoBackground");
                thread.start();
                m_ProgressDialog = ProgressDialog.show(pictures.this, "Please wait...", "Uploading data ...", true, true);

            }
        } else if (requestCode == EXPERIMENT_CODE) {
            if (resultCode == Activity.RESULT_OK) {
                experimentInput.setText("" + data.getExtras().getInt("edu.cs.h.exp_id"));
            }
        }
    }

ただし、画像をダウンロードする前に、ユーザーが画像を説明するために選択できるアイテムのリストを含むスピナー (ドロップダウン メニュー) を表示するレイアウトを追加したいと考えています。

OK画像がアップロードされる前に新しいレイアウトが表示され、ユーザーが選択を行ってそのレイアウトのボタンを押してから、このコードに戻ってアップロード プロセスを続行するには、コードに何を追加すればよいでしょうか?

4

1 に答える 1

2
static final int _MY_DIALOG_ = 11;

if(resultCode == RESULT_OK) {   
    showDialog(_MY_DIALOG_);
}

@Override
protected Dialog onCreateDialog(int id) {
    if(id==_MY_DIALOG_){
        CharSequence[] shush = new CharSequence[10];
        //initialize shush
        Dialog dialog = new AlertDialog.Builder(this).setTitle("Select Animation")
            .setSingleChoiceItems(shush, 0,
            new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    //the user has selected which!!!
                    dialog.dismiss();
                }
            }).create();
        dialog.setOnDismissListener(new OnDismissListener() {
            @Override
            public void onDismiss(DialogInterface arg0) {
                //do what you want now since the user selected!
                picture = convertImageUriToFile(imageUri, this);
                Thread thread = new Thread(null, uploader, "MagentoBackground");
                thread.start();
                m_ProgressDialog = ProgressDialog.show(pictures.this, "Please wait...", "Uploading data ...", true, true);
            }
        });
        return dialog;
    }
    return null;
}
于 2011-09-23T15:21:53.587 に答える