Saturday, 15 January 2011

image - Android Live Wall Papers that change random pictures from drawable -


Can someone provide code or at least one idea how to create such wallpapers. I think I want to use the Wefpper but I can not use it randomly, am I right? Thank you.

Your question seems a bit unsure, in any case, to make it simple, You have an image view that you want to dynamically change in a random way. The structure should look something like this:

  imv = (ImageView) findViewById (R.id.imageView1); Resource rsrc = getResources (); IIDID = Ardrauble. Drawable Drawable = RSRCgrade Schedule (IIIDF); Bitmap bm = bitmapfinder Decodersource (rsrc, drawable); Imv.setImageBitmap (BM);  

In this example, IIDD is hardcoded, but you can easily change it ugly. For example, create an array list of integers with your desired images and then they are completed in a loop or whenever a condition is met (for example every 30 seconds).

Example:

  ArrayList & LT; Integer & gt; Listofimagesids = new ArrayList & lt; Integer & gt ;; Listofimagesids.add (R.drawable.yourimagename1) listofimagesids.add (R.drawable.yourimagename2) ... listofimagesids.add (R.drawable.yourimagenameN) Random Rand = New Random (); If (iCindition) {int n = rand.nextInt (listofimagesids.size ()); Drawable drawable = RSRC ready draft (N); Bitmap bm = bitmapfinder Decodersource (rsrc, drawable); Imv.setImageBitmap (BM); }  

Of course this is just a pseudo-code, but it can guide you a bit. Hope it helps.


No comments:

Post a Comment