-1

I want to capture screenshot, save it into sdcard and set it as a wallpaper.

But its not properly fit into device. I followed this link http://android-er.blogspot.in/2011/03/set-wallpaper-using-wallpapermanager.html

Is it possible to set my captured image as a wallpaper? How to achieve this?

Cœur
  • 37,241
  • 25
  • 195
  • 267
malavika
  • 1,331
  • 4
  • 21
  • 54
  • 1
    This is not a "write code for me" website. This is a programming questions website. What part of your app are you struggling with? Is it capturing an image? Or is it image re-sizing? Or is it setting a wallpaper? – Vanuan Apr 01 '14 at 11:48

1 Answers1

0

refer to: https://stackoverflow.com/a/10881215/2771869

File f = new File(Environment.getExternalStorageDirectory(), "1.jpg");
String path = f.getAbsolutePath();
File f1 = new File(path);

if(f1.exists()) {
    Bitmap bmp = BitmapFactory.decodeFile(path);
    BitmapDrawable bitmapDrawable = new BitmapDrawable(bmp);
    WallpaperManager m=WallpaperManager.getInstance(this);

    try {
        m.setBitmap(bmp);
    } catch (IOException e) {
        e.printStackTrace();
    }
} 

Open Androidmanifest.xml file and add permission like..

<uses-permission android:name="android.permission.SET_WALLPAPER" />

Try this and let me know what happen..

Community
  • 1
  • 1
Mohammad Rababah
  • 1,730
  • 4
  • 17
  • 32