Getting index of value in ArrayList

myHolder.mName.Text = mEmails[position].Name;

I have been trying to change this xamarin code into Java and when i make it into

 myHolder.mName.getText(mEmails.get(position).getName());

I end up getting red line under the text and this gives me alot of time wasted trying to make it work and am still not yet good in java

Upvotes: 0

Views: 61

Answers (1)

Ari Singh
Ari Singh

Reputation: 1306

The code you are trying to change "sets" the text and you are doing "get".

Try:

myHolder.mName.setText(mEmails.get(position).getName());

or if mName is a property (change others to "get" also if they are a property instead of a variable)

myHolder.getMName.setText(mEmails.get(position).getName());

and if mEmails is a java array:

myHolder.mName.setText(mEmails[position].getName());

Upvotes: 1

Related Questions