daily pastebin goal
64%
SHARE
TWEET

Untitled

a guest Mar 20th, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private String[] m1Array = new String[]{"Название"};
  2.  
  3.     private String[] m2Array = new String[]{"текст"};
  4.  
  5.     public void onCreate(Bundle savedInstanceState) {
  6.         super.onCreate(savedInstanceState);
  7.  
  8.         setContentView(R.layout.activity_main2);
  9.         setTitle("Locale Date");
  10.  
  11.         Map<String, String> map;
  12.         ArrayList<Map<String, String>> groupDataList = new ArrayList<>();
  13.         for (String name : m1Array) {
  14.             map = new HashMap<>();
  15.             map.put("nameName", name);
  16.             groupDataList.add(map);
  17.         }
  18.  
  19.         String groupFrom[] = new String[]{"nameName"};
  20.         int groupTo[] = new int[]{android.R.id.text1};
  21.  
  22.         ArrayList<ArrayList<Map<String, String>>> сhildDataList = new ArrayList<>();
  23.  
  24.         ArrayList<Map<String, String>> сhildDataItemList = new ArrayList<>();
  25.  
  26.  
  27.         сhildDataItemList = new ArrayList<>();
  28.         for (String resource : m2Array) {
  29.             map = new HashMap<>();
  30.             map.put("resourceName", resource);
  31.             сhildDataItemList.add(map);
  32.         }
  33.         сhildDataList.add(сhildDataItemList);
  34.  
  35.  
  36.         String childFrom[] = new String[]{"resourceName"};
  37.         int childTo[] = new int[]{android.R.id.text1};
  38.  
  39.         SimpleExpandableListAdapter adapter = new SimpleExpandableListAdapter(
  40.                 this, groupDataList,
  41.                 android.R.layout.simple_expandable_list_item_1, groupFrom,
  42.                 groupTo, сhildDataList, android.R.layout.simple_list_item_1,
  43.                 childFrom, childTo);
  44.  
  45.         ExpandableListView expandableListView = (ExpandableListView) findViewById(R.id.expListView);
  46.         expandableListView.setAdapter(adapter);
  47.     }
  48. }`
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top