I would like to display an integer (from 0 to 10,000) as an icon in my android notification bar (like battery doctor). I searched in the forum and the best solution seems to be creating 10,000 drawable images for each number....It's simply impossible isn't there any other way to do that with the new versions of android ?
Related
This question already has answers here:
How to display count of notifications in app launcher icon [duplicate]
(5 answers)
Closed 6 years ago.
Currently, the notifications within my app are working great but if there are multiple notifications, then the whole status bar will be filled with them. Instead, I am looking to have one notification and then update that notification with text in a circle overlaying the notification icon to show the number of items.
The image below is what I am trying to achieve:
How can I achieve this programatically? As I am assuming that this would be the 'small icon' in the Notification Builder yet the small icon only accepts int (a resource layout int). If this cannot be done with the 'small icon' how would I achieve this with the 'large icon' (bitmap) or even set the normal icon (large) as the app icon & the small icon as an incrementing number?
What you can do is to create a custom notification with a custom layout. That way you can control everything that will be present on the Notification in both normal and big view.
Please refer : https://developer.android.com/guide/topics/ui/notifiers/notifications.html#CustomNotification
I'm learning how to program for Android and i have a question.
How can i do my action bar like this (which elements i have to use, etc...) :
With the text at the middle and a logo instead of the pink "+"
(I took this pic from google design and i modified it a little bit)
In Android Studio go to File > Import Sample and type:
Floating Action Button Basic
This is an Google's project example of what you looking for.
Is there a way in ICS or Honeycomb to go completely full screen? I want the system UI completely gone! Currently what I do is:
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
getWindow().getDecorView().setSystemUiVisibility(View.STATUS_BAR_HIDDEN);
But this results in the Status Bar being replaced by really dim dots! I want it completely gone! Lets say for example I want to play a video or show a picture that takes up the whole screen. I'm okay with the status bar coming back on user interaction but I need it completely gone when there is no user interaction.
With the code above. I get the following look:
I want the dim dots gone as well and my video / image to be completely full screen.
This is not possible in Honeycomb, but has been added in API v14. Use:
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
See the more detailed answers over here (though I would use a Build.Version.SDK_INT check instead of the suggested reflection-based check for support):
Hide ICS back home task switcher buttons
As the previous poster Suggested, that is completely impossible without rooting your device and performing some somewhat dirty process kill operations. The reason for is that new Hardware (like a tablet, for instance) may not have hardware buttons for navigation - and so by hiding those buttons the User would have no means of doing things that they are supposed to be guaranteed to be able to do, like going to the home screen, or accessing device info. Whether or not you might agree with that reasoning, such is the API.
The last information I have is that you can use the black tape to cover it. That's the suggestion given by Chet Haase. Watch this google IO 2011 session Q&A starting at 53minutes
You want SYSTEM_UI_FLAG_HIDE_NAVIGATION . Keep in mind that since the soft navigation buttons are key to device experience this only hides the buttons until there is some user interaction. If you want to permanently hide them then rooting the device (as others have suggested) is the only way to go.
The flag was added as of Ice Cream Sandwich, API 14. Previous to 14 a flag STATUS_BAR_HIDDEN was added in Honeycomb, API 11 that had a similar function. Previous to that the soft navigation buttons didn't exist, so fullscreen modes were handled entirely by Themes (specifically Theme.NoTitleBar.Fullscreen).
Use:
if( Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH )
mBaseLayout.setSystemUiVisibility( View.SYSTEM_UI_FLAG_HIDE_NAVIGATION );
else if( Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB )
mBaseLayout.setSystemUiVisibility( View.STATUS_BAR_HIDDEN );
I am very new to programming and would like to know what is the best way to go about creating a notification icon badge similar to the ones on the iPhone apps. This would be basically for creating a badge for the notifications that end up in the notification bar.
This is actually an answer from Mark Murphy:
For most phones, you use the number field of the Notification object.
See here:
http://github.com/commonsguy/cw-android/tree/master/Notifications/Notify1/
Now, there are a few phones by one major device manufacturer that have
a bug, whereby the number field is ignored. I am working on getting
them to fix it. So you can't absolutely rely on that red bubble being
there, though it will be on most phones.
Are you talking about a graphical icon? I created a transparent PNG using the gimp and pass that drawable id as the 1st argument to the Notification constructor.
Notification notification = new Notification(R.drawable.someicon,title,System.currentTimeMillis())
I know this is very old question. May be this link is helpful is you are still looking for answer. https://github.com/leolin310148/ShortcutBadger
Achieving a true "dropdown" effect (as seen in Adobe's Photoshop Mobile app for Android, image below) has proven challenging using Androids built-in methods.
As others on Stackoverflow have told me, editing the style of a dropdown list view of an Android spinner is limiting.
How is this dropdown effect done?
(I can't seem to get an image to show, so here's a link: Adobe Photoshop Mobile for Android
After viewing the Adobe slideshow I think the way I would attempt to get that to work, using the Android Java SDK, would be to create a ListView object with a transparent background, and then dynamically hide/show it in that position when the menu button is clicked by setting the View's visibility to VISIBLE or GONE.
Getting a ListView to be transparent shouldn't be that difficult. I'd look into AbsoluteLayout to get it to hover over everything in that spot.
Another option might be to display the ListView in a custom Dialog that you've written, again positioning it in that exact spot on the screen so that it looks like a menu extending from the button that was clicked.
It's probably done using low-level draw functions.