How to add wallpaper in android?

448 Views Asked by At

How to add a wallpaper on your desktop in android to run scroll. To add a wallpaper I'm using:

for(int i = 0; i<list.length; i++)
    {
        ImageView iw = (ImageView)findViewById(list2[i]);
        iw.setOnClickListener(new OnClickListener()
        {
            @Override
            public void onClick(View arg0)
            {
                for(int j = 0; j<list2.length; j++)
                {
                    if(arg0.getId() == list2[j])
                    {
                        WallpaperManager wallpaperManager = WallpaperManager.getInstance(Main.this);
                         try {
                            wallpaperManager.setResource(list[j]);
                        } catch (IOException e)
                        {
                            e.printStackTrace();
                        }
                         return;
                    }
                }
            }
        });
    }

This works, but if you change the desktop wallpaper is not moving. (I'm sorry for my bad English.)

0

There are 0 best solutions below