java - ArrayList Adapter constructor fails (?) -


edit: need know how create arraylist filled textview

i trying create arrayadapter multidimensional (2d) arraylist:

        final arrayadapter<arrayadapter<arraylist<string>>> adapternames = new arrayadapter<arrayadapter<arraylist<string>>>(this,android.r.layout.simple_list_item_1, android.r.id.text1, arraynamesone); 

this log error get:

error:(28, 76) error: no suitable constructor found arrayadapter(mainactivity,int,int,arraylist>) constructor arrayadapter.arrayadapter(context,int,int,arrayadapter>[]) not applicable (argument mismatch; arraylist> cannot converted arrayadapter>[]) constructor arrayadapter.arrayadapter(context,int,int,list>>) not applicable (argument mismatch; arraylist> cannot converted list>>)

if prefer take better @ whole code interested, here go:

public class mainactivity extends actionbaractivity { //1st declaration arraylist<arraylist<string>> arraynamesone = new arraylist<arraylist<string>>(); listview listnamesone; textview namestextone;  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);       //1st setup     listnamesone = (listview) findviewbyid(r.id.listnamesid);     namestextone = (textview) findviewbyid(r.id.namestexter);      final arrayadapter<arrayadapter<arraylist<string>>> adapternames = new arrayadapter<arrayadapter<arraylist<string>>>(this,android.r.layout.simple_list_item_1, android.r.id.text1, arraynamesone);     listnamesone.setadapter(adapternames);     //end 1st setup      //1st button '+'     button buttonplus = (button)findviewbyid(r.id.buttonplus);     buttonplus.setonclicklistener(             new button.onclicklistener() {                 //click event                 @override                 public void onclick(view v) {                     //if empty                     if (namestextone.gettext().tostring().isempty()){                         context context = getapplicationcontext();                         charsequence text = "add item first";                         int duration = toast.length_short;                         toast.maketext(context, text, duration).show();                     //if spaces                     }else if(namestextone.gettext().tostring().trim().isempty()){                         context context = getapplicationcontext();                         charsequence text = "you can't use spaces only";                         int duration = toast.length_short;                         namestextone.settext("");                         toast.maketext(context, text, duration).show();                     //alright, add it!                     } else if(!namestextone.gettext().tostring().isempty()) {                         arraynamesone.add(0, (arraylist<string>) namestextone.gettext());                         adapternames.notifydatasetchanged();                         namestextone.settext("");                     }                  }             }     ); } 

if creating adapter list of strings this:

arraylist<string> array = new arraylist<string>(); arrayadapter<string> adapter = new arrayadapter<string>(this,android.r.layout.simple_list_item_1, android.r.id.text1, array); 

so adapter list of lists of strings like:

arraylist<arraylist<string>> array = new arraylist<arraylist<string>>(); arrayadapter<arraylist<string>> adapter = new arrayadapter<arraylist<string>>(this,android.r.layout.simple_list_item_1, android.r.id.text1, array); 

Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -