Android : How to dynamically create new threads

on Wednesday, July 30, 2014


I have a for loop which creates views dynamically.



for (int i=0;i<5;i++){
a=new ImageView();
tv=new TextView();
img=new ImageView();
spn=new Spinner();
img.setOnClickListener(this);//this is working for every view

spn.post(new Runnable){
@Override
public void run() {
Log.d("post","inside post");// here only last view is working
}


} //for loop ends


But how to create spinner.post dynamically or make it work. Please help. Stuck on it for last three days.Thanks in advance.


0 comments:

Post a Comment