Android Open Source - HistoryCleanerPro Profile Adapter

From Project

Back to project page HistoryCleanerPro.


The source code is released under:

Copyright (c) 2014, John Phillips All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: ...

If you think the Android project HistoryCleanerPro 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.ayros.historycleaner;
//ww  w.j a v a 2  s. c  o m
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.TextView;


public class ProfileAdapter extends ArrayAdapter<Profile>
  Context context;
  int layoutResourceId;
  Profile data[] = null;
  OnClickListener buttonCallback = null;

  public ProfileAdapter(Context context, int layoutResourceId, Profile[] data, OnClickListener buttonCallback)
    super(context, layoutResourceId, data);
    this.layoutResourceId = layoutResourceId;
    this.context = context; = data;
    this.buttonCallback = buttonCallback;

  public View getView(int position, View convertView, ViewGroup parent)
    View row = convertView;
    ProfileItemUI holder = null;

    if (row == null)
      LayoutInflater inflater = ((Activity)context).getLayoutInflater();
      row = inflater.inflate(layoutResourceId, parent, false);

      holder = new ProfileItemUI();
      holder.txtName = (TextView)row.findViewById(;
      holder.txtInfo = (TextView)row.findViewById(;
      holder.txtSchedule = (TextView)row.findViewById(;
      holder.btnLoad = (Button)row.findViewById(;
      holder.btnSettings = (Button)row.findViewById(;

      holder = (ProfileItemUI)row.getTag();

    Profile profile = data[position];
    //holder.txtName.setText("Clear Widget Test");
    holder.txtInfo.setText(profile.getNumItems() + " selected items");
    holder.txtSchedule.setText("Not scheduled");

    // holder.txtSchedule.setText("Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday at 3:00AM");

    return row;

  static class ProfileItemUI
    TextView txtName;
    TextView txtInfo;
    TextView txtSchedule;
    Button btnLoad;
    Button btnSettings;

Java Source Code List