Modify your activity main xml and every possible xmls which can set the background color.
You have to remove the line "android:background="#F799B3"" from main layout. Don't set the background in xml at all.
Then, in your MainActivity.java try setting it after you inflat the layout. Just like shown here: https://stackoverflow.com/users/3767038/awk
Now, if you set it in onCreate(), it will change every time you open up your main activity. If you want to have random color background just once, on startup only, the you have to work with SavedInstances in your application.
Example:
In your onCreate():
int lastUsedColor = 0 ;
if(savedInstanceState != null){
lastUsedColor = savedInstanceState.getInt("lastUsedColor");
findViewById(android.R.id.content).setBackgroundColor(lastUsedColor);
}else{
Random rnd = new
int newColor = Color.argb(rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256));
findViewById(android.R.id.content).setBackgroundColor(newColor);
savedInstanceState.putInt("lastUsedColor", newColor);
lastUsedColor = newColor;
}
In your onSaveInstanceState(Bundle bundle)
super.onSaveInstanceState(bundle);
bundle.putInt("lastUsedColor", lastUsedColor);
Hope it helps.