0

So I have a button, when its pressed once it opens the calendar application, however some of my other other devices don't have the calendar I have described in the method so I have created an onLongCLick method, so when a user long clicks the button, they get to choose which app they want to launch. Once they choose the app, its set. So when they click button normally it launches the app they chose. How can I go about achieving this ??

Thanks for your time.

My longclick methodC

// Hold (onlongclick) to initiate choose app to launch

date_launch.setOnLongClickListener(new OnLongClickListener() {
    public boolean onLongClick(View arg0) {
            // choose app to launch and save it
        return true;                         
    }
});
Robin
  • 577
  • 1
  • 7
  • 13

1 Answers1

0
  • Find the available activities via PackageManager.

    public abstract List<ResolveInfo> queryIntentActivities (Intent intent, int flags)

  • Create a dialog for choosing apps.

  • Once the app is chosen, launch the package in onClick.
yushulx
  • 11,695
  • 8
  • 37
  • 64
  • could you supply a sample code example or a link to something where I can obtain more info on this? – Robin May 24 '14 at 06:57
  • You can refer to this: [How to get a list of installed android applications and pick one to run](http://stackoverflow.com/questions/2695746/how-to-get-a-list-of-installed-android-applications-and-pick-one-to-run/2696617#2696617) – yushulx May 26 '14 at 06:38