aspose file tools*
The moose likes Android and the fly likes How to set data in a Gridview dyanamically Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "How to set data in a Gridview dyanamically" Watch "How to set data in a Gridview dyanamically" New topic
Author

How to set data in a Gridview dyanamically

NeelNisha Singh
Greenhorn

Joined: Sep 05, 2013
Posts: 22
I have created a gridview and added adapter to show view dyanamically

Here is my code

1.GroupIDUDesAct .java


2.group_idu_des.xml


3.row_deactive.xml


So right now I'm getting output as attached screenshot output_1.png

But I'want to show each generated layout i.e row_active/row_deactive as attachment gridview.png ,Please suggest what i need to do or provide any small demo code
(want to keep all elements of row.xml in gridview and show them in a way like first row will be having only one column which will contain only one image,again second row will be having 2 columns containg
2 textviews as per attached screen gridview.png).Please help



[gridview.PNG]

NeelNisha Singh
Greenhorn

Joined: Sep 05, 2013
Posts: 22
rightnow what output screen i'm getting is Output_1.png is attached here


[Thumbnail for output_1.PNG]

Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

So what part are you having trouble with? The layout or the gridview or what?

Your row_deactive.xml is not that great. When using GridView (and probably ListView as well) you should try to avoid nesting layouts. You have a RelativeLayout with a LinearLayout inside. You do not need, and should not use the LinearLayout at all. You should just use the RelativeLayout. For reference see: http://developer.android.com/guide/topics/ui/layout/relative.html


Steve
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to set data in a Gridview dyanamically