Go Back   Android Forums > Android Development > Application Development
Application Development Dev lounge for our application developers.

Get excited for the Samsung Galaxy S5! Find everything you need and discuss it in our Galaxy S5 Forum!

test: Reply
 
LinkBack Thread Tools
Old September 15th, 2010, 09:16 PM   #1 (permalink)
New Member
Thread Author (OP)
 
xmiasma's Avatar
 
Join Date: Dec 2009
Posts: 13
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Default Creating shortcut problems

I have found a bunch of resources online about how to create and shortcut on the home screen but for the life of me i cant get any of them to work. Heres a snippet of what im doing to create my shortcut

Code:
Intent i = new Intent();
        i.setClassName(this, this.getClass().getName());
        
        i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        
        Intent intent = new Intent();
        intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, i);
        intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "eXorg");
        intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource.fromContext(this, R.drawable.icon));
        intent.setAction(Intent.ACTION_CREATE_SHORTCUT);
        this.sendBroadcast(intent);
        setResult(RESULT_OK, intent);
and the manifest

Code:
 <activity android:name=".MainActivity"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter>
      			<action android:name="android.intent.action.CREATE_SHORTCUT" />
      			<category android:name="android.intent.category.DEFAULT" />
    		</intent-filter>
        </activity>
        

    </application>
    
    <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
     *** ^^^ not sure if this is needed or is even in the right spot ******
Any help would be awesome. thanks guys.

xmiasma is offline  
Reply With Quote
sponsored links
Old September 22nd, 2010, 06:43 PM   #2 (permalink)
New Member
Thread Author (OP)
 
xmiasma's Avatar
 
Join Date: Dec 2009
Posts: 13
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Default

seriously no one has any idea on what to do? theres been like 55 ppl that viewed this thread.
xmiasma is offline  
Reply With Quote
Old September 28th, 2010, 08:33 PM   #3 (permalink)
New Member
 
Join Date: Sep 2010
Posts: 1
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Default

What you need is:

intent.setAction("com.android.launcher.action.INST ALL_SHORTCUT");
fourplay56 is offline  
Reply With Quote
Reply


Go Back   Android Forums > Android Development > Application Development
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 04:52 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.