How save image and set as application icon? android - android

I take image from gallery of camera. How i can set the image as Application icon?
I wanted write image to res/drawable as name "ic_launcher", but it is not possible.

How i can set the image as Application icon?
You cannot do any of the following at runtime:
Modify the icon used for your entry in the home screen launcher
Modify the icon used for your app in the Settings screen (e.g., list of installed apps)
Modify the icon used by default for the icon in an activity's action bar
You can, however, do the following at runtime:
Call setIcon() on the ActionBar to change the icon used in an activity's action bar
Show a different icon (or other image) in an app widget served by your app
Use a different icon for a shortcut that you attempt to add to the home screen via ACTION_CREATE_SHORTCUT

You can make multiple resolutions of the image for different screen densities. See android iconography style guide for details.
To use that icon go to AndroidManifest.xml and inside application tag use following property:
android:icon="#drawable/name_of_your_icon_file_without_extension"
Few points to note:
Use same file name for all screen densities. (e.g. ic_icon.png in all folders drawable-ldpi, drawable-mdpi, drawable-hdpi etc.)
Use transparent backgrounds for the icons
Hope this helps!

Related

How to set different icons for app and for its notifications?

I'm using a picture with black background and white sign as an icon for my app. The problem is when I'm getting a notification a icon at the top of the display is completely white (I don't know why to be honest, when screen is locked it looks as originally).
I want to solve this problem by setting different icon for notifications, I can use this site, when I'm using a text icon generated by this site it works just fine.
I'm wondering how to set different icons for my app and its notifications, I know it's possible, but I only have folders that are used for both app and notification icon (drawable-[hdpi/mdpi/xhdpi/xxhdpi/xxxhdpi]).
The problem is when I'm getting a notification a icon at the top of the display is completely white (I don't know why to be honest, when screen is locked it looks as originally).
You set the SetSmallIcon() in the Notification.Builder.
To understand the Android documentation which is as follows – “Update or remove assets that involve color. The system ignores all non-alpha channels in action icons and in the main notification icon. You should assume that these icons will be alpha-only. The system draws notification icons in white and action icons in dark gray.”
you can convert your notification icon to an Android friendly one with a few clicks.
In Notification icon generator, open up your icon file. Convert all parts of the image that you don’t want to show to transparent pixels. All colors and non transparent pixels are displayed in white.
Problem solved, I added below to AndroidManifest.xml (application section)
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="#drawable/new_notification_icon" />

Changing the menu icon-color/icon in Android Easy Share Action

I am trying to implement Easy Share Action for my Android application as describe in here. I was able to complete it successfully. But I need to change the Sharing Menu Item icon color or even icon. According to the given document we don't provide any icon in drawable folders.
You can download the Action Bar Icon Pack from here, locate the sharing icon you want whether holo light or dark.
For instance if you use holo light, the share icon is located in \Action Bar Icons\holo_light\01_core_share.
Should be easy to change the color of the drawables and copy to /res folder of your project.

Android: Homescreen Icons different than Menu Icons

Is it possible in Android to declare a HomescreenIcon for the user e.g. colored and inside the application the same Icon shown in the Action Bar just white?
In my case these are two different images i want to show. I defined the icon inside the AndroidManifest.xml but i can not find any option to change it for the ActionBar. It is always the same.
Yes, you can use android:logo in your manifest to provide the action bar image and android:icon to provide home screen icon. Both of them should be set to a drawable resource and can point to a different resources.

App Icon with transparent background doesn't appear

I use this image like ic_launcher for my application
(source: fotohost.by)
In my application icon is displayed without background
But in my GO launcher EX it's displayed with background
(source: fotohost.by)
In what may be the problem?
Go launcher provides the functionality to enable/disable app icon base .
You have to disable it.
I think that this is a change made by a theme of the launcher.

Android icon vs logo

The <application> tag for the Android Manifest contains a logo attribute which I have never seen before. What is the difference between your application's icon and its logo? Is it used purely for market?
The ActionBar will use the android:logo attribute of your manifest, if
one is provided. That lets you use separate drawable resources for the
icon (Launcher) and the logo (ActionBar, among other things).
Source: Android: How to change the ActionBar "Home" Icon to be something other than the app icon?
setDisplayUseLogoEnabled()
Enables the use of an alternative image (a "logo") in the Action
Bar, instead of the default application icon. A logo is often a wider,
more detailed image that represents the application. When this is
enabled, the system uses the logo image defined for the application
(or the individual activity) in the manifest file, with the
android:logo attribute. The logo will be resized as necessary to fit
the height of the Action Bar. (Best practice is to design the logo at
the same size as your application icon.)
Source: http://developer.android.com/guide/topics/ui/actionbar.html#Style
To replace the icon with a logo, specify your application logo in the
manifest file with the android:logo attribute, then call
setDisplayUseLogoEnabled(true) in your activity.
Source: http://developer.android.com/sdk/android-3.0.html#api
It appears that:
android:logo is available in API Level 10, but not API Level 8
using android:logo without android:icon does not set the application icon in the app drawer
My hunch is that "logo" refers to a company logo instead of an application icon.

Categories

Resources