android - Can't get view to set elements of LISTVIEW -


have problem 'listview'. searched everywhere problem not arise none. let me explain:

i have classic 'listview' in 'layout':

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:id="@+id/roza" android:tilemode="repeat">  <listview     android:id="@android:id/list"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:background="#80ffffff"     android:alpha="200"> </listview>  <textview     android:id="@android:id/empty"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:text="@string/no_todos" />   </linearlayout> 

and create custom list_row xml:

 <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content">       <textview     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:text="new text"     android:id="@+id/list_name"     android:layout_alignparenttop="true"     android:textsize="25dp"     android:layout_alignparentstart="true"     android:layout_alignend="@+id/list_rune" />     ------------bla bla bla -----------------    <textview     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:text="new text"      android:layout_aligntop="@+id/list_date_update"     android:layout_toleftof="@+id/list_rune"     android:layout_tostartof="@+id/list_rune"     android:id="@+id/texttester" />       </relativelayout> 

my main class -

  public class mainactivity extends listactivity implements         adapterview.onitemlongclicklistener,       sharedpreferences.onsharedpreferencechangelistener {        private nordbase dbhelper;    private cursor cursor;   int rage = list_row; // custom row    -------------------on create----------------  setcontentview(r.layout.activity_main);  this.getlistview().setdividerheight(2);         dbhelper = new nordbase(this);        filldata(); 

------------------filldata-----------------

   cursor = dbhelper.getall();        startmanagingcursor(cursor);          string[] = new string[] { nordbase.nord_name,    nordbase.nord_description,                                     nordbase.nord_punkts,    nordbase.nord_punkts_cross,             nordbase.nord_date_create, nordbase.nord_date_update, nordbase.nord_rune,             nordbase.nord_important, nordbase.nord_sum };        int[] = new int[] { r.id.list_name, r.id.list_description, r.id.list_punkts,             r.id.list_punkts_cross, r.id.list_date_create, r.id.list_date_update,             r.id.list_rune, r.id.list_important, r.id.list_sum, };      notes = new simplecursoradapter(this,             rage, cursor, from, to);       setlistadapter(notes);     getlistview().setonitemlongclicklistener(this); 

alas, can not items inside list_row, bind them comparison operators. exp: if price == 0, textview.setvisible = false...

i try layoutinflater, make view element difrent in listview. try adapter binder class - think no that. have error - can't "null element"... case - looks ever - program can't findviewbyid elements in list_row.

there 1 point of contact

     int[] = new int[] { r.id.list_name, r.id.list_description, r.id.list_punkts,                   r.id.list_punkts_cross, r.id.list_date_create, r.id.list_date_update,                 r.id.list_rune, r.id.list_important, r.id.list_sum, };            notes = new simplecursoradapter(this,                 rage, cursor, from, to); 

so me obi-van kenobi, , sorry dummy eng, , i'm not sure past cod in right way)))

first of layout not having views have mention in adapter like

r.id.list_description, r.id.list_punkts,                   r.id.list_punkts_cross, r.id.list_date_create, r.id.list_date_update,                 r.id.list_rune, r.id.list_important, r.id.list_sum 

put thing in layout list_row xml if mean ------------bla bla bla ----------------- views ok simplecursoradapter not solve purpose want hide , show views based on data in respective views first suggestion change layout linearlayout or tablelayout or other layout feel , in customadapter class

class myadapter extends baseadapter {    @override     public view getview(int position, view convertview, viewgroup parent) { //here infalteyour layout , and logical thing //you can take data out cursor , store in arraylist<yourmodelclass> type , have better control      } } 

otherwise in relative layout fill data don't hide may work if hiding of views chances high not solve problem

and typo mistake there hope like

int[] = new int[] { r.id.list_name, r.id.list_description, r.id.list_punkts,                   r.id.list_punkts_cross, r.id.list_date_create, r.id.list_date_update,                 r.id.list_rune, r.id.list_important, r.id.list_sum, }; 

//here no item still u have written "," after r.id.list_sum "r.id.list_sum, "

          notes = new simplecursoradapter(this,                 rage, cursor, from, to); 

Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

python - Pygame screen.blit not working -

c# - Web API response xml language -