As prachi said, create the TextView in the program itself. -set the id for each TextView using setId(). -in onclick(View v), using getId(), get the id and update the textView
Nithin On Jun 14, 2:28 pm, prachi <[email protected]> wrote: > Hey hiii im not sure whether this will work but still give it a try i > think instaed of adding the textviews through xml layout u add them in > ur program using an array of textviews and then update them on each > button click with the help of loop and setting each textview element > value. > > On Jun 9, 6:14 pm, Jeremy <[email protected]> wrote: > > > Hi, > > I'm new to this Android stuff (and to Java). > > > I have created a table with 2 rows in it. Each row has 5 TextViews > > with a default text of 0. > > There is also a button outside of the table. > > > I am trying to figure out how to update each of the TextViews in each > > row on each successive press of the button. > > So on the first press of the button the first TextView in the first > > row should update to 1. > > On the second press of the button the second TextView in the first row > > should update to 2...etc. > > > I can't figure out how to do this programmatically without having to > > code it all - is it possible? > > Basically I guess I need to build up the ID of the TextView > > dynamically. > > So if the TextViews have ids as item1, item2, item3 etc. > > Then I need to build up the findViewById(R.id.item + i); > > Obviously this is not possible but is there a way to do this? > > > Thanks, > > > Jeremy > > -- 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

