I'm making my own adapter to put in a listview, it visually shows everything right. Each line of the list view, consists of an image, a text and 2 spinners ....
When it is shown, it has apparently been great, and each elemet has been assigned a different photo ....
where is the problem? because when I start filling in the text of element 1, I automatically fill in the 6, if I fill in 2, the 7 tb is autocompleta .... I do not understand what happens, could you help me ??
package com.example.oftecnica2.pruebaaudiobus;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import java.util.List;
/**
* Created by OFTECNICA2 on 12/04/2016.
*/
public class Adaptador extends ArrayAdapter{
public Adaptador(Context context, String[] objects) {
super(context,0,objects);
}
public View getView(int position, View convertView, ViewGroup parent){
LayoutInflater inflater=(LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View listItemView=convertView;
if (null==convertView){
listItemView=inflater.inflate(R.layout.layoutcartel,parent,false);
}
ImageView img=(ImageView)listItemView.findViewById(R.id.img);
switch (position) {
case 0:
img.setImageResource(R.mipmap.uno);
break;
case 1:
img.setImageResource(R.mipmap.dos);
break;
case 2:
img.setImageResource(R.mipmap.tres);
break;
case 3:
img.setImageResource(R.mipmap.cuatro);
break;
case 4:
img.setImageResource(R.mipmap.cinco);
break;
case 5:
img.setImageResource(R.mipmap.seis);
break;
case 6:
img.setImageResource(R.mipmap.siete);
break;
case 7:
img.setImageResource(R.mipmap.ocho);
break;
}
return listItemView;
}
}
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="58dp"
android:layout_height="58dp"
android:id="@+id/img" />
<EditText
android:layout_width="509dp"
android:layout_height="61dp"
android:inputType="textMultiLine"
android:ems="10"
android:id="@+id/txt" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="66dp"
android:weightSum="1">
<LinearLayout
android:orientation="vertical"
android:layout_width="121dp"
android:layout_height="match_parent"
android:layout_weight="0.55">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="MODE"
android:id="@+id/textView" />
<Spinner
android:layout_width="124dp"
android:layout_height="wrap_content"
android:id="@+id/spinner"
android:entries="@array/mode"/>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="119dp"
android:layout_height="match_parent"
android:layout_weight="0.36">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SPEED"
android:id="@+id/textView3" />
<Spinner
android:layout_width="118dp"
android:layout_height="wrap_content"
android:id="@+id/spinner2"
android:entries="@array/speed"/>
</LinearLayout>
</LinearLayout>