Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import android.app.Activity;
- import android.content.Context;
- import android.view.LayoutInflater;
- import android.view.View;
- import android.view.ViewGroup;
- import android.widget.ArrayAdapter;
- import android.widget.TextView;
- import org.npci.upi.security.pinactivitycomponent.R;
- import java.util.ArrayList;
- import java.util.List;
- public class SelectVPAAdpt extends ArrayAdapter<String> {
- private ArrayList<String> vpaList;
- Context mContext;
- LayoutInflater mInflater;
- public SelectVPAAdpt(List<String> vpaList, Context applicationContext) {
- super(applicationContext, R.layout.item_select_vpa_adpt, vpaList);
- }
- // View lookup cache
- private static class ViewHolder {
- TextView txtVPAID;
- }
- public SelectVPAAdpt(ArrayList<String> data, Context context) {
- super(context, R.layout.item_select_vpa_adpt, data);
- this.vpaList = data;
- this.mContext=context;
- this.mInflater = (LayoutInflater) getContext().getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
- }
- @Override
- public View getView(final int position, View view, ViewGroup parent) {
- String account = vpaList.get(position);
- // Check if an existing view is being reused, otherwise inflate the view
- ViewHolder viewHolder;
- if (view == null) {
- view = mInflater.inflate(R.layout.item_select_vpa_adpt, parent, false);
- viewHolder = new ViewHolder(); // view lookup cache stored in tag
- viewHolder.txtVPAID = (TextRobotoRegularFont) view.findViewById(R.id.txtVPAID);
- view.setTag(viewHolder);
- } else {
- viewHolder = (ViewHolder) view.getTag();
- }
- viewHolder.txtVPAID.setText(account);
- return view;
- }
- }
Add Comment
Please, Sign In to add comment