0

i am developing android app n i am adding the function of set image as wallpaper i want to enable the user to crop the image first using any gallery application he have and after that he can set it as wallpaper

i searched many times , but couldn't find something useful

thats only to fit the image to screen , but not what i need

DisplayMetrics metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);
    int height = metrics.heightPixels;
    int width = metrics.widthPixels;
    Bitmap tempbitMap = BitmapFactory.decodeResource(getResources(), R.raw.five);
    Bitmap bitmap = Bitmap.createScaledBitmap(tempbitMap,width,height, true);
    WallpaperManager wallpaperManager = WallpaperManager.getInstance(MainActivity.this);
    wallpaperManager.setWallpaperOffsetSteps(1, 1);
    wallpaperManager.suggestDesiredDimensions(width, height);
    try {
        wallpaperManager.setBitmap(bitmap);
    } catch (IOException e) {
        e.printStackTrace();

0 Answers0