views:

97

answers:

1

I would like to create a gridview of images, in which, these images will be downloaded based on a web service response.

The thumbnails of images will be displayed in a gridview, similar to how iPhone displays photos.

User can tap on the image and the corresponding full-res image will be shown, sized to fit within the android phone. Upon tapping on the full-res image, it will minimize and return to the gridview.

So far, following the guide here, I had manage to create the gridview of images, but I would like to have it expand to the original size upon tapping and tapping again, return to the gridview.

A: 

Hai Ted, I hope this may help u... The SanAdapter for parsing

    public class SanAdapter extends BaseAdapter
    {

            ParsingHandler dom = new ParsingHandler(url);

            List<Message_thbnail2> l_obj_tnail = new ArrayList<Message_thbnail2>();
            l_obj_tnail = dom.parse_tnail2();
            //l_obj_zoom = dom.parse_zoom();

            VAL1 = new String[l_obj_tnail.size()];
            Iterator<Message_thbnail2> it = l_obj_tnail.iterator();

            Log.v("l_obj_tnail in ga",Integer.toString(l_obj_tnail.size()));
            while(it.hasNext())
            {
                img.setThumbimage(it.next().toString());
            }
            img.print_thumbimage();
            bufferarray=img.ary_thumpimage();
            for(int s=0;s<img.thumbcount();s++)
            {
              Log.v("buffervalue from GA"+s,bufferarray[s]);    
            }

        }


    String url="fed ur url here";
     SanAdapter s_adp = new SanAdapter (this,url); //this is for thumbnail display
     zoombufferarray=new ZoomGridAdapter().getZoomGridAdapter(this, url);// this is for zooming of ur image

public class ParsingHandler extends BaseFeedParser {
    private static final String TAG = "ParsingHandler";
    String name1;
    DocumentBuilderFactory DBF;
    DocumentBuilder DB;
    Document dom;
    Element elt;
    String thumbnail;
    String query,query1;

    ParsingHandler(String feedurl) {
        super(feedurl);
        try {
            Log.v("Parsing_Handler",feedurl);
            DBF = DocumentBuilderFactory.newInstance();
            DB = DBF.newDocumentBuilder();      
            dom = DB.parse(this.getInputStream());      
            elt = dom.getDocumentElement();
        } catch (Exception e) {
            name1 = "Exception in Parsing cons";
            Log.v(TAG, name1 + e);
        }
    }

    public List<Message_title> parse_title() {

        List<Message_title> messages = new ArrayList<Message_title>();
        try {
             Log.v(TAG,"Parse_Title");
            NodeList items = elt.getElementsByTagName(ITEM);
            for (int i = 0; i < items.getLength(); i++) {
                Message_title message = new Message_title();
                Node item = items.item(i);
                NodeList properties = item.getChildNodes();
                for (int j = 0; j < properties.getLength(); j++) {
                    Node property = properties.item(j);
                    String name = property.getNodeName();
                    if (name.equalsIgnoreCase(TITLE)) {
                        message.setTitle(property.getFirstChild()
                                .getNodeValue());
                        Log.v("TITLE", property.getFirstChild().getNodeValue());
                    }
                }
                messages.add(message);
            }
        } catch (Exception e) {
            name1 = "Exception in Parsing title";
            Log.v(TAG, name1 + e);
        }
        return messages;
    }
Tilsan The Fighter
Hi Sankar Ganesh, I tried the code you gave, is there such a class = ParsingHandler?
Ted
@Ted: U have to create the ParsingHandler class inorder to parse the xml tags u needed from the url, the ParsingHandler code is
Tilsan The Fighter
Hi @Ted: Any Progress, did u achieved ur goal
Tilsan The Fighter