I have an adapter in my App, and I would like to take photos of my server to put on it instead of a saved photo in the root, I already tried several forms, already tried using the Picasso API but the most I could get was 1 photo for free.
Adapter:
public CursoAdapter(Context context,ArrayList<curso> elementos) {
super(context,R.layout.linha, elementos);
this.context=context;
this.elementos= elementos;
}
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
Context contexts = parent.getContext();
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View rowView = inflater.inflate(R.layout.linha, parent, false);
TextView nomeCurso = (TextView) rowView.findViewById(R.id.nome);
TextView progresso = (TextView) rowView.findViewById(R.id.endereco);
ImageView imagem = (ImageView) rowView.findViewById(R.id.imagem);
nomeCurso.setText(elementos.get(position).getNome());
progresso.setText(elementos.get(position).getEndereco());
imagem.setImageResource(elementos.get(position).getImagem());
return rowView;
}
My XML:
<ImageView
android:id="@+id/imagem"
android:layout_width="64dp"
android:layout_height="69dp"
android:layout_margin="5dp"
android:scaleType="fitXY"
android:src="@drawable/e1" />
<LinearLayout
android:layout_width="304dp"
android:layout_height="73dp"
android:layout_gravity="right"
android:orientation="vertical">
<TextView
android:id="@+id/nome"
android:layout_width="227dp"
android:layout_height="38dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:text="Nomedascola"
android:textAppearance="@style/Base.TextAppearance.AppCompat.SearchResult.Title"
android:textSize="15dp" />
<TextView
android:id="@+id/endereco"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="Endereço"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Small" />
</LinearLayout>
Adding items:
curso e = new curso(array2[0],"Progresso: 0%", drawable.e1);
escolas.add(e);
return escolas;