List<String> MyAppNameList = new ArrayList<String>();
  List<String> MyAppList = new ArrayList<String>();
  List<String> MyNewAppList = new ArrayList<String>();
  MyAppNameList.add("7");
  MyAppNameList.add("6");
  MyAppNameList.add("2");
  MyAppNameList.add("1");
  MyAppNameList.add("3");
  MyAppNameList.add("4");
  MyAppNameList.add("5");
  MyAppNameList.add("8");
  MyAppList.add("app1");
  MyAppList.add("app2");
  MyAppList.add("app3");
  MyAppList.add("app4");
  MyAppList.add("app5");
  MyAppList.add("app6");
  MyAppList.add("app7");
  MyAppList.add("app8");
  
  Map<String, String> m = new TreeMap<String, String>();
  for (int i = 0; i < MyAppNameList.size(); ++i)
   m.put(MyAppNameList.get(i), MyAppList.get(i));
  MyAppList.clear();
  MyAppList.addAll(m.values());
  for (int i = 0; i < MyAppNameList.size(); i++) {
   Toast.makeText(getApplicationContext(), "" + MyAppList.get(i),
     Toast.LENGTH_SHORT).show();
  }
沒有留言:
張貼留言