mi codigo es este
package com.socialmorelia.socialmorelia;
import android.app.ProgressDialog;
import android.content.Context;
import android.graphics.Rect;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.TextView;
import com.github.snowdream.android.widget.SmartImageView;
import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.AsyncHttpResponseHandler;
import org.json.JSONArray;
import org.json.JSONException;
import java.util.ArrayList;
import cz.msebera.android.httpclient.Header;
public class listauser extends ActionBarActivity {
private ListView listview;
ArrayList titulo = new ArrayList();
ArrayList descripcion = new ArrayList();
ArrayList imagen = new ArrayList();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_listauser);
listview = (ListView) findViewById(R.id.listView2);
descargarImagen();
}
private void descargarImagen() {
titulo.clear();
descripcion.clear();
imagen.clear();
final ProgressDialog progressDialog = new ProgressDialog(listauser.this);
progressDialog.setMessage("Cargando Datos...");
progressDialog.show();
AsyncHttpClient client = new AsyncHttpClient();
client.get("http://www.socialmorelia.com/leer3_android.php", new AsyncHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
if (statusCode==200){
progressDialog.dismiss();
try {
JSONArray jsonArray = new JSONArray(new String(responseBody) );
for (int i=0; i<jsonArray.length();i++){
titulo.add(jsonArray.getJSONObject(i).getString("strnombre"));
descripcion.add(jsonArray.getJSONObject(i).getString("idedocivil"));
imagen.add(jsonArray.getJSONObject(i).getString("strfoto"));
}
listview.setAdapter(new ImagenAdapter(getApplicationContext()));
} catch (JSONException e) {
e.printStackTrace();
}
}
}
@Override
public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
}
});
}
private class ImagenAdapter extends BaseAdapter{
Context ctx;
LayoutInflater layoutInflater;
SmartImageView smartImagenView;
TextView tvtitulo, tvdescripcion;
public ImagenAdapter (Context applicationContext) {
this.ctx=applicationContext;
layoutInflater = (LayoutInflater)ctx.getSystemService(LAYOUT_INFLATER_SERVICE);
}
@Override
public int getCount() {
return imagen.size();
}
@Override
public Object getItem(int position) {
return position;
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewGroup viewGroup=(ViewGroup)layoutInflater.inflate(R.layout.activity_main_item, null);
smartImagenView=(SmartImageView)viewGroup.findViewById(R.id.imagen1);
tvtitulo=(TextView)viewGroup.findViewById(R.id.tvTitulo);
tvdescripcion=(TextView)viewGroup.findViewById(R.id.tvDescripcion);
String urlfinal = "http://www.socialmorelia.com/img/"+imagen.get(position).toString();
Rect rect = new Rect(smartImagenView.getLeft(),smartImagenView.getTop(),smartImagenView.getRight(),smartImagenView.getBottom());
smartImagenView.setImageUrl(urlfinal, rect);
tvtitulo.setText(titulo.get(position).toString());
tvdescripcion.setText(descripcion.get(position).toString());
return viewGroup;
}
}
}
espero que me puedan ayudar gracias