android - Using LayoutInflater to create dynamic view -


i have created xml file wish repeat number of times , populate within main view. have read layoutinflater way go having issues getting work

first question. xml item created has number of textview within it. can done or can xml contain 1 textview?

scrollview mainlayout = (scrollview) findviewbyid(r.id.scrollview1);     layoutinflater  inflater = (layoutinflater)getsystemservice(context.layout_inflater_service);             view view = (view) inflater.inflate(r.layout.sightmarks_item, null);             textview textview1 = (textview) inflater.inflate(r.id.textview1, null);             edittext editview1 = (edittext) inflater.inflate(r.id.editview1, null);             edittext editview2= (edittext) inflater.inflate(r.id.editview2, null); 

i running round loop on array , setting text each values above , adding view mainlayout view

currently erroring on inflated view. doing correctly?

thanks

there problem in code. element of view use findviewbyid method

scrollview mainlayout = (scrollview) findviewbyid(r.id.scrollview1);     layoutinflater  inflater = (layoutinflater)getsystemservice(context.layout_inflater_service); view view = (view) inflater.inflate(r.layout.main, null); textview textview1 = (textview) view.findviewbyid(r.id.textview1); edittext editview1 = (edittext) view.findviewbyid(r.id.editview1); edittext editview2= (edittext) view.findviewbyid(r.id.editview2); 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -