title: how to get image type from imageview (android)
body: <p>i am working on an wallpaper app in which i am receiving images from <code>internet</code> in <code>GridView</code> and <code>Full Screen ImageView</code>.</p>
  
  <p>i want to save <code>ImageView</code> loaded image using its real <code>image type</code>, but i don't know how to get <code>image type from ImageView</code>.</p>
  
  <p>example: if loaded image is <code>JPEG</code> or <code>PNG</code> then how do i get image type.</p>
  
  <p>this is my code that i am using to save image as JPEG:</p>
  
  <pre><code>int intHeight = fullImageView.getHeight();
              int intWidth = fullImageView.getWidth();
  
              String dirname2 = "/Wallpapers HD/";
  
              File myDir2 = new File(Environment.getExternalStorageDirectory()
                      .getPath() + dirname2);
  
              myDir2.mkdirs();
  
              String fname2 = "image" + intHeight + intWidth + ".jpeg";
              File file2 = new File(myDir2, fname2);
  
              if (file2.exists())
                  file2.delete();
              try {
                  FileOutputStream out = new FileOutputStream(file2);
                  bitmap.compress(Bitmap.CompressFormat.JPEG, 100, out);
                  out.flush();
                  out.close();
  
              } catch (Exception e) {
                  Toast.makeText(_context, "failed", Toast.LENGTH_SHORT).show();
              }
  </code></pre>