Back to project page hackspacewidget.
The source code is released under:
Apache License
If you think the Android project hackspacewidget 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 de.ring0.hackspace; //from w w w . j av a 2 s. com import java.util.ArrayList; import java.util.List; import android.os.Bundle; import android.support.v4.app.ListFragment; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter; import android.widget.ListView; public class HackspaceListFragment extends ListFragment implements OnItemClickListener { List<String> spaceList = new ArrayList<String>(); private SpaceSelectedListener listener = null; private ArrayAdapter<String> spaceAdapter; public HackspaceListFragment() { super(); } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); spaceAdapter = new ArrayAdapter<String>(getActivity(), R.layout.hackspace_list, spaceList); } @Override public void onStart() { super.onStart(); setListAdapter(spaceAdapter); getListView().setOnItemClickListener(this); //END spaceAdapter.notifyDataSetChanged(); } public void setOnSpaceSelectedListener(SpaceSelectedListener listener) { this.listener = listener; } public interface SpaceSelectedListener { public void onSpaceSelected(int position); } @Override public void onItemClick(AdapterView<?> parent, View vuew, int position, long id) { if (null != listener) { listener.onSpaceSelected(position); } } public void setSelectable(boolean selectable) { if (selectable) { getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE); } else { getListView().setChoiceMode(ListView.CHOICE_MODE_NONE); } } }