Android Question Translate from Java...

vfafou

Well-Known Member
Licensed User
Longtime User
Hello!
Somebody has given to me the following working code from Eclipse:
B4X:
Intent i;
           PackageManager manager = getPackageManager();
           try {
                   i = manager.getLaunchIntentForPackage("com.comp.intt123");
                   if (i == null)
                      throw new PackageManager.NameNotFoundException();
                   i.addCategory(Intent.CATEGORY_LAUNCHER);
                   i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                   i.setAction("com.comp.intt123.navitocoords");
                   i.putExtra("Lon", "22.955933");
                   i.putExtra("Lat","40.632454");
                   startActivity(i);
                } catch (PackageManager.NameNotFoundException e) {

                }
                try {
                        i = manager.getLaunchIntentForPackage("com.comp.int12345");
                        if (i == null)
                           throw new PackageManager.NameNotFoundException();
                        i.addCategory(Intent.CATEGORY_LAUNCHER);
                        i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                        i.setAction("com.comp.intt123.navitocoords");
                        i.putExtra("Lon", "22.955933");
                        i.putExtra("Lat","40.632454");
                        startActivity(i);
                 } catch (PackageManager.NameNotFoundException e) {

My problem is: how to translate to B4A the following two lines?
B4X:
i.addCategory(Intent.CATEGORY_LAUNCHER);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

Thank you in advance!
 
Top