当我在onActivityResult并且我尝试显示自定义进度对话框时,
对话框未显示,但调用了该功能,但未显示任何内容
如果我把这个对话框放在Oncreate中它正在工作,我会看到对话框,
是否可以在返回Intent.ACTION_GET_CONTENT / MediaStore.ACTION_IMAGE_CAPTURE
由于
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Parseur UploadPhoto = new Parseur();
showDialog(PROGRESS_DIALOG);
if (requestCode == z_const.REQUEST_INTENT_CODE_PHOTO_CHOISIR) {
String selectedImagePath;
Uri selectedImageUri;
if (data != null){
selectedImageUri = data.getData();
selectedImagePath = getPath(selectedImageUri);
Log.e(TAG, "PHOTO CHOISIR " + selectedImagePath+"Res"+resultCode);
UploadPhoto.uploadPhoto(InfoPasse,selectedImagePath);
}
}
finish();
}
protected Dialog onCreateDialog(int id) {
Log.e(TAG," DIAL appeller "+id);
switch(id) {
case PROGRESS_DIALOG:
progressDialog = new ProgressDialog(Photo.this);
progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
progressDialog.setMessage("Loading...");
progressThread = new ProgressThread(handler);
progressThread.start();
return progressDialog;
default:
return null;
}
}
答案 0 :(得分:0)
Anwser:)
所以替换loking任务UploadPhoto.uploadPhoto(InfoPasse,selectedImagePath);
通过new UploadInBackground()。execute(selectedImagePath);
和AsyncTask看起来像:
private class UploadInBackground extends AsyncTask<String, Integer, Long> {
@Override
protected Long doInBackground(String... params) {
UploadPhoto.uploadPhoto(InfoPasse,params[0]);
return null
}
@Override
protected void onProgressUpdate(Integer... progress) {
}
@Override
protected void onPostExecute(Long result) {
finish();
}
}