I have created an android application in that I want to display some Image data vertically in ListView.
How to make it possible ?
I tried using this code-
<LinearLayout
android:id="#+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="360dp"
android:layout_above="#+id/relativeLayout2"
android:layout_below="#+id/relativeLayout1"
android:gravity="center"
android:orientation="vertical" >
<ListView
android:id="#android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="left|top"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="15dp"
app:layout_gravity="fill_vertical"
android:entries="#array/country_image_list" >
</ListView>
</LinearLayout>
public class ItemImagesAdapter extends BaseAdapter {
private Context context;
private ArrayList<String> paths;
private ImageLoader iml;
public ItemImagesAdapter(FragmentActivity activity, ArrayList<String> image_paths) {
context = activity;
paths = image_paths;
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(activity).build();
ImageLoader.getInstance().init(config);
iml = ImageLoader.getInstance();
}
#Override
public int getCount() {
return paths.size();
}
#Override
public Object getItem(int position) {
return paths.get(position);
}
#Override
public long getItemId(int position) {
return position;
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = LayoutInflater.from(context);
if (convertView == null) {
convertView = inflater.inflate(R.layout.list_item_image, parent, false);
}
String path = paths.get(position);
ImageView image = (ImageView) convertView.findViewById(R.id.image1);
iml.displayImage(path, image);
return convertView;
}
}
take one more layout for list item as R.layout.list_item_image.
here i am taking image loader to load the images from server.
if you are getting images by means local...then set them directly
hope this may helps you
You can try to manage your requirement using TwoWayView for Horizontal scrolling of ListView items with Vertical scrolling. You can aslo check this demo for the same on github.
XML for first activity
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".FirstActivity"
android:orientation="vertical">
<ListView
android:id="#+id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content"></ListView>
</LinearLayout>
XML for row layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<ImageView
android:id="#+id/myImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
Create this layouts and then using custom adapter class you can fill the images for each row in image view...Something like this
Custom Adapter class
public class customAdapter extends BaseAdapter {
ArrayList<HashMap<String, String>> al = new ArrayList<HashMap<String,String>>();
Activity activity;
private static LayoutInflater inflater = null;
public customAdapter(Activity a, ArrayList<HashMap<String, String>> al) {
Log.e("check", "");
activity = a;
this.al = al;
inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
#Override
public int getCount() {
// TODO Auto-generated method stub
return al.size();
}
#Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return position;
}
#Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return position;
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
imageLoader=new ImageLoader(activity.getApplicationContext());
View vi=convertView;
if(convertView==null)
{
vi = inflater.inflate(R.layout.row_layout, null);
}
ImageView myImage = (ImageView) vi.findViewById(R.id.myImage);
imageLoader.DisplayImage(//your image from resource here),myImage);
return vi;
}
}
Any problem in this you can follow the link of the tutorial I have mentioned in the comments...
Related
public class MyAdapter extends BaseAdapter implements ListAdapter {
private List<String> events = new ArrayList<String>();
private Context context;
public MyAdapter(List<String> events, Context context) {
this.events = events;
this.context = context;
String a = String.valueOf(events.size());
Toast.makeText(context,a,Toast.LENGTH_LONG).show();
}
#Override
public int getCount() {
return events.size();
}
#Override
public Object getItem(int position) {
return events.get(position);
}
#Override
public long getItemId(int position) {
//return events.get(position).getId();
return 0;
}
#Override
public View getView(final int position, View convertView, ViewGroup parent) {
View view = convertView;
if (view == null) {
LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = layoutInflater.inflate(R.layout.list_item_layout, null);
}
TextView listtv = (TextView) view.findViewById(R.id.label1);
listtv.setText(events.get(position));
Button delbutton = (Button) view.findViewById(R.id.del_button);
delbutton.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
Toast.makeText(context,"You didn' code this feature yet",Toast.LENGTH_LONG).show();
}
});
return view;
}
}
I am creating an object of MyAdapter and calling it by passing a List and Activity.this
when i try to toast the size of the list passed i get the proper size
however only the first item of the list gets displayed on the screen
MY Xml`
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:layout_height="match_parent"
android:layout_width="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:background="#00000000">
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/label1"
android:padding="10dp"
android:textSize="15dp"
android:textStyle="bold"
android:gravity="center"
>
</TextView>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/del_button"
android:background="#00000000"
android:drawableTop="#drawable/ic_close_black_24dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:paddingTop="10dp"
>
</Button>
</RelativeLayout>`
and my main layout file is
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/content_cal_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:context="com.test123.CalView"
tools:showIn="#layout/activity_cal_view">
<ListView
android:id="#+id/list_id"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
</ListView>
</RelativeLayout>
public static class ViewHolder{
public TextView listTV;
public Button delButton;
}
#Override
public View getView(final int position, View convertView, ViewGroup parent) {
View view = convertView;
ViewHolder holder;
if (view == null) {
LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = layoutInflater.inflate(R.layout.list_item_layout, null);
//Edited this part
holder = new ViewHolder
holder.listTV = (TextView) view.findViewById(R.id.label1);
holder.delbutton = (Button) view.findViewById(R.id.del_button);
view.setTag(holder);
} else holder=(ViewHolder)view.getTag();
listtv.setText(events.get(position));
delbutton.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
Toast.makeText(context,"You didn' code this feature yet",Toast.LENGTH_LONG).show();
}
});
return view;
}
I'm trying to make a grid view to dynamically load images and data from a web server, but if i try to use Glide to load the image it messes up my layout, im a newbie on android programming so please be patient
the correct layout is this:
but if i enable Glide it shows like this:
As you can see there is a wide gap at the bottom that shouldn't be there
Here is my Grid Adapter:
public class GridViewAdapter extends BaseAdapter {
private Context mContext;
ArrayList<HashMap<String, String>> hotelsList;
TextView hotelNameTv;
TextView hotelDistanceTv;
ImageView hotelImage;
public GridViewAdapter(Context c, ArrayList<HashMap<String, String>> hotelsList ) {
mContext = c;
this.hotelsList = hotelsList;
}
#Override
public int getCount() {
// TODO Auto-generated method stub
return hotelsList.size();
}
#Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return hotelsList.get(position);
}
#Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return 0;
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
View grid;
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
if (convertView == null) {
grid = new View(mContext);
grid = inflater.inflate(R.layout.hotel_item, null);
hotelNameTv = (TextView) grid.findViewById(R.id.hotelName);
hotelDistanceTv = (TextView) grid.findViewById(R.id.hotelDistance);
hotelImage = (ImageView) grid.findViewById(R.id.hotelImage);
HashMap<String, String> hotel=hotelsList.get(position);
hotelNameTv.setText(hotel.get("name"));
hotelDistanceTv.setText(hotel.get("distancemsg"));
/*
Glide.with(mContext)
.load("http://192.168.0.6/hoteles360ws/img/kron02.jpg")
.into(hotelImage);
*/
} else {
grid = (View) convertView;
}
return grid;
}
}
Here is my Activity Main resource File:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:background="#color/windowBackground">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:orientation="vertical">
<include
android:id="#+id/toolbar"
layout="#layout/toolbar" />
<GridView
android:id="#+id/hotelsGrid"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:verticalSpacing="#dimen/small_margin"
android:horizontalSpacing="#dimen/small_margin"
android:stretchMode="columnWidth"
android:numColumns="2"
android:padding="10dp" />
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
And my item resource file
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#FFFFFF"
android:elevation="30dp"
>
<TextView
android:text="Hotel Name"
android:layout_width="match_parent"
android:layout_height="56sp"
android:gravity="center_vertical"
android:id="#+id/hotelName"
android:textAppearance="#android:style/TextAppearance.Material.Large"
android:textColor="#color/colorPrimary"
android:paddingLeft="5sp" />
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:srcCompat="#drawable/hotel"
android:id="#+id/hotelImage"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
android:cropToPadding="false"
android:layout_below="#+id/hotelName"
android:layout_alignParentStart="true" />
<TextView
android:text="Hotel Distance"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/hotelDistance"
android:background="#222222"
android:textAppearance="#android:style/TextAppearance.Material.Inverse"
android:layout_below="#+id/hotelImage"
android:layout_alignParentStart="true"
android:padding="5sp"
android:textColor="#color/gold" />
</RelativeLayout>
</RelativeLayout>
Thanks for your help!!!
Not sure what i did... first i changed my get view to this:
#Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
if(convertView == null){
final LayoutInflater layoutInflater = LayoutInflater.from(mContext);
convertView = layoutInflater.inflate(R.layout.hotel_item, null);
}
final TextView hotelName = (TextView)convertView.findViewById(R.id.hotelName);
final TextView hotelDistance = (TextView)convertView.findViewById(R.id.hotelDistance);
final ImageView hotelImage = (ImageView)convertView.findViewById(R.id.hotelImage);
HashMap<String, String> hotel=hotelsList.get(position);
hotelName.setText(hotel.get("name"));
hotelDistance.setText(hotel.get("distancemsg"));
Glide.with(mContext)
.load("http://192.168.0.6/hoteles360ws/img/kron02.jpg")
.into(hotelImage);
return convertView;
}
And it didn't worked...
But then i changed from glide to picasso, it worked perfectly...
#Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
if(convertView == null){
final LayoutInflater layoutInflater = LayoutInflater.from(mContext);
convertView = layoutInflater.inflate(R.layout.hotel_item, null);
}
final TextView hotelName = (TextView)convertView.findViewById(R.id.hotelName);
final TextView hotelDistance = (TextView)convertView.findViewById(R.id.hotelDistance);
final ImageView hotelImage = (ImageView)convertView.findViewById(R.id.hotelImage);
HashMap<String, String> hotel=hotelsList.get(position);
hotelName.setText(hotel.get("name"));
hotelDistance.setText(hotel.get("distancemsg"));
Picasso.with(mContext)
.load("http://192.168.0.6/hoteles360ws/img/kron02.jpg")
.into(hotelImage);
return convertView;
}
I'll be very grateful if someone explains me what happened...
You can check this link below. Gridview in Android is quite studpid. (I suggest you use Recyclerview with GridLayoutManager)
How to have a GridView that adapts its height when items are added
I have a fragment that contains a GridView
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<GridView
android:padding="20dp"
android:id="#+id/sub_category_gridview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:horizontalSpacing="20dp"
android:numColumns="4"
android:verticalSpacing="10dp"
android:scrollingCache="true"
android:smoothScrollbar="true"
android:fastScrollEnabled="true"
tools:listitem="#layout/sub_category_view" />
</LinearLayout>
Every child of this GridView contains one TextView and one ImageView
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center"
android:id="#+id/sub_category_view">
<ir.motorel.carbuyinstruduction.SquareLinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/button">
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="#drawable/picture1"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
android:layout_margin="10dp"
android:id="#+id/sub_category_img"/>
</ir.motorel.carbuyinstruduction.SquareLinearLayout>
<TextView
android:layout_marginTop="5dp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Hello"
android:gravity="center"
android:textColor="#C36518"
android:id="#+id/sub_category_name"/>
</LinearLayout>
When I fill GridView with Texts and Images, it's become very Laggy and slow when I scrolling. This is My adapter Class:
public class CustomGrid extends BaseAdapter{
private Context mContext;
public CustomGrid(Context c) {
mContext = c;
}
#Override
public int getCount() {
// TODO Auto-generated method stub
return subCatTitle.length;
}
#Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return null;
}
#Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return 0;
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
ViewHolder viewHolder;
if(convertView == null){
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.sub_category_view, parent, false);
viewHolder = new ViewHolder();
viewHolder.subCatView = (LinearLayout) convertView.findViewById(R.id.sub_category_view);
viewHolder.subCatImg = (ImageView) convertView.findViewById(R.id.sub_category_img);
viewHolder.subCatTitle = (TextView) convertView.findViewById(R.id.sub_category_name);
//subCatImg.setImageResource(imgIDs.getResourceId(position, -1));
convertView.setTag(viewHolder);
}
else{
//imgIDs.recycle();
viewHolder = (ViewHolder) convertView.getTag();
}
viewHolder.subCatTitle.setText(subCatTitle[position]);
return convertView;
}
}
public class ViewHolder{
public TextView subCatTitle;
public ImageView subCatImg;
public LinearLayout subCatView;
}
How can i optimize it to scroll more smoothly?
PS. My images are in drawable folder and their format is PNG.
I had a ImageView in my Activity's Header that I set a really big image to it. It was killing performance. There is no problem in GridView.
I have to create UI of an application as shelf which holds magazines. I am using customize grid view, with grid element consisting of thumbnail of magazine having shelf as background image.
shelf.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<GridView
android:id="#+id/gridView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:numColumns="4" >
</GridView>
</LinearLayout>
item.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/grid">
<ImageView
android:id="#+id/imageView1"
android:layout_width="70dp"
android:layout_height="100dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="41dp"
android:src="#drawable/book1" />
</RelativeLayout>
LibraryActivity.java
public class LibraryActivity extends Activity {
GridView grid = null;
ArrayList<Integer> image = new ArrayList<Integer>();
ImageView thumbnail;
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.shelf);
image.add(R.drawable.book1);
image.add(R.drawable.book2);
image.add(R.drawable.book3);
image.add(R.drawable.book4);
System.out.println("before adapter");
grid = (GridView) findViewById(R.id.gridView1);
CustomAdapter adapter = new CustomAdapter(this, R.layout.item);
grid.setAdapter(adapter);
}
public class CustomAdapter extends BaseAdapter {
Context mContext = null;
int mitem = 0;
LayoutInflater mInflater = null;
public CustomAdapter(Context context, int item) {
this.mContext = context;
this.mitem = item;
this.mInflater = (LayoutInflater) context
.getSystemService(LAYOUT_INFLATER_SERVICE);
}
#Override
public int getCount() {
// TODO Auto-generated method stub
return image.size();
}
#Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return null;
}
#Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return 0;
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
System.out.println("****CHECKING 2**********");
convertView = mInflater.inflate(mitem, null);
System.out.println("****CHECKING 3**********");
thumbnail = (ImageView) convertView
.findViewById(R.id.imageView1);
System.out.println("****CHECKING 3**********");
}
thumbnail.setImageResource(image.get(position));
return convertView;
}
}
}
But using this code the shelf with magazine is only being displayed. I want to display empty shelf to occupy whole screen of device. How can i do that??
Is there any alternate way to implement the shelf??
There's a great project called Shelves made by Romain Guy from Google. You should check it out.
Hi Please any one Help me out of this..
i am using listview adapter for displaying image list with check box, that allows to select multiple image form list.. code works good for images list not more than screen but if image is more than screen (for scrolling) it throws null pointer exception.. following is my code.
(apterMultiChoice.java)
public class PhotoAdapterMultiChoice extends BaseAdapter
{
public ViewHolder holder;
private Activity activity;
private ArrayList<String> data;
private ArrayList<String> text;
private ArrayList<CheckBox> chkBox;
private static LayoutInflater inflater=null;
public ImageLoader imageLoader;
public PhotoAdapterMultiChoice(Activity a, ArrayList<String> title,ArrayList<String> URL,ArrayList<CheckBox> chkBoxPass)
{
activity = (Activity) a;
data=URL;
text=title;
this.chkBox = chkBoxPass;
inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
imageLoader=new ImageLoader(activity.getApplicationContext());
}
public int getCount()
{
return data.size();
}
public boolean getSelect(int position)
{
return this.chkBox.get(position).isChecked();
}
public int getCountSelect()
{
return chkBox.size();
}
public Object getItem(int position)
{
return this.chkBox.get(position).isChecked();
}
public long getItemId(int position)
{
return position;
}
public static class ViewHolder
{
public TextView text;
public ImageView image;
public CheckBox checkBox;
}
public View getView(int position, View convertView, ViewGroup parent)
{
System.out.println(this.chkBox.size() +" ---- "+data.size());
if(this.chkBox.size() < data.size())
{
View vi=convertView;
if(convertView==null)
{
System.out.println("convertView is null");
vi = inflater.inflate(R.layout.photoitemlistmultichoice, null);
holder=new ViewHolder();
holder.text=(TextView)vi.findViewById(R.id.text);
holder.image=(ImageView)vi.findViewById(R.id.image);
holder.checkBox=(CheckBox) vi.findViewById(R.id.check);
//this.chkBox.add((CheckBox) vi.findViewById(R.id.check));
vi.setTag(holder);
}
else
{
System.out.println("convertView is Not null");
this.chkBox.add((CheckBox) vi.findViewById(R.id.check));
holder=(ViewHolder)vi.getTag();
}
System.out.println("Position : "+position);
holder.text.setText(text.get(position));
holder.image.setTag(data.get(position));
//holder.checkBox.setTag(chkBox.get(position));
//this.chkBox.set(position, chkBox.get(position));
//this.chkBox.add(holder.checkBox);
imageLoader.DisplayImage(data.get(position), activity, holder.image,"Photo");
return vi;
}
return null;
}
}
How i call adapter
PhotoAdapter adapter = new PhotoAdapter(this, imageNameList, thumbURLList);
listPhoto.setAdapter(adapter); //listPhoto is my listView
(photolist.xml)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:id="#+id/lblAlbumName"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<ListView
android:id="#+id/listPhoto"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"/>
</LinearLayout>
(photoitemlist.xml)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/image"
android:layout_width="50dip"
android:layout_height="50dip" android:src="#drawable/default_photo_icon" android:scaleType="centerCrop"/>
<TextView
android:id="#+id/text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="left|center_vertical"
android:textSize="20dip"
android:layout_marginLeft="10dip"
/>
</LinearLayout>
please help..
thanks...
The error is, as you said. When you scroll it poops out. So your creating your views correctly but not recycling them correctly.
this.chkBox.add((CheckBox) vi.findViewById(R.id.check));
Looks like what's causing your error. You don't need to find the Id again as you already have a holder for it.
holder.text.setText(text.get(position));
holder.image.setTag(data.get(position));
You probably want that in your else statement