Changing drawable (PNG) in android application - android

I have a standard aplication. It uses resources - PNGs that are when programming in the DRAWABLE folder. They build up menus, buttons etc etc. ... Classic application nothing special.
And what I need to have is - "theme" support. Lets say I use this PNGs in my app:
menubutton.png
scrollbotton.png
arrwo.png
and these are in the DRAWABLE folder.
And I would like to be able to change the THEME of the app by changing this PNGs for different ones. Lets say I have PNG's with same names, but under a different url:
.../template1/menubutton.png
.../template1/scrollbotton.png
.../template1/arrwo.png
and than I have a another "template"
.../template2/menubutton.png
.../template2/scrollbotton.png
.../template2/arrwo.png
IMPORTANT: Of course all the PNGs have exactly same size, and name
So and the app shall have the functionality to download this PNGs and replace the ones that are currently in use. The important point is that the additonal PNGs from different templates HAVE to be availiable online - I dont want to ship the app with many templates that would not be used.
Can you please confirm this can be done and that it should not be a problem?

The Drawable resources are packaged in to the application and cannot be modified. You idea of using an SD card will work (or you can use the applications sandboxed directory), you just need to manually load the png resources (ex. myImageView.setBackgroundBitmap(...); [pseudo-code]).
As a note: If I ever open an application that immediately tells me to wait since it is downloading resources, I will force-close it and uninstall. Applications on Android, iOS, Windows, etc. should work right away without the need to download more resources. If you want a default "theme" then package it with the app, don't make the user download it (which will cause problems if the user is on mobile networks or doesn't have an internet connection when they open the app)

Related

Downloadable Android app themes

I would like to support multiple dynamic themes for my app. At the same time, I dont want to increase my app bundle size by adding all set of icons and images. I wish, user selectively download from server during runtime.
Following are the two methods I see in stack overflow.
Make the new styles, icons and background images into separate APK and let the user download from google play and import those values during runtime.
How to release application plugin using Android Market?
Make the new styles, icons and background images into a zip file and let the user download and save it in SD card. Write a Resourse manager wrapper to parse and read values from the config file inside the zip file.
Create downloadable custom theme and apply it during run time
Option: 2 looks to be a better solution but it has set of limitations like we can set only the bg color and text color.
Could you please let me know which approach is better? Or is there any other better method.
The first method will be an effective one, Since normal users mostly prefer apps or themes to be downloaded from Play Store.
It will be easy for you also to promote your App as well as your Themes.
You can easily provide new updates for your themes and bug fixes , no need to download a .Zip file again & again.
For our case, we have decided to go ahead with below approach:
For each theme, we will create a config file, that will contain the list of configurable elements (color, icon, image) along with necessary resources (icons, images, bgimage).
We will post this in our server and allow user to browse through the list with a preview image.
If he decides to download a theme, we will download and unpack in local memory.
In our android app, all the elements(textview, imageview, listview) will contain a wrapper which will read from this config and apply before rendering.
NOTE: #4 is too much work, so we will divide all our themes to light and dark in top level. 75% of the config should come from our styles file (light or dark). Only font color, bgcolor, bgimage, iconsets will change based on the config file.
From this approach, we can easily move to the separate apk approach also.

Circular overflow icon for Android ActionBar

How to get the 3-circles overflow icon (instead of default 3 little squares overflow icon) in the Android ActionBar?
Examples - Google+ app, Twitter app
You should always make your own files, or use free ones instead. Closed source apps often don't permit you to use their images files.
When the app's images are open source,it should be safe to extract the APK of the app, and get it by youself. It's just like any Zip file.
In order to get the APK file of the app, you can use my app (available here, just choose "share" on the selected app) or any other app that can copy APK files from installed apps . It doesn't even need root for this operation.
It might be a bit different with Google, as they are probably more forgiving for such things, but it's best to not take the risk.

Android standard icon for feedback/report by users

I want to add a feature on my app to let users give a feedback on data. (for example to report errors or mistakes).
Is there a standard icon for it?
please, visit your android-sdk-* folder, there should be default set of icons and pictures in the ./platforms/android-XX/data/res/drawable-Xdpi/ where "XX" and "X" stand for your android version and screen size. all the standard icons are there.
There are a few system icons whose filenames match 'feedback', but none of them look appropriate to me.
Best I could find is "ic_menu_report_image.png".
I've been using "ic_menu_start_conversation.png".
Whether it’s useful for your app mainly depends on the iconset you’re already using. In a chat-app for example, this icon would be a poor choice :)
Note: this icon is marked as protected. You'll have to copy the images to your source manually.
Because these resources can change between platform versions, you should not reference these icons using the Android platform resource IDs (i.e. menu icons under android.R.drawable). If you want to use any icons or other internal drawable resources, you should store a local copy of those icons or drawables in your application resources, then reference the local copy from your application code. In that way, you can maintain control over the appearance of your icons, even if the system's copy changes.

How can I use system icons in my android app?

I am programming an android application and I'd like to use the system icons for mail, phone, calendar and contacts inside this application. The problem is, that these icons differ from system to system (different android versions and different smartphones) and I want to keep the application and the system consistent. Is there an easy way to achieve this?
In XML use default android drawables from #android:drawable/... and in code use android.R.drawable....
You can use the standard drawable using
#android:drawable/[icon_name] in your xml file
android.R.drawable.[icon_name] in your java code
You can see different icon in your file system in
[SDK PATH]/platforms/platforms/[ANDROID_VERSION]/data/res
Some images are standard...like contacts, calendar :)
You can't keep system consistent. For what? New versions of Android are usually prettier than older ones (well, it's my opinion).
The only way to keep system icons same for your app - copy them into your drawables instead of using direct reference to them (like #android:drawable/).
First of all if you intend to use the default images (icons) for mail , phonr etc.
This default can be used as android.R.drawable.name in code or #android:drawable/ in xml from http://docs.since2006.com/android/2.1-drawables.php
But as this will vary from OS versinos to Versions.
So , if you need to use an unique GUI for the app for all versions and devices.
Please do not use android provided images , simply use your own graphics or images supplied in drawables resources explicitly by you for your app.
If you're ok with icons from each system you can get it via PackageManager and getApplicationInfo method.
If you're not, you should copy the resources from the platform into your own application.

How do I re-use the default android title gradient?

If you create an activity and set a label without disabling the title bar you will see a title that uses a gradient as a background. Is there a way for me to re-use this resource without re-implementing it?
Thanks
I believe the background for this comes from the resource that is called "activity_title_bar.9.png" that is in the system drawable folder.
Here is a copy of it:
If you download it from here you'll have to rename it using the .9.png suffix. You can also find it in your SDK. The path is "SDK\platforms\android-4\data\res\drawable"
Note android-4 could be any other number that you happen to have installed on your machine.
Generally if you are wanting to use a system resource like this best practice is to save your own copy of it and include it in your project. Resources like this are subject to change at any time with new versions of the OS (or even with device specific skins that Manufacturers add on to the OS) So if you rely on the system copy from inside your app then you have no way to know for sure that it will look the same across all devices.

Categories

Resources