One problem you can have on Android as a user and/or Delphi XE7 Firemonkey developer is having to swipe through pages and pages of icons to find that app you want to launch because you have so many apps installed on the device. One solution to this problem is demonstrated in this demo app called AppList. Basically it has a filterable list of all of the apps installed on your phone which easily allows you to find and launch the right app. You can type in a few letters and launch the app Instead of swiping through pages and pages of icons to find what you want. It acts similar to how the Start|Run search functionality works on Windows. It cost me $100 to have this app built through oDesk. There are three different pieces of functionality demonstrated in the app. These pieces are reading the list of installed apps on the device, loading and caching the icon for each app, and launching the app itself. The functionality in this app is Android specific so it won’t compile for the other platforms (Windows, IOS, or Mac OSX) because it uses the Android specific JNI. This code should also work in Appmethod. Here is the function for launching an app on Android:

procedure TformMain.OpenApp(PackageName, AppName : JString); var Intent : JIntent; NativeComponent : JComponentName; begin Intent := TJIntent.Create; Intent.setAction(TJIntent.JavaClass.ACTION_MAIN); Intent.addCategory(TJIntent.JavaClass.CATEGORY_LAUNCHER); NativeComponent := TJComponentName.JavaClass.init(PackageName, AppName); Intent.addFlags(TJIntent.JavaClass.FLAG_ACTIVITY_NEW_TASK or TJIntent.JavaClass.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); Intent.setComponent(NativeComponent); SharedActivity.startActivity(Intent); end; 1 2 3 4 5 6 7 8 9 10 11 12 13 procedure TformMain . OpenApp ( PackageName , AppName : JString ) ; var Intent : JIntent ; NativeComponent : JComponentName ; begin Intent : = TJIntent . Create ; Intent . setAction ( TJIntent . JavaClass . ACTION_MAIN ) ; Intent . addCategory ( TJIntent . JavaClass . CATEGORY_LAUNCHER ) ; NativeComponent : = TJComponentName . JavaClass . init ( PackageName , AppName ) ; Intent . addFlags ( TJIntent . JavaClass . FLAG_ACTIVITY_NEW_TASK or TJIntent . JavaClass . FLAG_ACTIVITY_RESET_TASK_IF_NEEDED ) ; Intent . setComponent ( NativeComponent ) ; SharedActivity . startActivity ( Intent ) ; end ;

Here is the function for listing the apps installed on the device:

function TformMain.GetActivityAppList: JList; var tempList : JList; Intent : JIntent; Manager : JPackageManager; begin Intent := TJIntent.Create; Intent.setAction(TJIntent.JavaClass.ACTION_MAIN); Intent.addCategory(TJIntent.JavaClass.CATEGORY_LAUNCHER); Manager := SharedActivity.getPackageManager; tempList := nil; tempList := Manager.queryIntentActivities(Intent, 0); Result := tempList; end; 1 2 3 4 5 6 7 8 9 10 11 12 13 14 function TformMain . GetActivityAppList : JList ; var tempList : JList ; Intent : JIntent ; Manager : JPackageManager ; begin Intent : = TJIntent . Create ; Intent . setAction ( TJIntent . JavaClass . ACTION_MAIN ) ; Intent . addCategory ( TJIntent . JavaClass . CATEGORY_LAUNCHER ) ; Manager : = SharedActivity . getPackageManager ; tempList : = nil ; tempList : = Manager . queryIntentActivities ( Intent , 0 ) ; Result : = tempList ; end ;

And you’ll have to download the demo itself to get the code for reading and caching the icon for each app.

Download the full source code for the Android app list launcher for Delphi XE7 Firemonkey.