Click here to Skip to main content
15,888,089 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
in the end I'm starting up a service that I will want to call to that class and change my phone's wallpaper.

in the mainActivity java file I can just write >


Java
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
int height = metrics.heightPixels;
int width = metrics.widthPixels;

Bitmap bmap2 = BitmapFactory.decodeResource(getResources(),   R.drawable.superman);
        Bitmap bitmap = Bitmap.createScaledBitmap(bmap2, width, height, true);

        WallpaperManager wallpaperManager =    WallpaperManager.getInstance(getApplicationContext());
        try {
            wallpaperManager.setBitmap(bitmap);
        } catch (IOException e) {
            e.printStackTrace();
        }


and this works great... it uploads the wallpaper and starches it to fit screen

but I can't use it in another java class.,

how do I do this on another java class, and then later on call it from my myService Class ?
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900