I am trying to put a dynamic value in the launcher icon of android, as number of messages will be displayed in the message icon. As the icon is static and initialised before the application starts, Is there any way to achieve this??
For Android Launcher Icon you can't. It is impossible. (Or by Making your own launcher) The only one thing is you have to make a Android-Widget for this purpose. Which looks like a application icon. But it will act as a widget.
Also Make a dynamic launcher icon
simple answer is you can't do it also this question says the same. But there may be advance tricky methods/ways that I'm not aware of.
But you may try and develop widgets that changes dynamically.
You have to design your icon as a selector instead of drawable. Have a look at this.
You cant update because its related to manifest.xml stuff only possible with software upgrade.
Related
I'm designing a custom Android 4.0 (ICS) device for special purpose.
One of the things I'm looking for is a way to make the Android Launcher, when other activities were previously running, show the last running activity as a transparent, dimmed background, with the launcher icons and widgets on top.
What I'm looking for, is something like this: How do I create a transparent Activity on Android?, except as a modification to Launcher2. I guess I can apply a similar style to the launcher as proposed in that SO, but what about the wallpaper?
AFAIU, the wallpaper is rendered by a separate service, and I still want it rendered if there are no other activities behind the launcher.
Any tips?
I figured this one out myself eventually. It turned out pretty simple.
Just modify the theme as suggested in the mentioned SO-article, and simply change inheritance from the Wallpaper-enabled theme.
Also, there were a small code-snippet that was reactivating the wallpaper. Switch that out, and I've now got a transparent launcher, that shows what's going on behind it.
I know that we can set it through manifest file using android:icon attribute.But how can we set it in java code?
It doesn't make sense to set it programmatically, the launcher has to display the application icon when the application isn't active.
If you take a look at How to change an application icon programmatically in Android?, you will find a comment, which links to this sample code in the Android developer API demos: LaucherShortcuts.
It seams that the Activity can create a LauncherShortcut, which can have a different icon (see function setupShortcut()). If you want the user to select the Icon, you have to display a list of icons when creating the shortcut. But again, it is a shortcut. In the list of application the original icon appears.
I dont think the launcher icon can be set programatically.
It doesn't seem possible, but I was hoping someone may be aware of a way. Can the label of the application (the one defined in the manifest file by android:label="#string/app_name") be set from code?
That is read-only, AFAIK.
If your objective is to change the title bar of your activities, you can call setTitle().
I mostly use this to change actionBar's text pragmatically in onCreate() method....very easy!
getSupportActionBar().setTitle("yourString");
I used:
this.setTitle("YourString");
Could anyone tell me either what this widget is or how it could be recreated? I'm having to port over a iPhone app, and my boss wants me to make it look as similar as possible, but while using android controls. Here is a picture of it in Android:
http://cdn3.staztic.com/screenshots/android-swim-32-2.jpg
Thanks!
It is not a standard thing, but for this purpose, there is a: QuickAction dialog.
this can be done with a PopupWindow (it can also be shown as dropdown) where the background is a custom nine-patch file and the content is a listview (or any other view that fits your needs).
I'm sure that GreenDroid Library can do this but I don't know the name of the class to use
i am looking to add a home screen to my app sort of like facebook app has with little icons and labels under them (Pictures, Chat, Wall, etd). I would like to go this route as opposed to adding bunch of tabs on top.
My question is how i can get it done with Android API? I know i could probably make these icons with labels within but perhaps there is a way to make it in a native way.
Thanks! :)
Use regular Button/ImageButtons, but with android:background="#null". If you want the icons to change while they're being pressed or selected, use StateList Drawables.
http://developer.android.com/guide/topics/resources/drawable-resource.html#StateList
Have you considered looking at the Facebook API and SDK for Android? They also provide functionality to create Facebook style dialogs aswell. Read-up more about the Facebook SDK here
I would suggest using a RelativeLayout and defining the looks of the home screen in XML. I would use ImageButtons like mentioned by gngr44 and then make the text labels from TextViews. You can align them beneath the buttons in XML and RelativeLayout is probably best.
The Android Developers site has a lot of useful info to get started. Like this link: http://developer.android.com/guide/topics/ui/index.html