2010-06-11 24 views
0

當我在onActivityResult,我試圖表明一個自定義進度對話框,
的對話框不顯示,但該函數被調用,但沒有顯示
如果我把這個對話框中的OnCreate它的工作,我看到對話框, 是否有可能在Intent.ACTION_GET_CONTENT/MediaStore.ACTION_IMAGE_CAPTURE的回報顯示自定義對話框安卓:內onActivityResult ShowDialog的不是顯示器起飛後照片

感謝

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

Anwser :)

  1. 播放尋找熱塑成型任務的AsyncTask裏面doInBackground
  2. 啓動對話通話意圖

所以更換尋找熱塑成型任務UploadPhoto.uploadPhoto(InfoPasse,selectedImagePath);
by 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(); 
} 

}