A little context: I have a stable tutorials app on the market. Recently the users have been requesting some external sources where they can learn more. This question is regarding the solution I came up with.
I have an activity with a listview and a spinner on top.
The listview can be populated with up to 25 elements at once (should I make it lesser?) .... I want the spinner to have options like (1-25, 26-50, 51-75).
The default can be set to 1-25. Depending on what the user selects, I need to re-populate the listview accordingly. I reckon a two dimensional array would be the neatest. But I don't want to hinder the performance too.
Anyways, here's what I've done yet. I need to know how exactly should I update the listview elements in the Spinners OnClick.
  Spinner spinner;
    String path[] = {"Laptops","DesktopPC","Tablets","Add-Ons","Gaming"};
    String Laptops[] = {"Dell","Hp","Apple"};
    ListView lstView;
            lstView = (ListView) findViewById(R.id.listView1);
            ArrayAdapter<String> adapter = new ArrayAdapter<String> (Category.this, android.R.layout.simple_spinner_item, path );
            spinner = (Spinner) findViewById(R.id.spinner1);
            spinner.setAdapter(adapter);
            spinner.setOnItemClickListener(new OnItemClickListener() {
                @Override
                public void onItemClick(AdapterView<?> arg0, View arg1,
                        int arg2, long arg3) {
                    // TODO Auto-generated method stub
                    ArrayAdapter<String> lstAdapter = new ArrayAdapter<String>(getApplicationContext(), android.R.layout.simple_list_item_1, Laptops);
                    lstView.setAdapter(lstAdapter);
                    //lstView.refreshDrawableState();
                }
            });
Assume that I have to switch between the two arrays depending on the spinner selection.
Thank you for reading! If you require any more information, kindly ask :-)
