android - Cannot resolve method 'settext(java.lang.String)' -


something weird that's happening on here, on item.settext(name);i' getting cannot resolve method 'settext(java.lang.string)'.

i' creating app list view dynamically generated database results.

layout

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"               android:layout_width="match_parent"               android:layout_height="match_parent"               android:orientation="horizontal" >     <listview         android:id="@+id/lvitems"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="study cursors"         android:textappearance="?android:attr/textappearancelarge" /> </linearlayout> 

method

public void bindview(view view, context context, cursor cursor) {     listview item = (listview) view.findviewbyid(r.id.lvitems);     string name = cursor.getstring(cursor.getcolumnindexorthrow("name"));     item.settext(name); }  public view oncreateview(final layoutinflater inflater, @nullable final viewgroup container, @nullable bundle savedinstancestate) {         view view =  inflater.inflate(r.layout.dashboard_completed, container, false);         mydb = null;         try {             file dir = new file(environment.getexternalstoragedirectory().getabsolutepath());             file file = new file(dir, "database.db");             mydb = sqlitedatabase.opendatabase(file.tostring(), null, sqlitedatabase.no_localized_collators|sqlitedatabase.open_readonly);              string q = "select * companies order name asc";             cursor mcursor = mydb.rawquery(q, null);              // find listview populate             listview lvitems = (listview) view.findviewbyid(r.id.lvitems);              // setup cursor adapter using cursor last step             dashboardcursoradaptor todoadapter = new dashboardcursoradaptor(getactivity().getapplicationcontext(), mcursor);              // attach cursor adapter listview             lvitems.setadapter(todoadapter);              mydb.close();         } catch (sqlexception e) {             e.printstacktrace();         }         return view;     } 

i can't see full code. don't know have defined listview. alot of developers makes mistakes in step. remember listview , textview have different layout.

if have give solution, recommend go , check if have listview , layout item_whatever define textview.

on bindview method reference textview.


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -