Android Open Source - android-listview-custom-view Item List Fragment






From Project

Back to project page android-listview-custom-view.

License

The source code is released under:

MIT License

If you think the Android project android-listview-custom-view 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

package com.bignerdranch.android.listitemviewdemo;
//  w w w  . ja v  a 2  s .  c om
import android.os.Bundle;
import android.support.v4.app.ListFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import java.util.ArrayList;

public class ItemListFragment extends ListFragment {

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View v = super.onCreateView(inflater, container, savedInstanceState);

        ArrayList<Item> items = new ArrayList<Item>();
        for (int i = 0; i < 100; i++) {
            String url = String.format("http://www.google.com/image/%d.png", i);
            String title = String.format("Item %d", i);
            String description = String.format("Description of Item %d", i);
            Item item = new Item(url, title, description);
            items.add(item);
        }

        setListAdapter(new ItemAdapter(getActivity(), items));

        return v;
    }
}




Java Source Code List

com.android.debug.hv.ViewServer.java
com.bignerdranch.android.listitemviewdemo.ItemAdapter.java
com.bignerdranch.android.listitemviewdemo.ItemListFragment.java
com.bignerdranch.android.listitemviewdemo.ItemView.java
com.bignerdranch.android.listitemviewdemo.Item.java
com.bignerdranch.android.listitemviewdemo.ListActivity.java