Help with Adding Shortcuts to HomeScreen - Android Studio

so i have created 2 different app lists one which stores the app drawer and this one works fine i can displa y apps and launch them. Im using the same process to create a app list for shortcuts but instead of a gridview im using a listview in a popup .. This all works fine displays the list fine. when i click on it the onclicklistener works as well. now my problem is adding the shortcuts to my home screen inside my launcher not the android launcher but my own custom launcher. which is all part of the same project.
the code below has been changed multiple times and now im just trying to get it where it creates a shortcut for my app which this is not working either
the astro_label,icon,name are the ones i want to use to grab the information from the item clicked those return values just fine.
btw mContext is Context mContext;
any help would be grant thank you
PHP:
//Code for creating Shortcut to home screen
/* string astro_label = pacsForAdapter[pos].label;
string astro_icon = pacsForAdapter[pos].icon;
string astro_name = pacsForAdapter[pos].name;
*/
// a Intent to create a shortCut
Intent shortcutintent = new Intent("com.android.launcher.action.INSTALL_SHORTCUT");
//repeat to create is forbidden
shortcutintent.putExtra("duplicate", false);
//set the name of shortCut
shortcutintent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "MY APP");
//set icon
Parcelable icon = Intent.ShortcutIconResource.fromContext(mContext.getApplicationContext(), R.drawable.ic_launcher);
shortcutintent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, icon);
//set the application to launch when you click the icon
shortcutintent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, new Intent(mContext.getApplicationContext() , HomeActivity.class));
//sendBroadcast,done
mContext.sendBroadcast(shortcutintent);

Made a few changes to code now it adds the a standard ic_launcher icon with the name and label of the app i click on to add . and it also launches the app if shorcut is clicked
the icon part i will do soon but my biggest issue is my app is a launcher why would it add the shortcut to the other launcher and not mine.
I have the default launcher on the tablet as well as mine i choose always for mine home button keeps my launcher going so why would it create the icon on the other launcher and not mine
using this code
PHP:
Intent launchIntent = pmForListener.getLaunchIntentForPackage(pacsForAdapter[pos].name);
launchIntent.setAction(Intent.ACTION_MAIN);
Intent addIntent = new Intent();
addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, launchIntent);
addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, pacsForAdapter[pos].label.toString());
addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,
Intent.ShortcutIconResource.fromContext(mContext, R.drawable.ic_launcher));
addIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
mContext.sendBroadcast(addIntent);

Related

[Q] Explicitly execute TWauncher

Hi SGS adv users!
I'm planning to replace my default home app with LauncherPro or Zeam, but I'd like to keep the option to reach the standard SGS TouchWiz Application Drawer (with positionable-apps in grids and horizontal scroll)
As any other launcher has its own drawer, I couldn't do that without a link or a shortcut icon. Otherwise I should change every time the default home, which is very uncomfortable.
Thanks

[Launcher 7] Folder Shortcuts.

Have decided to do a small tutorial on adding folder shortcuts to the excellent Launcher 7 home screen replacement by Timo Kujala.
I have used Desktop VisualizeR to create the shortcut icons and Apps Organizer for the pop-ups but any suitable shortcut app will do.
First of all download and install your shortcut app then set up your folder shortcuts.
Next create the folder widget in Desktop VisualizeR on the home screen: menu > Add widget > Desktop VisualizeR > 1x1 Small (for square icons) then choose the tile properties and Create tile.
Finally click on the resulting widget, choose your icon and using Select Action > Other > 'shortcut app' select shortcut. Define other properties and OK.
Done.
Edit
Been having a look at it and it seems that between them Launcher 7 and Desktop VisualizeR don't really handle the use of 2x1 icons for widgets that well.
The trick is to do it as previously explained but when you get to choosing the widget layout in DV.. choose 4x4. In L7 then choose 2x1 tile size, whatever background but for the next option make sure you leave Full-tile widget unticked and then Create tile.
You then have to resize your 2x1 icon, size don't seem to be too important but for whatever your 2x1 size is you need to square it off. For example if you're using a 230x120 image you need to resize it to 230x230 (i would save it to .png format just to be on the safe side). If it doesn't come out right then just play around with the original icon size
For resizing on Windows platform i use BIMP Lite which works really well for me.
The other steps would be the same as before and this method is obviously only for an horizontal tile.
Launcher Shortcuts
To link to other launchers from Launcher 7 try this:
Install Desktop VisualizeR -> Go to L7 and Add Widget. Choose DV and add widget for icon as per the above.
Go to L7 desktop and click on the resulting widget, click on Select Icon and choose icon image.
To link to alternative launcher click on Select Action -> Other -> Activities and that will give you a list of all the apps on your phone.
Scroll to your chosen launcher and click on it, this will show you a drop-down list of all the activities for that app. the link you need is usually the first one and in the case of Launcher Pro is 'com.fede.launcher.Launcher' select that.
This will take you back to DV where you can choose whether you want an icon label or not and so on... ok this and you will go back to L7 home screen. If the widget image is not displayed then you just need to refresh the home screen.
Hope this helps.
Update:
Live folders now added to Donate version of app from market. Please support the dev and further development.
HTC Legend Rooted & S-Off, CyanogenMod V7.0 (Gingerbread), 150 LCD Density.
I cant get the images to fill out the whole tile...
Fekke said:
I cant get the images to fill out the whole tile...
Click to expand...
Click to collapse
Are you using Desktop VisualizeR to create the widget's icon (1x1 Small)? What is the icon source you're using? and are you enabling the tick for 'Full-tile widget'. You also need to be creating a widget rather than long pressing the icon in the app drawer.
If you're doing all that and still not working then let me know exactly what you're doing and what apps you're using and i'll try to help further.
Thanks and hope that helps.
t3xtid said:
Are you using Desktop VisualizeR to create the widget's icon (1x1 Small)? What is the icon source you're using? and are you enabling the tick for 'Full-tile widget'. You also need to be creating a widget rather than long pressing the icon in the app drawer.
If you're doing all that and still not working then let me know exactly what you're doing and what apps you're using and i'll try to help further.
Thanks and hope that helps.
Click to expand...
Click to collapse
So its just the 1x1 widget im going to use? Becouse i wanne make an 2x1 widget. But the images aint getting in the whole tile. I have checked so the resolution of them is correct
Fekke said:
So its just the 1x1 widget im going to use? Becouse i wanne make an 2x1 widget. But the images aint getting in the whole tile. I have checked so the resolution of them is correct
Click to expand...
Click to collapse
Sorry didn't realize you were doing 2x1. Been having a look at it and it seems that between them Launcher 7 and Desktop VisualizeR dobn't really handle the use of 2x1 icons for widgets that well.
The trick is to do it as previously explained but when you get to choosing the widget layout in DV.. choose 4x4. In L7 then choose 2x1 tile size, whatever background but for the next option make sure you leave Full-tile widget unticked and then Create tile.
You then have to resize your 2x1 icon, size don't seem to be too important but for whatever your 2x1 size is you need to square it off. For example if you're using a 230x120 image you need to resize it to 230x230 (i would save it to .png format just to be on the safe side). If it doesn't come out right then just play around with the original icon size
For resizing on Windows platform i use BIMP Lite which works really well for me.
The other steps would be the same as before and this method is obviously only for an horizontal tile.
I'll add these extra steps (done on a HTC Desire HD) to the original post but good luck and hope it works for you.
Great idea .. thanks for sharing
Sent from my Nexus One using Tapatalk
help
im having trouble with this. im using app organizer and desktop visualizer exactly as intruscted.....when i tap the tile the folder works n all. but the tile still has the desktop visualizer picture and wont change
marco082892 said:
im having trouble with this. im using app organizer and desktop visualizer exactly as intruscted.....when i tap the tile the folder works n all. but the tile still has the desktop visualizer picture and wont change
Click to expand...
Click to collapse
The only thing i can think of is you just need to refresh the home screen.. that issue should be fixed in the new update of Launcher 7 (1.0.0.81). If it's not that that then i'm stumped cos you can't create the widget without defining the image and action.
Let me know if there's any change.
i'll wait for the update before i jump in...
Hi to all,
anyone knows how to edit existing folder with apps? I have created one folder with apps, and now i can only add this one folder to the tile (main screen). I cant seem to edit which apps are inside the folder neither i can delete this folder. When i choose "Add special tile-> Folder tile" i can just choose this one folder i have created. Help!
What you need is Menu -> Launcher7 settings and swipe across to the Folders tab. From there you can add a new folder or edit an existing folder by clicking on it. Hope that's what you're looking for
What you need is Menu -> Launcher7 settings and swipe across to the Folders tab. From there you can add a new folder or edit an existing folder by clicking on it (long press to remove). Hope that's what you're looking for
What you need is Menu -> Launcher7 settings and swipe across to the Folders tab. From there you can add a new folder or edit an existing folder by clicking on it (long press to remove). Hope that's what you're looking for
Sorry for messing up the thread.. my bad.
Dude, you saved my life... it was making me CRAZY having the picture 1mm too small ha ha you know how these little things get under your skin.
Anyway, works a treat!

MIUI and Desktop Visualizer

Ok, so I wanted a better email app than the stock MIUI one, and everyone keeps recommending K9 mail. Thing is, I hate the app icon for it. I worked out that I should be able to use Desktop Visualizer to create a shortcut on the desktop which points to K9, but uses another icon.
Thing is I can create a widget using DV (Long press on screen, select DVwidget etc), however I can't place widgets in the launcher bar. I tried opening the DV app and trying to create a shortcut that way, but when I hit 'Ok' to complete the operation, nothing happens. It just returns to the homescreen and no shortcut is created.
To further complicate things I have had this work once. It just randomly appeared on the desktop a few minutes after creating it, and I was able to move that into the launcher. Now I want to change the icon (again) but as you can see, I'm not having much luck.
Am I missing something here? I know MIUI doesn't have shortcuts on it's desktop, but if that was the case I don't see how I could have got it to work at all?
Any thoughts?
CyanideJack said:
Any thoughts?
Click to expand...
Click to collapse
Yeah, i'm thinking how an app icon can invoke such a strong emotion as hate for it. Could we get a screenshot? Share the hate
I do agree that the icon is kinda ugly .
That is a terrible icon ...
Sent from my HTC Incredible S using xda premium
Lol...
Yeah, it's pretty....special...
U can't put Widgets in dock for miui roms... Just Apps... Hope it helps...
Sent from my HTC Incredible S using Tapatalk
What i would suggest (this is what i used to do while using MIUI), is to use an application called "App Drawer" meant specially for MIUI.
Link t=1154299http://forum.xda-developers.com/showthread.php?t=1154299
it is only as it states, an app drawer like all regular android phones.
This way you will have a dedicated app drawer & this will help in not cluttering up your home screens.
All icons on your home screen can be inserted into a single folder as these are the actual apps & not shortcuts.
Deleting would mean uninstalling.
so use the app drawer, send the shortcuts to your home screen & use any app for changing the icon like the ones inbuilt in ADW, Nova launchers.
...or you could just swap out the k9 icon for one you like. Use a theme (or make a blank one if you're fond of default) and theme the app name icon with a mail icon (or any icon) you think is nice
theme mtz - icons folder - use a .png and name it com.fsck.k9.apk
(if that doesn't work, the real app name is com.fsck.k9-1.apk)
melissapugs said:
...or you could just swap out the k9 icon for one you like. Use a theme (or make a blank one if you're fond of default) and theme the app name icon with a mail icon (or any icon) you think is nice
theme mtz - icons folder - use a .png and name it com.fsck.k9.apk
(if that doesn't work, the real app name is com.fsck.k9-1.apk)
Click to expand...
Click to collapse
Awesome siggy

[Q] Refreshing Android Launcher and Home screens after applying a theme APK

I am working on customizing the android open source code's Launcher2 application. The modification I have brought to the Launcher2 application is such that, when I install an APK with some drawable resources , it would change the icons for some applications(browser, calculator and calendar) in Launcher screen and in home screen(if the application exists as shortcut) - as part of theming.
I have created a section in Settings application from which a user can apply new theme which would change these icons. While the user applies the new theme, a temp directory is created in Settings app which holds this newly applied icons. From this temp directory, Launcher app takes the icon resources and applies it to these applications on device reboot. But at the moment of applying the Themes from settings app, it does nothing in order that the Launcher app does some kind of refresh.
In a nutshell, the issue I have here is when I press the 'Change theme' button from my installed application, it does not change the icons immediately. Instead, I need to close the emulator and open it again in order to see the icons modified in Home and Launcher screens.
Why does this happen such that I need to restart the emulator to see the changed icons? What is the workaround I have for this? What are the classes and methods in ICS Launcher2 app, such that I can do some kind of refresh of Launcher app.
Any help in this regard would be much appreciated as I have been looking to fix this fr quite some days!!.
Regards, Anees

How to set app drawer hotspot to any UCCW icon

Hi,
I love the UCCW skins... but I cannot set the hotspot to any icon so that my Application Drawer is triggered on clicking it.
I can assign various application shortcuts as hotspots on any position but when I use any static text and need to trigger the app drawer rule on it... I cant find the way to do so...
please help what app/shortcut I assign to it
jitensetia said:
Hi,
I love the UCCW skins... but I cannot set the hotspot to any icon so that my Application Drawer is triggered on clicking it.
I can assign various application shortcuts as hotspots on any position but when I use any static text and need to trigger the app drawer rule on it... I cant find the way to do so...
please help what app/shortcut I assign to it
Click to expand...
Click to collapse
Even I was finding the shortcut but couldn't.. You have to download miui app drawer for that to assign it..
Press thanks if I helped you. :good:

Categories

Resources