The images in my listview changes when I scroll - android

This is my code:
public class GetAllCategoriesListViewAdapter extends BaseAdapter{
private JSONArray dataArray;
private Activity activity;
private static final String baseUrlForCategoryImage = "link here";
private static LayoutInflater inflater = null;
public GetAllCategoriesListViewAdapter(JSONArray jsonArray, Activity a){
this.dataArray = jsonArray;
this.activity = a;
inflater = (LayoutInflater) this.activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
#Override
public int getCount() {
return this.dataArray.length();
}
#Override
public Object getItem(int position) {
return position;
}
#Override
public long getItemId(int position) {
return position;
}
#Override
public View getView(final int position, View convertView, ViewGroup parent) {
final ListCell cell;
if(convertView == null){
convertView = inflater.inflate(R.layout.get_all_categories_list_view_cell, null);
cell = new ListCell();
cell.category_name = (TextView) convertView.findViewById(R.id.category_name);
cell.category_image = (ImageView) convertView.findViewById(R.id.category_image);
cell.category_image.setTag(cell);
convertView.setTag(cell);
}else{
cell = (ListCell) convertView.getTag();
}
try{
JSONObject jsonObject = this.dataArray.getJSONObject(position);
cell.category_name.setText(jsonObject.getString("category_name"));
String nameOfImage = jsonObject.getString("category_image");
String urlForImageInServer = baseUrlForCategoryImage + nameOfImage;
new AsyncTask<String, Void, Bitmap>(){
protected Bitmap doInBackground(String... params){
String url = params[0];
Bitmap icon = null;
try{
InputStream in = new java.net.URL(url).openStream();
icon = BitmapFactory.decodeStream(in);
}catch (MalformedURLException e){
e.printStackTrace();
}catch (IOException e){
e.printStackTrace();
}
return icon;
}
#Override
protected void onPostExecute(Bitmap result) {
cell.category_image.setImageBitmap(result);
}
}.execute(urlForImageInServer);
}catch (JSONException e){
e.printStackTrace();
}
return convertView;
}
private class ListCell{
private ImageView category_image;
private TextView category_name;
}
}
The code gets the images from my webhost and place it in every cell in my listvew. The problem is everytime I scroll, the images are shuffled and returns in few seconds. How to stop the images from changing when I scroll? I tried to use the solution on other post but it won't work. Please help.

Looks like you are new to android. So you are fetching the images in the getView method. The getView method is called every time a new list item is drawn. So For every image, a new request is made to internet. SO that will be a lot of requests . You should firstly get your images and get them in some ArryayList . Then pass that Arraylist to your adapter. Here is tutorial for you
Using AsyncTask
http://www.devexchanges.info/2015/04/android-custom-listview-with-image-and.html
Using Volley
https://www.androidhive.info/2014/07/android-custom-listview-with-image-and-text-using-volley/
Go for Volley for better performance. Cheers!

Related

getActivity() method return null

I wrote this code but getActivity method return null out onCreateView method.
public class HomeScreen extends Fragment {
private Context context;
ViewPager viewPager;
GridView listGrid;
Bitmap[] bitmaps ;
LinearLayout indicator;
Button first,second;
String[] path ;
TextView imageTitle;
#Nullable
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.home_screen, container, false);
listGrid = (GridView) v.findViewById(R.id.grid_view);
viewPager = (ViewPager)v.findViewById(R.id.view_pager);
indicator = (LinearLayout)v.findViewById(R.id.indicator);
first = (Button) v.findViewById(R.id.bfirst);
second = (Button) v.findViewById(R.id.bsecond);
imageTitle = (TextView) v.findViewById(R.id.myImageTitle);
Typeface tf = Typeface.createFromAsset(HomeScreen.this.getActivity().getAssets(), "fonts/Medium.otf");
imageTitle.setTypeface(tf);
new GetCategories().execute();
return v;
}
class GetCategories extends AsyncTask {
#Override
protected Object doInBackground(Object[] params) {
JSONArray dataJsonArr = null;
JsonParser jParser = new JsonParser();
// get json string from url
JSONObject json = jParser.getJSONFromUrl("http://192.168.88.12/index.php");
try{
// get the array of users
dataJsonArr = json.getJSONArray("Users");
//Arrays of data
bitmaps = new Bitmap[dataJsonArr.length()];
path = new String[dataJsonArr.length()];
for (int i = 0; i < dataJsonArr.length(); i++) {
JSONObject c = dataJsonArr.getJSONObject(i);
InputStream in = new URL(c.getString("image")).openStream();
bitmaps[i] = BitmapFactory.decodeStream(in);
path[i] = c.getString("title");
}
}catch (JSONException e){
e.printStackTrace();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
#Override
protected void onPostExecute(Object o) {
ListAdapter adapter=new ListAdapter(HomeScreen.this.getActivity(), path,bitmaps);
listGrid.setAdapter(adapter);
ImageAdapter sliderAdapter = new ImageAdapter(HomeScreen.this.getActivity(),bitmaps,indicator,first,second,imageTitle,path);
viewPager.setAdapter(sliderAdapter);
}
}
public void onItemClick(int mPosition){
Log.i("Log:", " on item click : " + context);
}
#Override
public void onAttach(Activity activity) {
super.onAttach(activity);
context = activity;
}
}
public class ListAdapter extends ArrayAdapter {
private final Activity context;
private final String[] title;
private final Bitmap[] image;
public ListAdapter(Activity context, String[] title, Bitmap[] image) {
super(context, R.layout.list_row, title);
this.context=context;
this.title=title;
this.image=image;
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater=context.getLayoutInflater();
View rowView=inflater.inflate(R.layout.list_row, null, true);
TextView txtTitle = (TextView) rowView.findViewById(R.id.text);
ImageView imageView = (ImageView) rowView.findViewById(R.id.image);
txtTitle.setTypeface(Typeface.createFromAsset(ListAdapter.this.getContext().getAssets(), "fonts/Light.otf"));
txtTitle.setText(title[position]);
imageView.setImageBitmap(image[position]);
rowView.setOnClickListener(new OnItemClickListener(position));
return rowView;
}
/********* Called when Item click in ListView ************/
private class OnItemClickListener implements View.OnClickListener {
private int mPosition;
OnItemClickListener(int position){
mPosition = position;
}
#Override
public void onClick(View v) {
HomeScreen homeScreen = new HomeScreen();
homeScreen.onItemClick(mPosition);
}
}
}
This is done because your Fragment is not attached to any activity so far.
getActivity returns null before the onAttach(Activity) returs and after the onDetach() better check out Fragment Documentation to see the proper usage of fragments.
Also, stop using such references to context
ListAdapter.this.getContext() or HomeScreen.this.getActivity() they are prune to crashes and far from android logic.
To avoid these issues consider using Loader instead of AsyncTask here is a good tutorial how loaders work implement: https://stackoverflow.com/a/20991394/944070
You are not using a FragmentTransaction to interact with your Fragment. This means that the FragmentManager is not able to play a role when it comes to the Fragment lifecycle, hence your Activity is null because the Fragment is never attached to the Activity.

GridView reverse

I have pictures from my online database in my GridView and I want it in reverse order.
So I want when I add a new picture to my database to be the first in the GridView.
I tried to find an answer but there is nothing about it at stackoverflow.
This is my ListViewAdapter:
public class GetMovieImagesListViewAdapter extends BaseAdapter {
private JSONArray dataArray;
private Activity activity;
private static final String baseUrlForImage = "http://google.com";
private static LayoutInflater inflater = null;
public GetMovieImagesListViewAdapter(JSONArray jsonArray, Activity a){
this.dataArray = jsonArray;
this.activity = a;
inflater = (LayoutInflater) this.activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
#Override
public int getCount() {
return this.dataArray.length();
}
#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) {
final ListCell cell;
if (convertView == null) {
convertView = inflater.inflate(R.layout.get_images_from_movies_list_cell, null);
cell = new ListCell();
cell.MovieImages = (ImageView) convertView.findViewById(R.id.movie_images_id);
convertView.setTag(cell);
} else {
cell = (ListCell) convertView.getTag();
}
try {
JSONObject jsonObject = this.dataArray.getJSONObject(position);
String nameOfImage = jsonObject.getString("image");
String urlForImageInServer = baseUrlForImage + nameOfImage;
new AsyncTask<String, Void, Bitmap>(){
#Override
protected Bitmap doInBackground(String... params)
{
String url = params[0];
Bitmap icon = null;
try
{
InputStream in = new URL(url).openStream();
icon = BitmapFactory.decodeStream(in);
} catch (IOException e) {
e.printStackTrace();
}
return icon;
}
#Override
protected void onPostExecute(Bitmap result)
{
cell.MovieImages.setImageBitmap(result);
}
}.execute(urlForImageInServer);
} catch (JSONException e) {
e.printStackTrace();
}
return convertView;
}
private class ListCell{
private ImageView MovieImages;
}}
You could fetch each JSONObject by starting from the end of the array and working backwards to the start:
JSONObject jsonObject = this.dataArray.getJSONObject(getCount() - position - 1);
The result that you have received try to iterate through it in the reverse order.
Your Bitmap result data seems to be a single data that you get. I am expecting an array, or arraylist of data that you get in onPostExecute() method parameter while you query your online database.
Say for example, if you get the data in the form of onPostExecute(ArrayList result), then you can simply iterate the 'result' data in reverse order in order to populate your grid view in reverse order.
Check out Iterate arraylist in reverse order

Show images from the internet in ListView

I want that this 200 Pictures are in every row of the ListView.
Where I have to copy this code which collect the pictures from the internet in my CustomAdapter?
for(int i = 1; i <= 200; i++){
final int ii = i;
final ImageView imageView = new ImageView(CustomListView.this);
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,RelativeLayout.LayoutParams.WRAP_CONTENT);
//linearLayout.addView(imageView,lp);
Thread thread = new Thread(){
#Override
public void run(){
final Bitmap bm = getBitmapFromURL("http://ruthe.de/cartoons/strip_"+getPictureName(ii)+".jpg");
runOnUiThread(new Runnable() {
#Override
public void run() {
if(bm !=null){
imageView.setImageBitmap(bm);
}
else {
//linearLayout.removeView(imageView);
}
}
});
}
};thread.start ();
}
This is my CustomAdapter:
public class CustomAdapter extends BaseAdapter implements View.OnClickListener {
/*********** Declare Used Variables *********/
private Activity activity;
private ArrayList data;
private static LayoutInflater inflater=null;
public Resources res;
ListModel tempValues=null;
int i=0;
/************* CustomAdapter Constructor *****************/
public CustomAdapter(Activity a, ArrayList d,Resources resLocal) {
/********** Take passed values **********/
activity = a;
data=d;
res = resLocal;
/*********** Layout inflator to call external xml layout () ***********/
inflater = ( LayoutInflater )activity.
getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
/******** What is the size of Passed Arraylist Size ************/
public int getCount() {
if(data.size()<=0)
return 1;
return data.size();
}
public Object getItem(int position) {
return position;
}
public long getItemId(int position) {
return position;
}
/********* Create a holder Class to contain inflated xml file elements *********/
public static class ViewHolder{
public TextView text;
public TextView text1;
public TextView textWide;
public ImageView image;
}
/****** Depends upon data size called for each row , Create each ListView row *****/
public View getView(int position, View convertView, ViewGroup parent) {
View vi = convertView;
ViewHolder holder;
if(convertView==null){
/****** Inflate tabitem.xml file for each row ( Defined below ) *******/
vi = inflater.inflate(R.layout.tabitem, null);
/****** View Holder Object to contain tabitem.xml file elements ******/
holder = new ViewHolder();
holder.text = (TextView) vi.findViewById(R.id.text);
holder.text1=(TextView)vi.findViewById(R.id.text1);
holder.image=(ImageView)vi.findViewById(R.id.image);
/************ Set holder with LayoutInflater ************/
vi.setTag( holder );
}
else
holder=(ViewHolder)vi.getTag();
if(data.size()<=0)
{
holder.text.setText("No Data");
}
else
{
/***** Get each Model object from Arraylist ********/
tempValues=null;
tempValues = ( ListModel ) data.get(position);
/************ Set Model values in Holder elements ***********/
holder.text.setText(tempValues.getCompanyName());
holder.text1.setText( tempValues.getUrl() );
holder.image.setImageResource(
res.getIdentifier(
"com.androidexample.customlistview:drawable/"+tempValues.getImage(),null,null));
/******** Set Item Click Listner for LayoutInflater for each row *******/
vi.setOnClickListener(new OnItemClickListener( position ));
}
return vi;
}
#Override
public void onClick(View v) {
Log.v("CustomAdapter", "=====Row button clicked=====");
}
/********* Called when Item click in ListView ************/
private class OnItemClickListener implements View.OnClickListener{
private int mPosition;
OnItemClickListener(int position){
mPosition = position;
}
#Override
public void onClick(View arg0) {
CustomListView sct = (CustomListView)activity;
/**** Call onItemClick Method inside CustomListViewAndroidExample Class ( See Below )****/
sct.onItemClick(mPosition);
}
}
//My own code
public static Bitmap getBitmapFromURL(String src) {
try {URL url = new URL(src);
return BitmapFactory.decodeStream(url.openConnection().getInputStream());
}
catch(Exception e){
e.printStackTrace();
}
return null;
} //PICTURE BITMAP
public String getPictureName (int i){
String in = ""+i+"";
if(in.length() == 1){
return "000"+in;
}
else if(in.length() == 2){
return "00"+in;
}
else if(in.length() == 3){
return "0"+in;
}
else{
return in;
}
}
I searched on the whole internet but I dont found something which explains how to get pictures from the Internet into every row of a ListView...
PICASsO allows for hassle-free image loading in your application—often in one line of code!
for the library check this link http://square.github.io/picasso/
and at the bottom of page you can download jar file and just paste it in the libs folder
Picasso.with(context).load("YOUR IMAGE URL").into(imageView);
int your getView method
do it like
holder.image=(ImageView)vi.findViewById(R.id.image);
and then
Picasso.with(context).load("YOUR IMAGE URL").into(holder.image);
Take a look at the Picasso library. It makes it extremely easy.
http://square.github.io/picasso/
To use it, simply find your ImageView with the standard findViewById, then use the following code:
Picasso.with(context).load("www.google.com/images/1").into(imageView);
Simply input the URL and the ImageView, and Picasso will async load the image and put it in the imageview.
Im currently using it to show a list of over 400 images in a listview, works perfectly.
Except for the thread you can use the bitmap object inside the adapter itself and initialize the image view with the bitmap object, using position integer instead of (ii).
Hi i have found a workaround for my app: i have create a class type:
public class myClass {
....
...
private Bitmap imguser;
.. and into costructor i have added objects for async task like Future and i send image name
received from server side....
public myClass(..., ..,..,String userid, ...){
Future<Bitmap> futureimguser;
ExecutorService executor = Executors.newCachedThreadPool();
getImgFromSite getimguserfromsite = new getImgFromSite(userid,"imguser");
futureico = executor.submit(geticofromsite);
futureimguser = executor.submit(getimguserfromsite)
.......
this.imguser = futureimguser.get();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ExecutionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
this.icopoi = futureico.get();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ExecutionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
executor.shutdown();
next i have a method like below which loads images from my site.
private final class getImgFromSite implements Callable<Bitmap> {
String imgsrc = new String();
String imgtipo = new String();
public getImgFromSite(String srcimg,String imgtipo) {
this.imgsrc = srcimg;
this.imgtipo = imgtipo;
}
#Override
public Bitmap call() throws Exception {
String imgpath;
if(imgtipo.compareTo("imguser") == 0){
imgpath = "http://mysite/assets/imgcomics/"+imgsrc+".jpg";
}
else{
imgpath = "http://mysite/"+imgsrc;
}
Bitmap myBitmap;
URL url = new URL(imgpath);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoInput(true);
connection.connect();
InputStream input = connection.getInputStream();
myBitmap= BitmapFactory.decodeStream(input);
return myBitmap;
}
}
Hope that i have help you!

Loading an image url into an item ListView using paging, Android

Im trying to make a lisView with two textView and an imageView (that come as a url Sting) on each item at the list but, the list is not scrolling as good as I want, because its taking too long to load the image url.
Im using an AsyncTask class for loading the the image but still it dosent look so good.
here is my code at int the ArrayAdapter class:
public class MySimpleArrayAdapter extends ArrayAdapter<Movie> {
final private Context context;
final private Movie[] movies;
ImageView movieIcon;
TextView name, description;
Bitmap bitmap;
public MySimpleArrayAdapter(Context context, Movie[] movies) {
super(context,R.layout.item_in_movielist, movies);
this.context = context;
this.movies = movies;
}
#Override
public View getView(final int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View rowView = inflater.inflate(R.layout.item_in_movielist, parent, false);
name = (TextView) rowView.findViewById(R.id.tvMovieName);
description = (TextView) rowView.findViewById(R.id.tvMovieDescription);
movieIcon = (ImageView) rowView.findViewById(R.id.ivMovieIcon);
GetImageAsync getImageAsync = new GetImageAsync();
getImageAsync.imageView = movieIcon;
name.setText(movies[position].getMovieName());
description.setText(movies[position].getMovieDescription());
getImageAsync.execute(position);
return rowView;
}
public class GetImageAsync extends AsyncTask<Integer, Void, Bitmap> {
public ImageView imageView;
#Override
protected void onPostExecute(Bitmap bitmap1) {
imageView.setImageBitmap(bitmap1);
}
#Override
protected Bitmap doInBackground(Integer... params) {
URL url = null;
try {
url = new URL(movies[params[0]].getMovieImgURL());
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoInput(true);
connection.connect();
InputStream input = connection.getInputStream();
return BitmapFactory.decodeStream(input);
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
}
}
I understood that this is not the way to do that, I`m looking for changing my code into "Paging" and I want to do it right.
any tips what can I do ?
P.S
If you can show me how to add Paging to this code it will be great.
Thanks!
Picasso.with(mContext)
.load(img.get(pos).replaceAll(" ", "%20"))
.placeholder(R.drawable.ic_launcher)
.error(R.drawable.ic_launcher)
.noFade().resize(70, 70)
.into(v.image);

Suggestions to improve Activity Performance?

friends,
i am using following global variables in my activity
private String Session_ID;
private String uid;
// menu item starts
private final int Trash = 0x003;
private final int More = 0x005;
private final int SignOut = 0x006;
private final int SignIn = 0x007;
//menu item ends
private EfficientAdapter adap;
private String[] Msg_id;
private String[] Msg_body;
private String[] Sent_by;
private String[] Sent_on;
private String[] Is_my_message;
private String[] Photo_thumbnail;
private String[] Photo_full_path;
private String Conversation_id;
ProgressBar progressBar;
Button getMoreButton;
boolean callComplete = false;
private Handler mHandler = new Handler();
private int PageSize = Constants.pageSizeForMessages;
Object serviceData = null;
private String ConversationName;
private Uri selectedImage;
public class EfficientAdapter extends BaseAdapter implements Filterable {
private LayoutInflater mInflater;
private Context context;
public EfficientAdapter(Context context) {
mInflater = LayoutInflater.from(context);
this.context = context;
}
public View getView(final int position, View convertView, ViewGroup parent) {
ViewHolder holder;
convertView = mInflater.inflate(R.layout.adaptor_contentmessagedetail, null);
holder = new ViewHolder();
holder.ImgPhoto = (ImageView)convertView.findViewById(R.id.ImgPhoto);
holder.lblMsgSentBy = (TextView) convertView.findViewById(R.id.lblSentBy);
holder.lblMsgBody = (TextView) convertView.findViewById(R.id.lblMessageBody);
holder.lblMsgSentOn = (TextView) convertView.findViewById(R.id.lblSentOn);
convertView.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
if (!((MessageDetail)v.getContext()).isConnected()) {
Constants.DisplayMessage(v.getContext(),
Constants.CONNECTION_ERROR_MESSAGE);
return;
}
if(!Photo_full_path[position].equals(""))
{
String str= Photo_full_path[position].substring(Photo_full_path[position].length() - 3);
if(str.equals("pdf"))
{
}else
{
Intent myIntent = new Intent(v.getContext(), ViewSingleImage.class);
Bundle b = new Bundle();
b.putString("single_image_path", Photo_full_path[position] );
myIntent.putExtras(b);
v.getContext().startActivity(myIntent);
}
}
}
});
convertView.setTag(holder);
// Bind the data efficiently with the holder.
if(Is_my_message[position].equals("1"))
holder.lblMsgSentBy.setTextColor(Color.BLACK);
else
holder.lblMsgSentBy.setTextColor(Color.rgb(255, 107, 1));
SimpleDateFormat fromUser = new SimpleDateFormat(Constants.SERVICE_DATE_FORMAT);
java.text.DateFormat df=new SimpleDateFormat(Constants.DATE_FORMAT);
Date dt=new Date();
try
{
dt = fromUser.parse(Sent_on[position]);
} catch (java.text.ParseException e) {
e.printStackTrace();
}
// display photo
if(!Photo_thumbnail[position].equals(""))
{
// resize it
holder.ImgPhoto.setImageBitmap(DisplayLiveImage(Photo_thumbnail[position]));
}else
{
holder.ImgPhoto.setVisibility(View.GONE);
}
// display photo
holder.lblMsgSentBy.setText(Constants.GetSpecialCharacters(Sent_by[position]));
holder.lblMsgBody.setText(Constants.GetSpecialCharacters(Msg_body[position]));
holder.lblMsgSentOn.setText(df.format(dt));
return convertView;
}
class ViewHolder {
ImageView ImgPhoto;
TextView lblMsgSentBy;
TextView lblMsgBody;
TextView lblMsgSentOn;
}
#Override
public Filter getFilter() {
// TODO Auto-generated method stub
return null;
}
#Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return 0;
}
#Override
public int getCount() {
// TODO Auto-generated method stub
return Msg_id.length;
}
#Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return Msg_id[position];
}
}
public Bitmap DisplayLiveImage(String ImageSrc)
{
Bitmap bm;
try {
URL aURL = new URL(ImageSrc);
URLConnection conn = aURL.openConnection();
conn.connect();
InputStream is = null;
try
{
is= conn.getInputStream();
}catch(IOException e)
{
return null;
}
BufferedInputStream bis = new BufferedInputStream(is);
bm = BitmapFactory.decodeStream(bis);
bis.close();
is.close();
} catch (IOException e) {
return null;
}
return bm;
}
i have made them global in activity because i need them all in more than 1 functions
now my question is how to improve performance of my activity it is too slow
should i make them static or what?
any help would be appreciated.
Your global variables are almost certainly not the cause of your poor performance. Unless you're accessing them a million times, it must be something else. If you tell us what exactly is performing slower than you would expect and post the relevant code, we might be able to help.
You have a LOT of code in your getView() method. this method gets called every single time a new view gets displayed. So when the listview is created, it's called N times where N being the number of list elements that are seen. Then when you scroll, every time a new element comes onto the screen, getView() gets called again. Even if you then scroll back up, it calls getView() again.
You need to refactor your code that doesn't need to be run every time a view is created out of the view.
it is recommended to cache images and dont bring them all again and again from internet.
so my case while using custom adapter and scrolling it was again and again loading images from internet
which was causing poor performance.
and memory leakage problem too.
so what i did i followed following tutorial to load live images and my problem resolved
Answer: LazyList
http://mobilebitworks.wordpress.com/2010/11/05/android-listview-and-dynamically-loading-images-from-the-web

Categories

Resources