how to add background image to preferences activity in android? - android

i am new to custom PreferencesActivity, i am working since three days to get custom preferences, what i want is i want a preferences screen with background image and color views for every preference cell,
1) i had tried with res/xml/preferences.xml, but i cant create background image i had tried with many solutions but i couldn't find any solution.
2)i had tried with res/layout/pref.xml, but i couldn't able to save the settings of preferences
please help me in creating such type of preferencesActivity with background image

see How set background drawable programmatically in Android
and save this link http://developer.android.com/reference/android/content/SharedPreferences.html

Related

set image button background dynamically

I have defined array of ImageButton dynamically and that will take its buttons background from the user selected photos, my problem is that when I restart the app, the image buttons does not stay, how can I make it stay "along with the user selected background for it" without define it in the XML? I think of shared preferences but I am not sure if it will solve the problem!
icon[count]= new ImageButton(this);
icon[count].setImageResource(R.drawable.p1);
icon[count].setImageBitmap(photo);
To save Background color you have applied , Shared preferences is perfect solution.
You need to save state of background color and retrieve it when you are restarting app(onRestart()) or onPause() or onResume().
how can I make it stay "along with the user selected background for
it" without define it in the XML?
Using Shared preferences
Checkout Android Shared preferences example

android change background image from settings

In my application, four activies are present (Add, view , search and settings). in settings activity, it will display 10 buttons ie. apply to set background image. images are saved in drawable folder. if i click on button image it should change the background of all activities
First of all you need to use SharedPreferences.
set value of selected background in SharedPreference and display images according to the value of it in all Activities

How to create custom preferences?

After long struggle i am posting this question with hope where i will get answer to my question.
I can't able to create custom preferences activity with background image, view bars between every preference,.
As i had designed one custom preferences page but i cant able to make preference cell as button and i cant able to add key values to preferences to make them as sharedpreferences, even i tried with preferencesfragment also, but i couldn't able to make it work.
Please help me from this custom preferences activity.

Preference with in-line options

I've created a PReference Screen which lets the user manage a series of elements marked by himself as "favorites". I create a Preference category then fill it up with options dynamically, taking them from a sqlite database. This is a screencap:
And this is a screen mockup of what I want to achieve:
That is, I want for every preference item to add an in-line remove option that allows users to directly remove favorites.
The problem is I don't know how to do this, and I've seen no similar examples. Is it even possible?
Android provides an easy means to implement preferences screen, but standard android ListPreference does not provide an easy way to display an image for each item if the list. To add the images to the Android ListPreference, we need to use a custom xml attribute
Here is some example that may help you
http://www.cmwmobile.com/index.php?option=com_content&view=article&id=4&Itemid=12
How to add icons to Preference
To delete prefrence from prefrence screen you you can refer this Link : How to determine which preference item from custom layout button click

Android programmatically changes colors to users specs

I currently have my app using a xml style sheet but all the the test users are asking to set their own colors. I can easily get the data for the user but how do I go about changing everything.
I could have a class called after every activity was fired and have it reset the colors based on the user preferences. is there a better way?
COuldn't you use the findViewById(R.id.something) to get the view element from your xml layout
and then you change the colors you want?
(sorry if I misunderstood your question, in this case could you be more specific>-?)

Categories

Resources