5,596,925 Members 48,261 Now Online
XDA Developers Android and Mobile Development Forum

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

Tip us?
 
nex7er
Old
#1  
Senior Member - OP
Thanks Meter 163
Posts: 435
Join Date: Feb 2008
Location: Bergen
Default How can I let my user create a shortcut to an app, into my app (like a launcher)?

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?
 
SimplicityApks
Old
#2  
SimplicityApks's Avatar
Senior Member
Thanks Meter 277
Posts: 252
Join Date: May 2013
Location: Aachen
Quote:
Originally Posted by nex7er View Post
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: [ Click to Expand ]
 
nex7er
Old
#3  
Senior Member - OP
Thanks Meter 163
Posts: 435
Join Date: Feb 2008
Location: Bergen
Quote:
Originally Posted by SimplicityApks View Post
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?
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes