how to dynamically create buttons?

by mnavlani » Fri, 02 Apr 2010 14:13:33 GMT


Sponsored Links
 hello all,
i wanted to create buttons at runtime. The no. of buttons to be
displayed depends upon the input of user. But creating a button
requires some code to be written in the .xml file. so how can i
dynamically generate the code for n no. of buttons at runtime?

regards!

--



how to dynamically create buttons?

by paresh mayani » Fri, 02 Apr 2010 15:06:20 GMT


 i think this will help you........
        Button b = new Button(this);
                        b.setText("Dynamic Button");
                        b.setLayoutParams(new 
LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.WRAP_CONTENT));




--


Sponsored Links


how to dynamically create buttons?

by mnavlani » Fri, 02 Apr 2010 15:28:36 GMT


 thanks paresh!
i think this might help..
hey,
actually,the server would return an image at runtime. Now i want to
use this image for the dynamically created imagebutton...how can this
be done??

regards!

--



how to dynamically create buttons?

by ~ TreKing » Fri, 02 Apr 2010 21:04:01 GMT


 



If you take 2 seconds to read the documentation on ImageButton you will find
that it's quite simple to set which image it uses.

-------------------------------------------------------------------------------------------------
TreKing - Chicago transit tracking app for Android-powered devices
 http://sites.google.com/site/rezmobileapps/treking 

--



Other Threads

1. Android : Issues with medialets ads

Hi Guys,

I wanna use medialets ad in my android app. I have faced some issues
which are listed below,

   1. Got an sample with downloaded sdk, banner ads are not working in
the sample itself, can anyone got this issue, whats wrong with the
banner ads?

   2. And Interstitial ads are working fine with the normal activity
which extends AdActivity. If I load the following lines in oncreate
then its getting crashed.

      InterstitialAdView view = new InterstitialAdView(AdDemo.this);
      view.setSlotName("ViewTwoFull");
      view.prepare();

      If I give that inside onclick() then its working fine.

   3. Actually I want to load the interstitial ads when an item
clicked in the list, my list activity is there with in the tab
activity, in this case interstitial ad also not coming.

Can anyone worked with medialets, how to solve these issues.

Thanks in advance.

-- 

2. Soner x8 setelah update ke 2.1

dear para suhu,

perkenalkan, saya pengguna pemula buat robot hijau
mohon pengarahan dari para suhu,
saya pakai soner x8, 2 minggu lalu saya update ke 2.1 sendiri & berhasil.
kenapa sekarang sering mati sendiri ya hh saya??
batre lebih boros, padahal pernah aku baca kalau sudah diupdate batre lebih
awet. apa ada aplikasi yg mendukung??saya pernah pakai jusdevender tetep
boros&data sering tidak nyambung koneksinya.
aplikasi apa buat ym biar bisa on terus?, pernah pakai aplikasi ym dari
google market tp nga bisa online.
sekarang pake aplikasi imo tp tetep tidak bisa online

thank's before buat masukan dari para suhu

 heru

-- 
===============
"

3. java/locationlistener

4. Installation Error "Unknown Reason -18"

5. Lowongan Kerja Android Developer

6. Facebook Places

7. Numpang Tanya