Android : Android - Set background view for whole app with no XML

on Thursday, December 4, 2014


I set the background color of my app with this code:



RelativeLayout rl = (RelativeLayout)findViewById(R.id.layout);
rl.setBackgroundColor(Color.RED);


How could I have this carry over to the next activities that come after this one, without using XML because it is not always the color RED. This depends on a selection by the user. But once the user has selected RED I want this color to carry over to the next activities. Is there a way to go about this without doing something like this for all the actives.



Intent intent = new Intent(this, NextActivity.class);
intent.putExtra("Color", "RED");
startActivity(intent);


And then on the next activity use that Extra to set the color. Is there a way that I can just set it for all the following activities until the user changes it?


Thanks for the help in advance.


0 comments:

Post a Comment