image - How to set wallpaper permanently in android -


i creating app set image wallpaper. using following code fix image in every screen. code working fine. image fit properly. have 1 problem if play game , home screen or restart device size of wallpaper zoom. want stop this. want image size fit on first time when set wallpaper android app.

here's code-

    @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.full_image);         face = typeface.createfromasset(getassets(), "fonts/abeakrg.ttf");         intent = getintent();         position = i.getextras().getint("id");                 full = (linearlayout) findviewbyid(r.id.full);         btn = (button)findviewbyid(r.id.btn);         btn.settypeface(face);         btn.setonclicklistener(new button.onclicklistener(){         @override         public void onclick(view arg0) {               displaymetrics metrics = new displaymetrics();               getwindowmanager().getdefaultdisplay().getmetrics(metrics);              int height = metrics.heightpixels;               int width = metrics.widthpixels;              bitmap tempbitmap = bitmapfactory.decoderesource(getresources(), mthumbid[position]);              bitmap bitmap = bitmap.createscaledbitmap(tempbitmap,width,height, true);              wallpapermanager wallpapermanager = wallpapermanager.getinstance(fullimageactivity.this);               wallpapermanager.setwallpaperoffsetsteps(1, 1);              wallpapermanager.suggestdesireddimensions(width, height);              try {                wallpapermanager.setbitmap(bitmap);                toast.maketext(getapplicationcontext(), "done", toast.length_short).show();                } catch (ioexception e) {                e.printstacktrace();              }         }});         changebackground();         activityswipedetector activityswipedetector = new activityswipedetector(this);         full.setontouchlistener(activityswipedetector);     }        private void changebackground(){         full.setbackgroundresource(mthumbid[position]);    } 

thanks in advance.

here code segment working that

the mainactivity.java code

the bootreceiver.java setting wallpaper after boot completed..code

and manifest.xml setting permissions..code

thanks


Comments

Popular posts from this blog

python 3.x - Mapping specific letters onto a list of words -

javascript - jquery or ashx not working -

inno setup - TLabel or TNewStaticText - change .Font.Style on Focus like Cursor changes with .Cursor -