I am making an app consisting of two activities. The first activity is a startpage with only a button. When this button is hit, the next activity starts. My drawable file consists of 10 images. The second activity chooses a random image of those ten, and the image is shown on the screen. My question is: Is there a way I can make the shown image into the phones bakcgroundimage. I dont mean the apps background image, but the background on the phone itself. Preferably in java and not in xml. thanks
Asked
Active
Viewed 74 times
1 Answers
1
//Put this code into onCreate method
//Create array of your images as drawable object and choose random for background.
LinearLayout ll = new LinearLayout(this);
LayoutParams lparams = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
ll.setLayoutParams(lparams);
ll.setBackgroundDrawable(getResources().getDrawable(R.drawable.icon));
setContentView(ll);
-
the above will help to resolve the issue. – Jigar Pandya Jul 30 '12 at 11:11