简体   繁体   中英

Full screen image from gridview

How to delete an image from an activity? I have called images from specific folder and opening it in full screen image and i want to delete the image from the full screen activity.

Use a noactionbar theme in activity tag in AndroidManifest and then it will make it a fullscreen activity and you can use a match_parent in both width and height tag in imageview and show your image in that.

ex:

delete.setOnClickListener(new View.OnClickListener() {

    @Override
    public void onClick(View v) {
     // TODO Auto-generated method stub
     // Path to your image

      String path = "android.os.Environment.getExternalStorageDirectory()+ "/myfolder/myimage.jpg";
      File file= new  File(path);
      if(file.exists()){

       file.delete();

      }
     finish();
    }
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM