you can do setid(any no) this will be your id it is used to dynamically assign id to a view or a viewgroup
On Dec 11, 3:44 pm, Duygu Kahraman <[email protected]> wrote: > Selam Ali; > > Asıl sormak istediğim şu;mesela TextView tv=new TextView(this); diye bir > view yarattım.Eğer xmlde yaratmış olsaydım id sini de orada set edip > çağırabilecektim kodun içinden.Yada R dosyasında bir referans oluşturmuş > olacaktı.Ama program içinde yarattığımda R içinde tvye ait birşey > yok.Sadece setId() diye birşey var ama setId() bana ben extra bir referans > vermek istediğimde gerekli gibi geliyor. > > Yani şöyle birtane scrollview yaptım içinde birsürü item ekledim.Bunlardan > 3.sü yada 5.sini aldığımda birşey yapmak istiyorsam evet bunlara sıralı bir > id vermeliyim ki kaçıncısını aldığımı anlayayım.İşte burada sıralı id > vermek için setId() yi kullanırım. > > Yanlış mı düşünüyorum anlamıyorum.Sanki tv default bir id ataması > gerekiyormuş gibi düşünüyorum.Yada veriyor ben ulaşmasını beceremedim. > Çok basit biliyorum ama kafama takıldı. > > 11 Aralık 2011 12:10 tarihinde Ali Chousein <[email protected]> yazdı: > > > > > > > > > > > Yazdığın kodun içinden view objelerini yaratınca, findViewById() > > fonksiyonunu çağırmana gerek yok. Yarattığın objelere referanslar > > elinde var zaten. Referansları saklayıp sonra kullanabilirsin. View > > objelerini XML'den tanımlasaydın, findViewById() sana aynı > > referansları döndürecekti. > > > ------------------------------------------------- > > Ali Chousein > > Weather-Buddy > >http://weatherbuddy.blogspot.com|http://twitter.com/weather_buddy > > Geo-Filtered Assistant > >http://geo-filtered-assistant.blogspot.com > >https://marketplace.cisco.com/apphq/products/994 > > > -- > > 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 > > -- > --- > Duygu Kahraman > > http://tr.linkedin.com/in/duygukahramann -- 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

