How to change standard resources on phone/emulator - android

I'm a new in Android and Java and I have the following problem. I want to change standard resources, such as button background, programatically to allow applications using standard buttons be displayed with custom background. My problem is - how shall I identify the path for retrieval resources on phone or emulator? And if we have permissions to access to those resources?

The only way you can change "standard resources" for the entire device is to modify and install your own firmware.

Related

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.

how to use different package for different device in android?

Hi i have develop a application in android which run in every device, i use different layout for different size device's but i have use some code programmatically without xml so, it create a problem in different size device.
so i require to change the package acording to the device resolution so, it can posible in android to programmatically detect and change the package class
plz, give some suggestion.
Thanking you.
i have use android2.2 for my application
No, it is not possible to programmatically change the application package. For device-specific display sizes you can create size-specific layouts as described in the guide and use getResources().getConfiguration() to programmatically choose specific code paths to execute.
"i use different layout for different size device's " means you just use dp/dip sizes or that you have completely different layouts for each screen size?
If you only used dp/dip units, then you can add a scalefactor to your code to get the matching coordinates. If you are using different layouts, it's much more difficult. Depending on how many different layout configurations you have, you could build seperate apk files and upload them parallel. The Market will handle the distribution of the matching files then.
Another way:
Create an installer app which checks the device configuration and downloads the device-specific package afterwards from a ftp/network resource.
After installation, delete the installer and the .apk file.

Does the android application may allow another app to modify own files?

I am wondering about new skinning mechanism for my app. However I don't want to make my application bigger.
Is it possible to create another app, which will be able add/change files of another my app in /data/data/com.myfirstapp directory ?
You could set up aContentProvider that other apps could use to transfer data to your app, which could then save it to its own data directory.
The answer is simply no, you can access other applications from your own application but you cannot edit or change them.

Replacing the battery indicator (Android)

There's an open source battery indicator that I greatly prefer to the default one. I was wanting to modify it to replace the default battery indicator. Is this even possible without building a whole custom ROM?
Yes, it is possible to do without building a new custom ROM, but you still need root access. the .png files for the battery indicator are in the framework-res.apk, you can extract that, replace just the .png files for the battery and put it back with approriate access rights and it will work. kinda like the process to just can change the "Verizon Wireless" (or other carrier) text on the lock screen.
I do not believe it is possible without building a whole custom ROM.

Categories

Resources