开发者

How to show tick mark on selected picture?

In my app, I am using android gallery to select the picture and show in imageview. My problem is when I select any picture, I need to show tick mark image on that picture before setting it on imageview.

开发者_如何学运维

Following is my code :

 Intent intent = new Intent(Intent.ACTION_PICK);
 intent.setType("image/*"); 
 startActivityForResult(Intent.createChooser(intent,"Select Picture"), SELECT_PICTURE);                     

protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
    if (resultCode == Activity.RESULT_OK) 
    {
         switch(requestCode) 
         { 
            case SELECT_PICTURE:
                Uri selectedImageUri = data.getData();
                try {
                    filemanagerstring = selectedImageUri.getPath();
                    selectedImagePath = getPath(selectedImageUri);
                    Intent in = new Intent(this,DefaultSubmission.class);
                    if(selectedImagePath!=null && filemanagerstring!= null)
                    {
                        DefaultSubmission.flag = true;
                        in.putExtra("IMAGE_PATH", selectedImagePath);
                        in.putExtra("filemanagerstring", filemanagerstring);
                        startActivity(in);
                    }
                    finish();
                } catch (Exception e){
                    Toast.makeText(getApplicationContext(), "Internal error",Toast.LENGTH_LONG).show();
                    Log.e(e.getClass().getName(), e.getMessage(), e);}                  
                break;           
        }
    }
}

Please help me


Maybe I didn't understand your question properly, but if your problem is just in drawing a tick above your image, then you need to use FrameLayout instead of a simple ImageView. It should contain your image and a void ImageView above it. When you need to draw a tick - just set its image into that ImageView. Hope this will help you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜