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; /* w ww.ja v a 2 s. c o m*/ import com.eulersolutions.interfaces.ISelectionListener; import com.eulersolutions.interfaces.ISolutionHandler; import android.app.Activity; import android.app.ListFragment; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.ArrayAdapter; import android.widget.ListView; public class SolutionSelectFragment extends ListFragment { private static final String TAG = "EulerSolutions-SolutionSelectFragment"; private ISelectionListener selectionCallback = null; private ISolutionHandler solutionCallback = null; private ArrayAdapter<String> adapter = null; @Override public void onCreate(Bundle savedInstanceState) { Log.i(TAG, "entered onCreate"); super.onCreate(savedInstanceState); adapter = new ArrayAdapter<String>(this.getActivity(), android.R.layout.simple_list_item_activated_1); if(solutionCallback != null) { adapter.addAll(solutionCallback.getSolutionTitles()); } this.setListAdapter(adapter); } @Override public void onAttach(Activity activity) { Log.i(TAG, "entered onAttach"); super.onAttach(activity); if((activity instanceof ISelectionListener) && (activity instanceof ISolutionHandler)) { selectionCallback = (ISelectionListener) activity; solutionCallback = (ISolutionHandler) activity; } } @Override public void onActivityCreated(Bundle savedInstanceState) { Log.i(TAG, "entered onActivityCreated"); super.onActivityCreated(savedInstanceState); this.getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE); } @Override public void onListItemClick(ListView l, View view, int position, long id) { Log.i(TAG, "entered onListItemClicked"); if(selectionCallback != null) selectionCallback.onItemSelected(position); } }