0

I have added image in internal memory using code

  Bitmap bitmap = BitmapFactory.decodeResource(getResources(),R.drawable.blue_500);
        FileOutputStream fileOutputStream = openFileOutput("file.jpg",MODE_PRIVATE);
        bitmap.compress(Bitmap.CompressFormat.JPEG,80,fileOutputStream);
        fileOutputStream.close();

But Image not showing in gallery

Sunil Patel
  • 265
  • 3
  • 13

1 Answers1

0

This is code work for me

 File file = Environment.getDataDirectory();
        Uri uri = Uri.fromFile(file);
        Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, uri);
        sendBroadcast(intent);
Sunil Patel
  • 265
  • 3
  • 13