Java tutorial
/* * Copyright (c) 2014 Saud Khan. * * I am not responsible for any damage caused by this code. This code is provided free * to use as long as the original author is attributed in derivatives and uses. All * derivatives of this project should be licensed similarly. */ package com.bidyut.app.wwquakes; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ListView; import com.bidyut.app.wwquakes.data.Quake; public class QuakeInfoFragment extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedState) { return inflater.inflate(R.layout.fragment_list, container, false); } public void setQuake(Quake quake, AdapterView.OnItemClickListener listener) { final ListView lv = (ListView) getView().findViewById(R.id.list); lv.setAdapter(new QuakeInfoAdapter(getActivity(), quake)); lv.setOnItemClickListener(listener); } }