package net.ddns.mahaljsp.ch14_03_listfragment;

import android.os.Bundle;
import android.support.v4.app.ListFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;

/**
 * Created by Thomas Wu(mahaljsp@gmail.com) on 2016/12/10.
 */

public class ListArea extends ListFragment {
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        setListAdapter(ArrayAdapter.createFromResource(getActivity(), R.array.movies, android.R.layout.simple_list_item_1));
        return super.onCreateView(inflater, container, savedInstanceState);
    }
    @Override
    public void onListItemClick(ListView list, View view, int position, long id) {
        ((MainActivity)getActivity()).showDetail(position);
    }
}
