Code example for ListView

Methods: getItemAtPosition

0
    protected SingleTypeAdapter<News> createAdapter(List<News> items) {
        return new NewsListAdapter(getActivity().getLayoutInflater(), items);
    } 
 
    public void onListItemClick(ListView l, View v, int position, long id) {
        News news = ((News) l.getItemAtPosition(position));
 
        startActivity(new Intent(getActivity(), NewsActivity.class).putExtra(NEWS_ITEM, news));
    } 
 
    @Override 
    protected int getErrorMessage(Exception exception) {
        return R.string.error_loading_news; 
    } 
}