If you think the Android project HeadphoneController 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
/*
* TODO: license//www.java2s.com
*/package ca.mbabic.headphonecontroller;
import android.app.Activity;
import android.app.ListFragment;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
/**
* Fragment displaying UI elements related to the list of configurable inputs.
*
* @author Marko Babic
*
*/publicclass ConfigurationFragment extends ListFragment {
privatestaticfinal String[] CONFIGURATION_OPTIONS = new String[] {
"One Press", "Two Presses", "Three Presses" };
@Override
publicvoid onAttach(Activity activity) {
super.onAttach(activity);
}
@Override
publicvoid onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
publicvoid onActivityCreated(Bundle savedInstanceState) {
ArrayAdapter<String> adapter;
super.onActivityCreated(savedInstanceState);
adapter = new ArrayAdapter<String>(getActivity(),
R.layout.configuration_list_item, R.id.label,
CONFIGURATION_OPTIONS);
setListAdapter(adapter);
}
@Override
publicvoid onListItemClick(ListView l, View v, int position, long id) {
Intent selectCommandIntent;
Bundle args;
String item;
item = (String) getListView().getItemAtPosition(position);
selectCommandIntent = new Intent(getActivity(),
SelectCommandActivity.class);
args = new Bundle();
args.putString(SelectCommandActivity.INPUT_SEQUENCE_KEY, item);
startActivityForResult(selectCommandIntent, 0);
}
}