Android Open Source - DHSC---android my Adapter






From Project

Back to project page DHSC---android.

License

The source code is released under:

GNU General Public License

If you think the Android project DHSC---android 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 com.cal.sched;
//from w w  w . ja v  a 2s. c o m
import android.content.Context;
import android.media.Image;
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 org.w3c.dom.Text;

/**
 * Created by Tim on 2/12/14.
 */
public class myAdapter extends BaseAdapter
{
    Context context;
    String[] classes;
    String[] teachers;
    String[] rooms;
    String[] times;
    int[] images;
    private static LayoutInflater inflater = null;

    public myAdapter(Context context, String[] classes, String[] teachers, String[] rooms,
                     String[] times, int[] images)
    {
        this.context = context;
        this.classes = classes;
        this.teachers = teachers;
        this.rooms = rooms;
        this.times = times;
        this.images = images;
        inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    }

    @Override
    public int getCount() {
        return classes.length;
    }

    @Override
    public Object getItem(int i) { return classes[i] + " " + teachers[i] + "" + rooms[i] + " " +
            times[i]; }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View convertView, ViewGroup viewGroup)
    {
        View myView = convertView;
        if(myView == null)
            myView = inflater.inflate(R.layout.custom_adapter, null);
        ImageView timage = (ImageView) myView.findViewById(R.id.aimage);
        TextView tclass = (TextView) myView.findViewById(R.id.aclass);
        TextView tteacher = (TextView) myView.findViewById(R.id.ateacher);
        TextView troom = (TextView) myView.findViewById(R.id.aroom);
        TextView ttime = (TextView) myView.findViewById(R.id.time);
        tclass.setText(classes[i]);
        tteacher.setText(teachers[i]);
        troom.setText(rooms[i]);
        ttime.setText(times[i]);
        timage.setImageResource(images[i]);
        return myView;
    }
}




Java Source Code List

com.cal.sched.AddSched.java
com.cal.sched.LinClassView.java
com.cal.sched.Lunch.java
com.cal.sched.Main.java
com.cal.sched.myAdapter.java