java - Convert String Objects in ArrayList to Array of Arrays -


I have a menu structure that lists the preferred configuration items.

Visual example in the Android SDK is an example example I would like to use called ExpandableList1.java . To use the scene, I do not have to pass string [] group structure and string [] [] children structure

. Problems changing the list of a string by using groups.toArray from menu objects. The problem I have is to convert the favorite object to the array of arrays. The favorite items are the array items contained in the menu object.

The relevant parts of the code have been pasted here before we say MyExpandableListAdapter with an array of stars:

  @Orride Creates a public void form (bundled saved instenstate ) {Super.onCreate (SavedInstanceState); ArrayList & LT; String & gt; Favorite Menu = Men.ManualistGetformatMan FlowPath (); MAdapter = New MyExpandableListAdapter (Favorite Menuist); SetListAdapter (mAdapter); RegisterForContextMenu (getExpandableListView ()); }   

The next MyExpandableListAdapter and this is the manufacturer, where the array conversion occurs:

  Public class MyExpandableListAdapter BaseExpandableListAdapter {// Sampling data sets the extension. Children [i] include children (groups of strings []) for groups [ii]. // Private string [] group = {"people name", "dog name", "cat name", "fish names"}; Private string [] group; Private string [] [] Children = {{"Arnold", "Barry", "Chuck", "David"}, {"Ace", "Bandit", "Cha-Cha", "Deuce"}, {"Fluffy "," Snuggles "}, {" goldie "," bubbles "}}; Public My Expandable List Adapter (Arreelist & lt; String & gt; Group) {this.groups = groups.toArray (new string [groups.size ()]); }   

As you can see in the code snippet above, there is no problem with string [] groups . My idea is to iterate over menu items, remove favorites list, and then? How do I create a dynamic array in Java, because the array sizes have been fixed so much.

Here are my external loops in my mind:

  Public Arrayist & lt; FavoritesObject & gt; GetFavouriteItems () {ArrayList & lt; Favorite object & gt; Favorite = new array list & lt; Favorite object & gt; (); (Menu object m: all manual lists) {if (m.isFavourite) {favouritesList.add (m.getFavouriteItems ()); }} List of Returns; For example, suppose you have a  list  menu>    

and Each menu is a list of favorites , I believe you want it:
  string [] [] children = new string [menus.size ()] []; For (int i = 0; i    

Comments