Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

How can I let my user create a shortcut to an app, into my app (like a launcher)?

OP nex7er

27th January 2014, 01:25 AM   |  #1  
OP Senior Member
Flag Bergen
Thanks Meter: 163
 
440 posts
Join Date:Joined: Feb 2008
More
I can't for the life of me find ANYTHING written about how to create a shortcut to an app. All over stackoverflow it's just about having ones app get created as a shortcut onto users own launcher.

I want the user to be able to click my button which opens a dialog, in where the user can then select an app of their choosing, rename the shortcut and lastly hit the "Ok" button which should then let that app sit in my apps fragment until the user decides to remove it.

How would I go about doing this?
27th January 2014, 11:35 AM   |  #2  
SimplicityApks's Avatar
Senior Member
Flag Aachen
Thanks Meter: 337
 
348 posts
Join Date:Joined: May 2013
More
Quote:
Originally Posted by nex7er

I can't for the life of me find ANYTHING written about how to create a shortcut to an app. All over stackoverflow it's just about having ones app get created as a shortcut onto users own launcher.

I want the user to be able to click my button which opens a dialog, in where the user can then select an app of their choosing, rename the shortcut and lastly hit the "Ok" button which should then let that app sit in my apps fragment until the user decides to remove it.

How would I go about doing this?

To get a list of all installed applications, use
Code:
 final PackageManager pm = getPackageManager(); //get a list of installed apps.
 List<ApplicationInfo> packages = pm.getInstalledApplications(PackageManager.GET_META_DATA);
To start them just create a new Intent(packageName) and start it with startActivity(intent);
The Following User Says Thank You to SimplicityApks For This Useful Post: [ View ]
27th January 2014, 11:38 AM   |  #3  
OP Senior Member
Flag Bergen
Thanks Meter: 163
 
440 posts
Join Date:Joined: Feb 2008
More
Quote:
Originally Posted by SimplicityApks

To get a list of all installed applications, use

Code:
 final PackageManager pm = getPackageManager(); //get a list of installed apps.
 List<ApplicationInfo> packages = pm.getInstalledApplications(PackageManager.GET_META_DATA);
To start them just create a new Intent(packageName) and start it with startActivity(intent);

Hey, thanks for the quick reply! That works wonders! Half way already. Thanks a lot.

Now how would I go about having it so that the apps I select in the list of apps stay selected, then upon an onClick of a button they get returned to my fragment (activity)? And to have them saved after that, would I need to read up on sqlite?
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes