Saamoz Saamoz - 10 months ago 85
Java Question

Android Studio Cannot Resolve Method in List Adapter

I created a custom List Adapter which extends from Base Adapter because I need to input two arrays into the list. The code is as follows:

public class OweListAdaptor extends BaseAdapter {
String[] descriptionArray, valueArray;
Context context;

public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = LayoutInflater.from(context);
View oweRow = inflater.inflate(R.layout.oweitem, parent, false);

TextView description = (TextView) oweRow.findViewById(;
TextView value = (TextView) oweRow.findViewById(;

return oweRow;

public OweListAdaptor(String[] description, String[] value) {
this.descriptionArray = description;
this.valueArray = value;

public void updateValues(String[] newList){
for (int i=0; i< newList.length; i++){
valueArray[i] = newList[i];

public void updateDescriptions(String[] newList){
for (int i=0; i< newList.length; i++){
descriptionArray[i] = newList[i];

The last two methods, updateValues and updateDescriptions, cannot be called from MainActivity. When I attempt to call them, Android Studio says it

cannot resolve method 'updateValues(java.lang.String[])'

To call it, I am simply using the following in MainActivity.

public class MainActivity extends AppCompatActivity {
String[] descriptionList, valueList;
OweDBManager DB;
ListAdapter oweAdapter;

public void updateLists(){
descriptionList = DB.DBtoArray("desc");
valueList = DB.DBtoArray("value");

The DB Manager and List Adapter are initialized in onStart. Why am I getting this error?


change in your MainActivity from ListAdapter oweAdapter to OweListAdaptor oweAdapter and it will work.