Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

listview isn't showing with ProgressFragment #16

Closed
winsonlim opened this issue Jan 24, 2014 · 1 comment
Closed

listview isn't showing with ProgressFragment #16

winsonlim opened this issue Jan 24, 2014 · 1 comment

Comments

@winsonlim
Copy link

Hey, firstly nice work with the fragment! It is really helpful.

However, I want to ask why is my listview not showing up when extending ProgressFragment? I can't use a ListFragment as I have 2 listviews in that view, and it's rather a customised fragment..

@johnkil
Copy link
Owner

johnkil commented Apr 29, 2014

Hi, @winsonlim! I had no problems, maybe you did something wrong.

Attached sample code:

public class DoubleListFragment extends ProgressFragment {

    private String[] mCars = {
            "Audi",
            "BMW",
            "Chery",
            "Chevrolet",
            "Chrysler",
            "Citroen",
            "Daewoo",
            "Dodge",
            "Fiat",
            "Ford",
            "Honda"
    };

    private String[] mAndroid = {
            "Cupcake",
            "Donut",
            "Eclair",
            "Froyo",
            "Gingerbread",
            "Honeycomb",
            "Ice Cream Sandwich",
            "Jelly Bean",
            "KitKat"
    };

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        setContentShown(false);
        setContentView(R.layout.fragment_double_list);
        final ListView listView1 = (ListView) getView().findViewById(R.id.list1);
        final ListView listView2 = (ListView) getView().findViewById(R.id.list2);
        Handler handler = new Handler();
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                listView1.setAdapter(
                        new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_1, mCars));
                listView2.setAdapter(
                        new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_1, mAndroid));
                setContentShown(true);
            }
        }, 3000);
    }
}

@johnkil johnkil closed this as completed Apr 29, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants