我的应用包含5个屏幕。在第一个屏幕中,我从服务器加载一些数据,并在第二个屏幕的列表视图中显示这些数据。在列表视图中,我必须显示每行的图像。这些图像是动态下载的,也正在缓存。下载发生在后台,我已经为列表视图提供了notifyDataSetChanged()。
当下载进行时,我可以移动到其他3个屏幕。在这3个屏幕中,我有一个具有相同功能的按钮,即显示一个对话框,其中包含与我的第二个屏幕相同的列表。
问题是当我从这个对话框中选择一个值时,比如2或3次,当前活动消失并自动移动到我的第二页。
我无法确定其背后的原因。请查看我得到的日志。任何人都可以告诉为什么会出现这个问题吗?
> 08-25 10:44:31.505: WARN/AudioFlinger(2573): write blocked for 73 msecs, 92 delayed writes, thread 0x5e518
08-25 10:44:31.515: DEBUG/szipinf(17236): Initializing inflate state
08-25 10:44:31.635: INFO/DEBUG(16421): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
08-25 10:44:31.635: INFO/DEBUG(16421): Build fingerprint: 'samsung/GT-I9100/GT-I9100:2.3.3/GINGERBREAD/XWKE8:user/release-keys'
08-25 10:44:31.635: INFO/DEBUG(16421): pid: 17236, tid: 17236 >>> com.test.android <<<
08-25 10:44:31.635: INFO/DEBUG(16421): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadbaad
08-25 10:44:31.635: INFO/DEBUG(16421): r0 00000027 r1 deadbaad r2 a0000000 r3 00000000
08-25 10:44:31.635: INFO/DEBUG(16421): r4 00000001 r5 00000000 r6 bea102c0 r7 0000a000
08-25 10:44:31.635: INFO/DEBUG(16421): r8 00646278 r9 00030000 10 00000000 fp bea1022c
08-25 10:44:31.635: INFO/DEBUG(16421): ip afd46688 sp bea100e0 lr afd19471 pc afd15f40 cpsr 68000030
08-25 10:44:31.635: INFO/DEBUG(16421): d0 fffff7d600000d72 d1 40e3100000000800
08-25 10:44:31.635: INFO/DEBUG(16421): d2 40b9f00000000000 d3 c14fec0040535000
08-25 10:44:31.635: INFO/DEBUG(16421): d4 40e31000c182a600 d5 0000000000000000
08-25 10:44:31.635: INFO/DEBUG(16421): d6 4557200000071880 d7 45000000c502a000
08-25 10:44:31.635: INFO/DEBUG(16421): d8 0000000000000000 d9 4680000046800000
08-25 10:44:31.635: INFO/DEBUG(16421): d10 0000000042d2aaaa d11 0000000000000000
08-25 10:44:31.635: INFO/DEBUG(16421): d12 0000000000000000 d13 0000000000000000
08-25 10:44:31.635: INFO/DEBUG(16421): d14 0000000000000000 d15 0000000000000000
08-25 10:44:31.635: INFO/DEBUG(16421): d16 00000000000000a0 d17 40e631e000000000
08-25 10:44:31.635: INFO/DEBUG(16421): d18 3faeb851e0000000 d19 3fc3333340000000
08-25 10:44:31.635: INFO/DEBUG(16421): d20 3fe3333340000000 d21 3fd3333340000000
08-25 10:44:31.635: INFO/DEBUG(16421): d22 3fd51eb860000000 d23 40e01d100abe0000
08-25 10:44:31.635: INFO/DEBUG(16421): d24 40dd4c2013880000 d25 40ed4c1013880000
08-25 10:44:31.635: INFO/DEBUG(16421): d26 40cd4c4013880000 d27 0000000000000000
08-25 10:44:31.635: INFO/DEBUG(16421): d28 0002d4740002d474 d29 407c300000000000
08-25 10:44:31.635: INFO/DEBUG(16421): d30 0000000000000000 d31 3ff0000000000000
08-25 10:44:31.635: INFO/DEBUG(16421): scr 80000012
08-25 10:44:31.695: INFO/AudioFlinger(2573): stop output streamType (0, 1) for 1
08-25 10:44:31.695: DEBUG/AudioHardwareYamaha(2573): AudioStreamOut::setParameters(keyValuePairs="stop_output_streamtype=1")
08-25 10:44:31.735: INFO/DEBUG(16421): #00 pc 00015f40 /system/lib/libc.so
08-25 10:44:31.735: INFO/DEBUG(16421): #01 pc 000138b0 /system/lib/libc.so
08-25 10:44:31.735: INFO/DEBUG(16421): #02 pc 00014776 /system/lib/libc.so
08-25 10:44:31.735: INFO/DEBUG(16421): #03 pc 0005079c /system/lib/libskia.so
08-25 10:44:31.735: INFO/DEBUG(16421): #04 pc 0005089c /system/lib/libskia.so
08-25 10:44:31.740: INFO/DEBUG(16421): #05 pc 0007d164 /system/lib/libskia.so
08-25 10:44:31.740: INFO/DEBUG(16421): #06 pc 0007d220 /system/lib/libskia.so
08-25 10:44:31.740: INFO/DEBUG(16421): #07 pc 0007d360 /system/lib/libskia.so
08-25 10:44:31.740: INFO/DEBUG(16421): #08 pc 0007d808 /system/lib/libskia.so
08-25 10:44:31.740: INFO/DEBUG(16421): #09 pc 00080344 /system/lib/libskia.so
08-25 10:44:31.740: INFO/DEBUG(16421): code around pc:
08-25 10:44:31.740: INFO/DEBUG(16421): afd15f20 2c006824 e028d1fb b13368db c064f8df
08-25 10:44:31.740: INFO/DEBUG(16421): afd15f30 44fc2401 4000f8cc 49124798 25002027
08-25 10:44:31.740: INFO/DEBUG(16421): afd15f40 f7f57008 2106eb46 ecbaf7f6 460aa901
08-25 10:44:31.740: INFO/DEBUG(16421): afd15f50 f04f2006 95015380 95029303 e820f7f6
08-25 10:44:31.740: INFO/DEBUG(16421): afd15f60 462aa905 f7f62002 f7f5e82c 2106eb32
08-25 10:44:31.740: INFO/DEBUG(16421): code around lr:
08-25 10:44:31.745: INFO/DEBUG(16421): afd19450 4a0e4b0d e92d447b 589c41f0 26004680
08-25 10:44:31.745: INFO/DEBUG(16421): afd19460 686768a5 f9b5e006 b113300c 47c04628
08-25 10:44:31.745: INFO/DEBUG(16421): afd19470 35544306 37fff117 6824d5f5 d1ef2c00
08-25 10:44:31.745: INFO/DEBUG(16421): afd19480 e8bd4630 bf0081f0 000280cc ffffff88
08-25 10:44:31.745: INFO/DEBUG(16421): afd19490 b086b570 f602fb01 9004460c a804a901
08-25 10:44:31.745: INFO/DEBUG(16421): stack:
08-25 10:44:31.745: INFO/DEBUG(16421): bea100a0 afd42684
08-25 10:44:31.745: INFO/DEBUG(16421): bea100a4 000afba8
08-25 10:44:31.745: INFO/DEBUG(16421): bea100a8 00000015
08-25 10:44:31.745: INFO/DEBUG(16421): bea100ac afd18539 /system/lib/libc.so
08-25 10:44:31.745: INFO/DEBUG(16421): bea100b0 afd4272c
08-25 10:44:31.745: INFO/DEBUG(16421): bea100b4 afd426d8
08-25 10:44:31.745: INFO/DEBUG(16421): bea100b8 00000000
08-25 10:44:31.745: INFO/DEBUG(16421): bea100bc afd19471 /system/lib/libc.so
08-25 10:44:31.745: INFO/DEBUG(16421): bea100c0 00000001
08-25 10:44:31.745: INFO/DEBUG(16421): bea100c4 bea100f4
08-25 10:44:31.745: INFO/DEBUG(16421): bea100c8 bea102c0
08-25 10:44:31.745: INFO/DEBUG(16421): bea100cc 0000a000
08-25 10:44:31.745: INFO/DEBUG(16421): bea100d0 00646278
08-25 10:44:31.745: INFO/DEBUG(16421): bea100d4 afd18793 /system/lib/libc.so
08-25 10:44:31.745: INFO/DEBUG(16421): bea100d8 df002777
08-25 10:44:31.745: INFO/DEBUG(16421): bea100dc e3a070ad
08-25 10:44:31.745: INFO/DEBUG(16421): #00 bea100e0 00000000
08-25 10:44:31.745: INFO/DEBUG(16421): bea100e4 0017d908
08-25 10:44:31.745: INFO/DEBUG(16421): bea100e8 0017d8c0
08-25 10:44:31.745: INFO/DEBUG(16421): bea100ec 002b1d30
08-25 10:44:31.745: INFO/DEBUG(16421): bea100f0 bea102c0
08-25 10:44:31.745: INFO/DEBUG(16421): bea100f4 fffffbdf
08-25 10:44:31.745: INFO/DEBUG(16421): bea100f8 00646278
08-25 10:44:31.745: INFO/DEBUG(16421): bea100fc afd46470
08-25 10:44:31.745: INFO/DEBUG(16421): bea10100 002b1d30
08-25 10:44:31.745: INFO/DEBUG(16421): bea10104 afd138b5 /system/lib/libc.so
08-25 10:44:31.745: INFO/DEBUG(16421): #01 bea10108 0017d8c0
08-25 10:44:31.745: INFO/DEBUG(16421): bea1010c 002b1d30
08-25 10:44:31.750: INFO/DEBUG(16421): bea10110 ab217314
08-25 10:44:31.750: INFO/DEBUG(16421): bea10114 002b30f8
08-25 10:44:31.750: INFO/DEBUG(16421): bea10118 00646278
08-25 10:44:31.750: INFO/DEBUG(16421): bea1011c afd14779 /system/lib/libc.so
08-25 10:44:32.140: INFO/BootReceiver(2689): Copying /data/tombstones/tombstone_03 to DropBox (SYSTEM_TOMBSTONE)
08-25 10:44:32.145: INFO/DEBUG(16421): dumpstate /data/log/dumpstate_app_native.txt
08-25 10:44:32.150: INFO/dumpstate(17848): begin
08-25 10:44:32.165: INFO/dalvikvm(2689): threadid=4: reacting to signal 3
08-25 10:44:32.170: INFO/dalvikvm(2689): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.170: INFO/dalvikvm(2810): threadid=4: reacting to signal 3
08-25 10:44:32.170: INFO/dalvikvm(2810): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.170: INFO/dalvikvm(2832): threadid=4: reacting to signal 3
08-25 10:44:32.175: INFO/dalvikvm(2832): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.175: INFO/dalvikvm(2836): threadid=4: reacting to signal 3
08-25 10:44:32.175: INFO/dalvikvm(2836): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.175: INFO/dalvikvm(2837): threadid=4: reacting to signal 3
08-25 10:44:32.175: INFO/dalvikvm(2837): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.180: INFO/dalvikvm(2838): threadid=4: reacting to signal 3
08-25 10:44:32.180: INFO/dalvikvm(2838): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.180: INFO/dalvikvm(2840): threadid=4: reacting to signal 3
08-25 10:44:32.180: INFO/dalvikvm(2840): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.180: INFO/dalvikvm(2846): threadid=4: reacting to signal 3
08-25 10:44:32.200: ERROR/yamaha::media::Parameters(2573): SalesCode = INU
08-25 10:44:32.240: INFO/dalvikvm(2846): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.240: INFO/dalvikvm(2916): threadid=4: reacting to signal 3
08-25 10:44:32.245: INFO/dalvikvm(2916): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.245: INFO/dalvikvm(2962): threadid=4: reacting to signal 3
08-25 10:44:32.250: INFO/dalvikvm(2962): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.250: INFO/dalvikvm(3104): threadid=4: reacting to signal 3
08-25 10:44:32.250: INFO/dalvikvm(3104): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.250: INFO/dalvikvm(3238): threadid=4: reacting to signal 3
08-25 10:44:32.250: INFO/dalvikvm(3238): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.250: INFO/dalvikvm(3405): threadid=4: reacting to signal 3
08-25 10:44:32.255: INFO/dalvikvm(3405): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.255: INFO/dalvikvm(3461): threadid=4: reacting to signal 3
08-25 10:44:32.255: INFO/dalvikvm(3461): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.255: INFO/dalvikvm(3503): threadid=4: reacting to signal 3
08-25 10:44:32.255: INFO/dalvikvm(3503): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.255: INFO/dalvikvm(3574): threadid=4: reacting to signal 3
08-25 10:44:32.255: INFO/dalvikvm(3574): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.255: INFO/dalvikvm(3594): threadid=4: reacting to signal 3
08-25 10:44:32.260: INFO/dalvikvm(3594): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.260: INFO/dalvikvm(3602): threadid=4: reacting to signal 3
08-25 10:44:32.260: INFO/dalvikvm(3602): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.260: INFO/dalvikvm(3633): threadid=4: reacting to signal 3
08-25 10:44:32.265: INFO/dalvikvm(3633): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.265: INFO/dalvikvm(3644): threadid=4: reacting to signal 3
08-25 10:44:32.265: INFO/dalvikvm(3644): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.265: INFO/dalvikvm(5258): threadid=4: reacting to signal 3
08-25 10:44:32.270: INFO/dalvikvm(5258): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.270: INFO/dalvikvm(6665): threadid=4: reacting to signal 3
08-25 10:44:32.270: INFO/dalvikvm(6665): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.270: INFO/dalvikvm(12988): threadid=4: reacting to signal 3
08-25 10:44:32.275: INFO/dalvikvm(12988): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.275: INFO/dalvikvm(13199): threadid=4: reacting to signal 3
08-25 10:44:32.275: INFO/dalvikvm(13199): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.275: INFO/dalvikvm(13271): threadid=4: reacting to signal 3
08-25 10:44:32.275: INFO/dalvikvm(13271): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.275: INFO/dalvikvm(13304): threadid=4: reacting to signal 3
08-25 10:44:32.280: INFO/dalvikvm(13304): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.280: INFO/dalvikvm(13332): threadid=4: reacting to signal 3
08-25 10:44:32.280: INFO/dalvikvm(13332): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.280: INFO/dalvikvm(13342): threadid=4: reacting to signal 3
08-25 10:44:32.280: INFO/dalvikvm(13342): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.280: INFO/dalvikvm(13352): threadid=4: reacting to signal 3
08-25 10:44:32.280: INFO/dalvikvm(13352): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.280: INFO/dalvikvm(13366): threadid=4: reacting to signal 3
08-25 10:44:32.285: INFO/dalvikvm(13366): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.285: INFO/dalvikvm(13374): threadid=4: reacting to signal 3
08-25 10:44:32.285: INFO/dalvikvm(13374): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.285: INFO/dalvikvm(13403): threadid=4: reacting to signal 3
08-25 10:44:32.285: INFO/dalvikvm(13403): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.285: INFO/dalvikvm(13608): threadid=4: reacting to signal 3
08-25 10:44:32.285: INFO/dalvikvm(13608): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.290: INFO/dalvikvm(13866): threadid=4: reacting to signal 3
08-25 10:44:32.290: INFO/dalvikvm(13866): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.290: INFO/dalvikvm(13897): threadid=4: reacting to signal 3
08-25 10:44:32.290: INFO/dalvikvm(13897): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.290: INFO/dalvikvm(14304): threadid=4: reacting to signal 3
08-25 10:44:32.290: INFO/dalvikvm(14304): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.290: INFO/dalvikvm(14471): threadid=4: reacting to signal 3
08-25 10:44:32.295: INFO/dalvikvm(14471): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.295: INFO/dalvikvm(17236): threadid=4: reacting to signal 3
08-25 10:44:32.495: INFO/dalvikvm(17511): threadid=4: reacting to signal 3
08-25 10:44:32.500: INFO/dalvikvm(17511): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.505: INFO/dalvikvm(17583): threadid=4: reacting to signal 3
08-25 10:44:32.515: INFO/dalvikvm(17583): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.515: INFO/dalvikvm(17595): threadid=4: reacting to signal 3
08-25 10:44:32.520: INFO/dalvikvm(17595): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.520: INFO/dalvikvm(17620): threadid=4: reacting to signal 3
08-25 10:44:32.535: INFO/dalvikvm(17620): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.540: INFO/dalvikvm(17653): threadid=4: reacting to signal 3
08-25 10:44:32.550: INFO/dalvikvm(17653): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.550: INFO/dalvikvm(17664): threadid=4: reacting to signal 3
08-25 10:44:32.560: INFO/dalvikvm(17664): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.560: INFO/dalvikvm(17672): threadid=4: reacting to signal 3
08-25 10:44:32.570: INFO/dalvikvm(17672): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.570: INFO/dalvikvm(17689): threadid=4: reacting to signal 3
08-25 10:44:32.580: INFO/dalvikvm(17689): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.580: INFO/dalvikvm(17696): threadid=4: reacting to signal 3
08-25 10:44:32.600: INFO/dalvikvm(17696): Wrote stack traces to '/data/anr/traces.txt'
08-25 10:44:32.795: ERROR/lights(2689): write_int: path /sys/devices/virtual/misc/melfas_touchkey/brightness, value 2
08-25 10:44:32.795: WARN/PowerManagerService(2689): Timer 0x7->0x3|0x0
08-25 10:44:32.795: INFO/PowerManagerService(2689): Ulight 7->3|0
08-25 10:44:32.795: DEBUG/PowerManagerService(2689): setLightBrightness : mButtonLight : 0
08-25 10:44:33.295: WARN/dalvikvm(17236): threadid=4: spin on suspend #1 threadid=13 (pcf=0)
08-25 10:44:33.760: INFO/ALSAModule(2573): Terminated ALSA PLAYBACK device hifi
08-25 10:44:34.180: ERROR/yamaha::media::Parameters(2573): SalesCode = INU
08-25 10:44:35.955: DEBUG/dalvikvm(3104): GC_EXPLICIT freed 18K, 55% free 2593K/5703K, external 0K/0K, paused 37ms
08-25 10:44:36.025: DEBUG/VoldCmdListener(2565): asec list
08-25 10:44:37.095: INFO/dumpstate(17848): done
08-25 10:44:37.150: INFO/DEBUG(16421): debuggerd committing suicide to free the zombie!
08-25 10:44:37.170: INFO/DEBUG(17899): debuggerd: May 18 2011 13:55:14
08-25 10:44:37.270: INFO/ActivityManager(2689): Process com.test.android (pid 17236) has died.
08-25 10:44:37.285: INFO/WindowManager(2689): WIN DEATH: Window{40943ee0 com.test.android/com.test.android.activities.SecondScreenActivity paused=false}
08-25 10:44:37.290: INFO/WindowManager(2689): WIN DEATH: Window{40936210 com.test.android/com.test.android.activities.HomeScreenActivity paused=false}
08-25 10:44:37.290: INFO/WindowManager(2689): WIN DEATH: Window{4096f840 com.test.android/com.test.android.activities.ThirdScreenActivity paused=false}
08-25 10:44:37.290: INFO/WindowManager(2689): WIN DEATH: Window{409dea98 Select Language paused=false}
08-25 10:44:37.310: INFO/ActivityManager(2689): Start proc com.test.android for activity com.test.android/.activities.SecondScreenActivity: pid=17900 uid=10114 gids={3003, 1015}
答案 0 :(得分:11)
堆栈跟踪开头的许多奇怪文本都是本机崩溃转储。由于其中一个本机库中未处理的运行时错误而发生崩溃。发生错误是因为访问了非映射地址0xdeadbaad
:
08-25 10:44:31.635:INFO / DEBUG(16421):信号11(SIGSEGV),代码1(SEGV_MAPERR),故障地址deadbaad
此错误后,应用程序进程终止并重新启动。创建SecondScreenActivity
,然后从上次保存的状态恢复其状态。
编辑:我认为您的代码中没有问题。似乎这是一个Android错误。 这是一个错误报告:http://code.google.com/p/android/issues/detail?id=14498。
本报告包含以下结论:
APK正在使用来自多个线程的位图,并在之后重复使用它 已经(或正在进行)回收。 Skia图形库 不完全是线程安全的,并引入了额外的 同步太贵了,所以这个不会修复的 平台。
因此,您需要注意
recycle()
。
答案 1 :(得分:0)
试用此代码。
首先在全球范围内声明所有变量/对象。
然后使用以下功能在SDCard中下载图像。
首先在ImageView中调用此图像,然后单击“下载按钮的事件”上的函数。
Bitmap bmpImage;
bmpImage = loadBitmapFromView(imgview1);
downloadImageinphone(bmpImage);
public static Bitmap loadBitmapFromView(ImageView v) {
Bitmap b = Bitmap.createBitmap(v.getWidth(), v.getHeight(),
Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(b);
// v.layout(0, 0, v.getWidth(), v.getHeight());
v.draw(c);
return b;
}
调用此函数后: -
Uri uri;
Bitmap b;
private void downloadImageinphone(Bitmap b) {
String filename = "tempImage";
ContentValues values = new ContentValues();
values.put(Images.Media.TITLE, filename);
values.put(Images.Media.DATE_ADDED, System.currentTimeMillis());
values.put(Images.Media.MIME_TYPE, "image/png");
uri = getContentResolver().insert(Images.Media.EXTERNAL_CONTENT_URI,
values);
try {
OutputStream outStream = getContentResolver().openOutputStream(uri);
// outStream = new FileOutputStream(file);
b.compress(Bitmap.CompressFormat.PNG, 100, outStream);
outStream.flush();
outStream.close();
Log.d("done", "done");
Toast.makeText(MainActivity.this,
"Photo is Successfully Downloaded",
Toast.LENGTH_LONG).show();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
b.recycle();
}