How to dynamically apply themes in Android

by kirti kaul » Fri, 04 Dec 2009 20:24:36 GMT


Sponsored Links
 Hi,

My query is regarding on whether we can apply dynamically themes in
android,like what we do with our phones in which we can select a theme
and the same theme gets applied all across the phone.Is there a way to
do this in android ????

(I am able to change the default theme by hardcoding in the code
(styles.xml),but I need to know how we can we set themes dynamically.
I saw the Android phone,but there is no Setting where we can set the
Theme.)

Any help will be appreciated!!!

Thanks,
Kirti

--



How to dynamically apply themes in Android

by Nithin » Fri, 04 Dec 2009 21:06:16 GMT


 Hi,

We can dynamically set using setTheme(). The constant you need to put
is android.R.style.Theme_XXXXX

Thanks




--


Sponsored Links


How to dynamically apply themes in Android

by kirti kaul » Mon, 07 Dec 2009 11:07:33 GMT


 Thanks,Have u tried it?I mean are you able to change the theme on
runtime?I mean dynamically in the emulator?





--



How to dynamically apply themes in Android

by Nithin » Mon, 07 Dec 2009 12:25:55 GMT


 Hi,

Its not working in java code. Its working when put theme in manifest
only. In 1.1 SDK, i used setTheme() and it worked perfectly, but now
its not working.

 http://code.google.com/p/android/issues/detail?id=4394 
 http://code.google.com/p/android/issues/detail?id=3793 






--



How to dynamically apply themes in Android

by kirti kaul » Mon, 07 Dec 2009 14:42:19 GMT


 Thanks,I tried with
setTheme(android.R.style.Theme_Light);
        super.onCreate(savedInstanceState);
         setContentView(R.layout.main);
and this seems t owork,but my question is how do we change the Theme
of the whole system Dynamically?I mean the user should be able to
change the themes dynamically from the phone(emulator)







--



Other Threads

1. Custom ArrayAdapter add items programmatically

I need some help.
i've create a custom ArrayAdapter and override getView method like
this:

View v=convertView;
                if(v==null){
                        LayoutInflater li = (LayoutInflater)
getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                        v = li.inflate(R.layout.dynamic_element_layout, null);
                }
In my dynamic_element_layout.xml i defined one table layout with 2
row. In the first row i have one TextView and i set the text for this
in my  getView method(that works ok) the problem is that i want to
programmatically add an other control in my second table row
(EditText, Spinner, etc) and it's not working. I tried:

TableRow tr=(TableRow) v.findViewById(R.id.elementContainerTableRow);
                if(tr!=null){
TextView tv=new TextView(getContext());
                tv.setText("Text");
                tv.setLayoutParams(new LayoutParams(
                LayoutParams.FILL_PARENT,
                LayoutParams.WRAP_CONTENT));

                tr.addView(tv);
}

Can somebody help me with this issue??

-- 

2. load an image from a URL

How to load an image from a URL in a ImageView ?

I tried this :

ImageView imgVw = (ImageView)findViewById(R.id.lm1);
imgVw.setImageURI("http://www.intelligent-solutions.be/pics/e_mail2.jpg");

But it doesn't work !!

---
Julien

-- 

3. Pake paket,pulsa tetep berkurang

4. New to android development

5. how to listen messages from http server

6. Best way to do this

7. How do I stop the emails