private void loadApps(){
  Intent i=new Intent(Intent.ACTION_MAIN,null);
  i.addCategory(Intent.CATEGORY_LAUNCHER);
switch (tabId) {
case 1:
    LinkedList<String> ordered_apps=sqlHelper.getAllApps();
  List<ResolveInfo> availableActivities=mPacMan.queryIntentActivities(i,0);
for (int j=0; j < availableActivities.size(); j++) {
  ResolveInfo ri=availableActivities.get(j);
  if (ordered_apps.contains(ri.activityInfo.packageName)) {
    continue;
  }
  AppDetail app=new AppDetail();
  app.label=ri.loadLabel(mPacMan);
  app.name=ri.activityInfo.packageName;
  app.icon=null;
  appsList.add(app);
}
break;
default :
LinkedList<String> app_names=sqlHelper.getAppsForTab(tabId);
for (String app_name : app_names) {
boolean success=addAppToList(app_name);
if (!success) {
Log.d("DB","Removing app " + app_name + " from db");
sqlHelper.removeAppFromTab(app_name,this.tabId);
}
}
if (app_names.size() == 0) {
showEmptyCategoryNotice();
}
}
}

private void loadApps ( ) { Intent i = new Intent ( Intent . ACTION_MAIN , null ) ; i . addCategory ( Intent . CATEGORY_LAUNCHER ) ; switch ( tabId ) { case 1 : LinkedList < String > ordered_apps = sqlHelper . getAllApps ( ) ; List < ResolveInfo > availableActivities = mPacMan . queryIntentActivities ( i , 0 ) ; for ( int j = 0 ; j < availableActivities . size ( ) ; j ++ ) { ResolveInfo ri = availableActivities . get ( j ) ; if ( ordered_apps . contains ( ri . activityInfo . packageName ) ) { continue ; } AppDetail app = new AppDetail ( ) ; app . label = ri . loadLabel ( mPacMan ) ; app . name = ri . activityInfo . packageName ; app . icon = null ; appsList . add ( app ) ; } break ; default : LinkedList < String > app_names = sqlHelper . getAppsForTab ( tabId ) ; for ( String app_name : app_names ) { boolean success = addAppToList ( app_name ) ; if ( ! success ) { Log . d ( "DB" , "Removing app " + app_name + " from db" ) ; sqlHelper . removeAppFromTab ( app_name , this . tabId ) ; } } if ( app_names . size ( ) == 0 ) { showEmptyCategoryNotice ( ) ; } } }
loads apps from the database
