TextViews inside a loop
I want to display String Array values inside a for loop. I need to display the each value to each TextView. How can I create TextView d开发者_如何学JAVAynamically corresponding to the size of Array? How can I specify ID for each one ? Please give me the solution... Thank You..
As written in the comments, you should use a ListView : It's dedicated to such a purpose.
It's definitely a bad idea because instantiating TextViews in a loop is not an optimized behavior. If you have many items in your array, it will take a lot of CPU resources and it will fill up the memory.
Take a look to the ListView object : it's easier to implement and optimized for the system. Check this for more info : http://developer.android.com/guide/tutorials/views/hello-listview.html
精彩评论