Back to project page EulerSolutions.
The source code is released under:
MIT License
If you think the Android project EulerSolutions 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.eulersolutions.controllers; /*from w w w . ja v a2 s .c om*/ import java.util.List; import com.eulersolutions.model.ProblemSummary; import android.content.Context; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; public class ProblemSelectArrayAdapter extends ArrayAdapter<ProblemSummary> { private static final String TAG = "EulerSolution-ProblemSelectArrayAdapter"; private int layoutId; private int textViewId; public ProblemSelectArrayAdapter(Context context, int resource, int textViewResourceId, List <ProblemSummary> newItems) { super(context, resource, textViewResourceId); Log.i(TAG, "Creating Object"); layoutId = resource; textViewId = textViewResourceId; this.addAll(newItems); } @Override public View getView(int position, View convertView, ViewGroup parent) { Log.i(TAG, "Building the View"); LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); View toReturn = inflater.inflate(layoutId, parent, false); TextView problemName = (TextView) toReturn.findViewById(textViewId); problemName.setText(buildString(this.getItem(position))); return toReturn; } @Override public long getItemId(int position) { return this.getItem(position).getId(); } @Override public boolean hasStableIds() { return true; } public String buildString(ProblemSummary item) { Log.i(TAG, "Building the String"); return "Problem" + item.getId() + ": " + item.getName(); } }