Android Open Source - roommates Drawer List Adapter






From Project

Back to project page roommates.

License

The source code is released under:

Apache License

If you think the Android project roommates 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.mattieapps.roommates;
//from w w  w.  ja  v  a 2 s. c  om
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;

/**
 * Created by andrewmattie on 11/28/14.
 */
public class DrawerListAdapter extends BaseAdapter {

    private Context context;
    private String[] mtitle;
    private int[] micon;
    private LayoutInflater inflater;

    public  DrawerListAdapter(Context context, String title[], int icon[])
    {
        this.context=context;
        this.mtitle=title;
        this.micon=icon;

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

    @Override
    public Object getItem(int arg0) {
        return arg0;
    }

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

    @Override
    public View getView(int position, View arg1, ViewGroup parent) {

        TextView title;
        //TextView subtitle;
        ImageView icon;

        inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View itemView = inflater.inflate(R.layout.drawer_item, parent, false);

        title = (TextView) itemView.findViewById(R.id.drawerItemTextView);
        icon = (ImageView) itemView.findViewById(R.id.drawerItemImageView);

        title.setText(mtitle[position]);
        icon.setImageResource(micon[position]);

        return itemView;

    }

}




Java Source Code List

com.mattieapps.roommates.ApplicationTest.java
com.mattieapps.roommates.BaseActivity.java
com.mattieapps.roommates.DrawerListAdapter.java
com.mattieapps.roommates.MainActivity.java
com.mattieapps.roommates.MainActivity.java
com.mattieapps.roommates.RentCalFragment.java
com.mattieapps.roommates.Settings.java
com.mattieapps.roommates.TipCalFragment.java