Android Open Source - android-shuite-smoking Image Button Adapter

From Project

Back to project page android-shuite-smoking.


The source code is released under:

GNU General Public License

If you think the Android project android-shuite-smoking listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package udl.eps.smokerscontrol;
/*  w  w w .  j  a  v  a 2s.  c  o m*/
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.List;

public class ImageButtonAdapter extends BaseAdapter{
    private Context context;
    private List<ImageButton> imageButtonList;

    public ImageButtonAdapter (Context context){
        this.context = context;
        this.imageButtonList = new ArrayList<>();

    public ImageButtonAdapter (Context context, List<ImageButton> lst){
        this.context = context;
        this.imageButtonList = lst;

    public void addImageButton (ImageButton img){

    public List<ImageButton> getImageButtonList(){
        return imageButtonList;
    public int getCount() {
        return this.imageButtonList.size();

    public Object getItem(int position) {
        return this.imageButtonList.get(position);

    public long getItemId(int position) {
        return 0;

    public View getView(final int position, View convertView, ViewGroup parent) {
        View view = convertView;
        if(convertView == null){
            LayoutInflater inflater = (LayoutInflater) context
            view = inflater.inflate(R.layout.image_button_layout, parent, false);

        ImageView img = (ImageView) view.findViewById(;

        TextView tv = (TextView) view.findViewById(;

        return view;

Java Source Code List