Back to project page MultiWork.
The source code is released under:
Copyright (c) 2013, Torti Andr?s Fernando All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions a...
If you think the Android project MultiWork listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.multiwork.andres; /*from w w w . j ava 2s.c om*/ import android.content.Context; import android.graphics.Color; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.TextView; public class MenuListAdapter extends BaseAdapter { // Declare Variables Context context; String[] mTitle; String[] mSubTitle; int[] mIcon; LayoutInflater inflater; public MenuListAdapter(Context context, String[] title, String[] subtitle, int[] icon) { this.context = context; this.mTitle = title; this.mSubTitle = subtitle; this.mIcon = icon; } @Override public int getCount() { return mTitle.length; } @Override public Object getItem(int position) { return mTitle[position]; } @Override public long getItemId(int position) { return position; } public View getView(int position, View convertView, ViewGroup parent) { // Declare Variables TextView txtTitle; TextView txtSubTitle; ImageView imgIcon; inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View itemView = inflater.inflate(R.layout.drawer_list_item, parent, false); // Locate the TextViews in drawer_list_item.xml txtTitle = (TextView) itemView.findViewById(R.id.title); txtSubTitle = (TextView) itemView.findViewById(R.id.subtitle); // Locate the ImageView in drawer_list_item.xml imgIcon = (ImageView) itemView.findViewById(R.id.icon); // Set the results into TextViews txtTitle.setText(mTitle[position]); txtSubTitle.setText(mSubTitle[position]); // Set the results into ImageView imgIcon.setImageResource(mIcon[position]); itemView.setBackgroundColor(Color.WHITE); return itemView; } }