aspose file tools*
The moose likes Android and the fly likes How can i put dynamically a Imagebutton Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "How can i put dynamically a Imagebutton " Watch "How can i put dynamically a Imagebutton " New topic
Author

How can i put dynamically a Imagebutton

Sarra Sakka
Ranch Hand

Joined: Jul 12, 2013
Posts: 274
I have a list of category(every category is a buttonilage) in my application, evrey category have a many product
i would like to get this product of one of this category when i press this category in the same interface
here's my code

the probleme here when i press one button it display here product and when i press another button, it display the previous product and the new product !!
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

LinearLayout is a ViewGroup. Does the ViewGroup API have any methods which might help you with this? The Android API Reference can be found here: http://developer.android.com/reference/packages.html

Also, why are you using the nested LinearLayouts? I thought we discussed working with GridView and Adapters?


Steve
Sarra Sakka
Ranch Hand

Joined: Jul 12, 2013
Posts: 274
I want to change it to the Gird View, it becomes easier right?
I am a beginner in android and this method it seems to be a little difficult at
coding
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42648
    
  65
Maybe you should start with something a bit less involved, then, until you have a firmer grasp of the basics?


Ping & DNS - my free Android networking tools app
Sarra Sakka
Ranch Hand

Joined: Jul 12, 2013
Posts: 274
No, i want to do this
thank you for your advise
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

Sarra Sakka wrote:I want to change it to the Gird View, it becomes easier right?
I am a beginner in android and this method it seems to be a little difficult at
coding

Easier is a bit subjective. Using GridView makes the layout easier, because it handles that for you. It makes efficient display easier because it handles recycling views and what not. It generally makes data handling easier, because the data is separate from the display (using the Adapter as the go between). But it adds some layers of complexity - like using the Adapter, which you have to write yourself, and some interaction (example, you can't use Buttons in the GridView, they won't work without a bit of effort. But you can use ImageViews and let the GridView handle clicks.)

In the previous thread where I showed you how ListView and GridView worked, I also gave you some links to the API Guides on how to use them. I suggest you read that so you get a better understanding of how they work and choose if you want to go that route.
Sarra Sakka
Ranch Hand

Joined: Jul 12, 2013
Posts: 274
Ok, thanks
I'll see it
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can i put dynamically a Imagebutton