當我在應用程序中從圖庫中上傳圖像,但是當我選擇了一些圖像時,我得到了這個異常。從galleryActivity加載圖像時泄露了最初添加的窗口?
android.view.WindowLeaked: Activity has leaked window [email protected] that was originally added here
android.view.WindowManagerImpl.addView(Win
dowManagerImpl.java:152) 我沒有;噸爲什麼我得到異常隨機?
這個代碼是開放的畫廊..
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
((Activity) context).startActivityForResult(Intent.createChooser(intent,"Select Picture"), PICK_FROM_FILE);
下面的代碼是從畫廊 得到的bimap我
f (resultCode == RESULT_OK)
{
Uri contentUri = data.getData();
System.out.println("**************contentUri***************"+contentUri);
String[] proj = { MediaStore.Images.Media.DATA };
Cursor cursor = managedQuery(contentUri, proj, null, null, null);
int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();
String tmppath = cursor.getString(column_index);
// File abc= new File(tmppath);
System.out.println("**************tmppath***************"+tmppath);
Bitmap mBitmap = BitmapFactory.decodeFile(tmppath);
// Bitmap bitmap = BitmapFactory.decodeFile(abc);
System.out.println("**************mBitmap(gallery)***************"+mBitmap);
Court_formations objectdat =new Court_formations();
objectdat.showGalleryimage(getDialogContext(),mBitmap);
plz幫助
你能不能粘貼你的代碼 – 2012-04-16 07:22:00
當我在horizonall模式下打開圖庫,然後回到應用程序,因爲它修復了potrait模式,然後我得到了這個異常 – user1287756 2012-04-16 07:30:44
你只是從圖像中選取圖像並在imageview上顯示它? – 2012-04-16 07:37:11