Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hiii.....
I developed an android app which saves image from webview and and save it in internal storage of the device. I can save it successfully but am unable to view it in gallery.

Here is the code
Java
btn_snapshot.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) 
			{
				//TakeScreenshot();		
				 Picture picture = webview.capturePicture();
                 Bitmap  b = Bitmap.createBitmap( picture.getWidth(),
                 picture.getHeight(), Bitmap.Config.ARGB_8888);
                 Canvas c = new Canvas( b );

                 picture.draw( c );
                // FileOutputStream fos = null;
                 try {
                	 File wallpaperDirectory = new File("/sdcard/HAS Snaps/");
                	 wallpaperDirectory.mkdirs();
                	 currentDateTimeString=java.text.DateFormat.getDateTimeInstance().format(Calendar.getInstance().getTime());
                	File outputFile = new File(wallpaperDirectory, currentDateTimeString+".jpg");
                	FileOutputStream fos = new FileOutputStream(outputFile);
                	    if ( fos != null )
                         {
                             b.compress(Bitmap.CompressFormat.JPEG, 100, fos);
                             fos.close();
                            // sav_image();
                             Show_Custom_Toast("Image saved", R.drawable.success);
                           sendBroadcast(new Intent(Intent.ACTION_MEDIA_SHARED, Uri.parse("content://"+Environment.getStorageState(outputFile))));
                         }
                         else
                         {
                        	 Show_Custom_Toast("Error in saving image", R.drawable.invalid);
                         }
                     }
                catch( Exception e )
                {

                }
			}
		});


But still am unable to view it in gallery.........Pls help...
Posted
Updated 14-Jan-15 1:16am
v3
Comments
TorstenH. 14-Jan-15 7:17am    
But still am unable to view it in gallery

What do you mean by that? please be more specific.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900