android - The same layout mutliple times in one layout not working properly -


so have little problem app. adding same layout 11 times main layout , here adding text them. problem is, no text shows @ all. sorry not perfect english. :d

jsonparser parser = new jsonparser(); hashmap<string, string> params = new hashmap<>(); params.put("username", username); params.put("pass", password); jsonobject json = parser.makehttprequest(link php file, params);  arraylist<string> stundenlist = new arraylist<>();  int success = json.getint("success");  if (success == 1) {     jsonarray stunden = json.getjsonarray("stundenplan");      (int = 0; < stunden.length(); i++) {         jsonobject c = stunden.getjsonobject(i);          string montag = c.getstring("montag");         string dienstag = c.getstring("dienstag");         string mittwoch = c.getstring("mittwoch");         string donnerstag = c.getstring("donnerstag");         string freitag = c.getstring("freitag");          stundenlist.add(montag);         stundenlist.add(dienstag);         stundenlist.add(mittwoch);         stundenlist.add(donnerstag);         stundenlist.add(freitag);     }     for(int = 0; < getrows().size(); i++) {         linearlayout ll = (linearlayout) karo.main.findviewbyid(getrows().get(i));         textview column1 = (textview) ll.findviewbyid(r.id.column1);         textview column2 = (textview) ll.findviewbyid(r.id.column1);         textview column3 = (textview) ll.findviewbyid(r.id.column1);         textview column4 = (textview) ll.findviewbyid(r.id.column1);         textview column5 = (textview) ll.findviewbyid(r.id.column1);         textview column6 = (textview) ll.findviewbyid(r.id.column1);         textview column7 = (textview) ll.findviewbyid(r.id.column1);         textview column8 = (textview) ll.findviewbyid(r.id.column1);         textview column9 = (textview) ll.findviewbyid(r.id.column1);         textview column10 = (textview) ll.findviewbyid(r.id.column1);         textview column11 = (textview) ll.findviewbyid(r.id.column1);          column1.settext(stundenlist.get(i).split(";")[0]);         column2.settext(stundenlist.get(i).split(";")[1]);         column3.settext(stundenlist.get(i).split(";")[2]);         column4.settext(stundenlist.get(i).split(";")[3]);         column5.settext(stundenlist.get(i).split(";")[4]);         column6.settext(stundenlist.get(i).split(";")[5]);         column7.settext(stundenlist.get(i).split(";")[6]);         column8.settext(stundenlist.get(i).split(";")[7]);         column9.settext(stundenlist.get(i).split(";")[8]);         column10.settext(stundenlist.get(i).split(";")[9]);         column11.settext(stundenlist.get(i).split(";")[10]);     } } 

getrows function:

private static list<integer> getrows() {     list<integer> rows = new arraylist<>();     rows.add(r.id.stundenplan_montag);     rows.add(r.id.stundenplan_dienstag);     rows.add(r.id.stundenplan_mittwoch);     rows.add(r.id.stundenplan_donnerstag);     rows.add(r.id.stundenplan_freitag);     return rows; } 

main layout:

<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/verplan" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingbottom="5dp" android:paddingleft="5dp" android:paddingright="5dp" android:paddingtop="5dp" app:layout_behavior="@string/appbar_scrolling_view_behavior" tools:context=".karo" tools:showin="@layout/app_bar_main">  <viewflipper     android:id="@+id/viewflipp"     android:layout_width="fill_parent"     android:layout_height="fill_parent">      <relativelayout         android:id="@+id/view1"         android:layout_width="match_parent"         android:layout_height="match_parent">          <textview             android:id="@+id/textview2"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:text="home text" />      </relativelayout>      <linearlayout         android:id="@+id/view2"         android:orientation="horizontal"         android:layout_width="match_parent"         android:layout_height="match_parent">          <include android:id="@+id/stundenplan_montag" layout="@layout/plantextviews"/>         <include android:id="@+id/stundenplan_dienstag" layout="@layout/plantextviews" android:layout_width="40dp" android:layout_height="wrap_content" />         <include android:id="@+id/stundenplan_mittwoch" layout="@layout/plantextviews" android:layout_width="40dp" android:layout_height="wrap_content" />         <include android:id="@+id/stundenplan_donnerstag" layout="@layout/plantextviews" android:layout_width="40dp" android:layout_height="wrap_content"/>         <include android:id="@+id/stundenplan_freitag" layout="@layout/plantextviews" android:layout_width="40dp" android:layout_height="wrap_content" />      </linearlayout>  </viewflipper> 

plantextviews layout:

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent">  <textview     android:layout_width="match_parent"     android:layout_height="match_parent"     android:textappearance="?android:attr/textappearancesmall"     android:id="@+id/column1" /> <textview     android:layout_width="match_parent"     android:layout_height="match_parent"     android:textappearance="?android:attr/textappearancesmall"     android:id="@+id/column2" /> <textview     android:layout_width="match_parent"     android:layout_height="match_parent"     android:textappearance="?android:attr/textappearancesmall"     android:id="@+id/column3" /> <textview     android:layout_width="match_parent"     android:layout_height="match_parent"     android:textappearance="?android:attr/textappearancesmall"     android:id="@+id/column4" /> <textview     android:layout_width="match_parent"     android:layout_height="match_parent"     android:textappearance="?android:attr/textappearancesmall"     android:id="@+id/column5" /> <textview     android:layout_width="match_parent"     android:layout_height="match_parent"     android:textappearance="?android:attr/textappearancesmall"     android:id="@+id/column6" /> <textview     android:layout_width="match_parent"     android:layout_height="match_parent"     android:textappearance="?android:attr/textappearancesmall"     android:id="@+id/column7" /> <textview     android:layout_width="match_parent"     android:layout_height="match_parent"     android:textappearance="?android:attr/textappearancesmall"     android:id="@+id/column8" /> <textview     android:layout_width="match_parent"     android:layout_height="match_parent"     android:textappearance="?android:attr/textappearancesmall"     android:id="@+id/column9" /> <textview     android:layout_width="match_parent"     android:layout_height="match_parent"     android:textappearance="?android:attr/textappearancesmall"     android:id="@+id/column10" /> <textview     android:layout_width="match_parent"     android:layout_height="match_parent"     android:textappearance="?android:attr/textappearancesmall"     android:id="@+id/column11" /> 

the problem finding view id = r.id.column1 11 times, should find views ids r.id.column1, r.id.column2, r.id.column3 , on:

... for(int = 0; < getrows().size(); i++) {     linearlayout ll = (linearlayout) karo.main.findviewbyid(getrows().get(i));     textview column1 = (textview) ll.findviewbyid(r.id.column1);     textview column2 = (textview) ll.findviewbyid(r.id.column2);     textview column3 = (textview) ll.findviewbyid(r.id.column3);     ...     ...      column1.settext(stundenlist.get(i).split(";")[0]);     column2.settext(stundenlist.get(i).split(";")[1]);     column3.settext(stundenlist.get(i).split(";")[2]);     ...     ... } 

Comments

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -