Creating a "shortcut" on home screen from your app


Last Updated:

  1. xmiasma

    xmiasma Member This Topic's Starter

    Joined:
    Dec 28, 2009
    Messages:
    13
    Likes Received:
    0
    hey guys,

    so im trying to create a organizer app and basically i need the functionality to create a shortcut which will hold other shortcuts (to real apps the user chooses)

    so basically it could be imagined like this:

    main App menu - choose a name, set up apps that will be held

    -shortcut created on home screen-

    this shortcut basically holds the other apps you want run.

    so my question right now is basically how would i (in code) be able to create an instance of my shortcut object and place it on the home screen. i dont know if it will work if i consider it a widget or something.

    I havent really found anything about it online so i figured id ask. maybe someone can give me some ideas how to implement this.

    thanks
     

    Advertisement
  2. t0ast3d

    t0ast3d Well-Known Member

    Joined:
    Aug 27, 2010
    Messages:
    372
    Likes Received:
    75
    You make it sound like your just trying to create a folder..

    That's all I got from the post anyways
     
  3. xmiasma

    xmiasma Member This Topic's Starter

    Joined:
    Dec 28, 2009
    Messages:
    13
    Likes Received:
    0
    yeah it kinda is like that but its just gonna be a icon on your screen and when you click it its gonna have like an animation of all apps its holding kinda spreading out and you can click from there. its just a nicer looking folder pretty much.

    but any ideas about running apps from there? ive been looking at intents but i need to grab the actual name the app to be run and then use that but i dont know how that will work.
     
  4. xmiasma

    xmiasma Member This Topic's Starter

    Joined:
    Dec 28, 2009
    Messages:
    13
    Likes Received:
    0
    so im getting close but is it possible to run an application only from knowing its source directory?


    [SOLVED] i figured out the launching another app through my app problem. For anyone else who might come across this or is having the same problem here how i solved it.

    You need to make an instance of the PackageManager class. This has a method called getInstalledApplications. You pass it a flag whether u want uninstalled apps too but 0 works for just installed apps. This returns you a list of "applicationInfo" from there its simple. Each applicationInfo object has a "packagename" field all you do to run that is

    Intent myIntent = new Intent();
    myIntent.setPackage(list[#].packagename);
    startActivity(myIntent);

    bingo. Should have researched a bit more before jumping on here but oh well.
     

Share This Page

Loading...