Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:orientation="vertical">
- <ListView
- android:id="@id/android:list"
- android:drawSelectorOnTop="false"
- android:layout_weight="1"
- android:layout_height="0dp"
- android:layout_width="fill_parent">
- </ListView>
- </LinearLayout>
- public class PublicTradeListFragment extends ListFragment
- {
- private String trades[];
- public PublicTradeListFragment()
- {
- trades = new String [] {
- "Trade ?",
- "Give up ?",
- "Trade again?"
- };
- }
- @Override
- public void onCreate(Bundle savedInstanceState){
- super.onCreate(savedInstanceState);
- ListAdapter listAdapter = new ArrayAdapter<String>(getActivity(),android.R.layout.simple_list_item_1,trades);
- setListAdapter(listAdapter);
- }
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
- {
- return inflater.inflate(R.layout.list_fragment,container,false);
- }
- @Override
- public void onListItemClick(ListView list, View v, int position, long id) {
- Toast.makeText(getActivity(), getListView().getItemAtPosition(position).toString(), Toast.LENGTH_LONG).show();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement