Hello everyone,

  Am trying to retrieve and display an image which was selected in a grid 
view, I added a small image (checkmark) to indicate the selected image in 
onClickListener(). Am saving the position of image in a database table. Am 
retrieving the position of image back from database, but when i apply the 
same selection logic (not in onClickListener) the checkmark is not being 
displayed on the selected image. Am not clicking on GridView bt i want the 
image  to be selected as it was before.
Here is my code in onClick listener which is working fine:

imageGridView.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View v, int 
position, long id) {
         if(current!=-1){
         
          last = parent.getChildAt(current);
         last.findViewById(R.id.image_check).setVisibility(View.GONE);
         last.setBackgroundColor(Color.WHITE);
         
         selected_Image=position;
         
         }
         
         v.findViewById(R.id.image_check).setVisibility(View.VISIBLE);
         current=position;
         v.setBackgroundColor(Color.YELLOW);
               } 
    });

To retrieve and display selected image from database position value : 

 *int* selected_item=Integer.*parseInt*(contactResponse.responseValue);

                                   

                                    View l= adapter.getView(selected_item, *
null*,imageGridView );

                             

                                    l.findViewById(R.id.*image_check*)

                                    .setVisibility(View.*VISIBLE*);

                              l.setBackgroundColor(Color.*YELLOW*);

                   }

But gridview is displayed without any selection.


 I searched many things but nothing helped me, can anyone suggest me to 
come out of this issue. Thanks in advance.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to