need reference page for how to write a png from res/drawable to background as wallpaper

by Spooky » Fri, 20 May 2011 09:53:23 GMT


Sponsored Links
 I've been trying to find a reference and/or example page
explaining how to write a png image file from res/drawable
to the background as wallpaper for about the last five days
now ... I give up...time to ask for help finding either or
both of the above....  I've seen all kinds of references to
unrelated sties, but I just can't find the right page.

Can someone please point me in the right direction?

Thanks,
   --jim

-- 



Re: need reference page for how to write a png from res/drawable to background as wallpaper

by Saurav » Fri, 20 May 2011 12:26:31 GMT


 You mean wallpaper for phone home screen?




Regards,
Saurav Mukherjee.






-- 


Sponsored Links


Re: need reference page for how to write a png from res/drawable to background as wallpaper

by Spooky » Fri, 20 May 2011 12:54:40 GMT


 


Ok, here's a chance for me to possibly clear up my own confusion.
I've
been under the impressions that A) the home screen is THE screen
that you get when you press the HOME button, and that the rest are
other screens, and B) that ALL of the phone's screens are Home
screens.......

I'm talking about wallpaper that you load on the backgrounds of the
seven screens.

I'm working on a photography app, and I want the user to be able,
if they want to do so, to load any of my photos (which, before the
app is built, are in res/drawable) on their Home screen/screens.

I've been looking every day until my eyes start screaming, and after
that, I've kept looking until my eyes go totally blurry for the rest
of
the day (and beyond, sometimes) for just under a week, and have
gotten lots and lots of unrelated pages, but nothing relevant so far.

Later,
   --jim

-- 



Re: Re: need reference page for how to write a png from res/drawable to background as wallpaper

by Saurav » Fri, 20 May 2011 14:05:32 GMT


 I am guessing this is what u want,

WallpaperManager manager = WallpaperManager.getInstance(this);
try {
manager.setResource(R.drawable.wallpaper);
 } catch (IOException e) {
e.printStackTrace();
}

U need to add SET_WALLPAPER permissions in ur manifest file.

Hope this helps.


Regards,
Saurav Mukherjee.








-- 



Re: need reference page for how to write a png from res/drawable to background as wallpaper

by Spooky » Fri, 20 May 2011 17:39:08 GMT


 



Looks like exactly what I need.  Thanks!   I also have something
far more likely to get better search results (for a reference page),
too---so thanks for that, as well!

Later,
   --jim

-- 



Other Threads

1. How to Change Screen Resolution Programmatically?

Hi. Let me tell you my problem. I want to change my screen resolution.
I can change it in an application but it changes only application's
screen. I wanna set system's resolution so it won't be important which
application is running on front. My device's resolution is set as 1280
* 720 p. Can I make it 1260 * 680? If it requires to make changes in
Android source code, I can. Just tell me where to change. Waiting for
your help.

-- 

2. [BUG] Easily Reproducable Bug in Regards to Bitmaps, Memory, and Recycling [sample project included]

In a nutshell, I have/am trying to create reusable UI components in
XML.  I created a dead simple project that only fires an activity to
show the UI.  It can be downloaded here:

http://dl.dropbox.com/u/409429/Bitmap%20Bg%20Test.zip

I have a "base_form.xml" component that is referenced
(setContentView()) in "BaseForm.java", a base Activity.  The
base_form.xml is a FrameLayout where the background is set to a
drawable (a 16 kb png).

I now have "LoginForm.java" that extends BaseForm and a subsequent
"login_form.xml" component.  This login_form component is inflated in
LoginForm.java and "appended" to the view and remember, the view was
set in BaseForm.java via setContentView(R.layout.base_form).

It should be noted that in the BaseForm.java there is a method called
"cleanupDrawables()" which recycles the bitmap being used in the
FrameLayout and sets various things to null.  It even explicitly calls
System.gc() (I've tried it without and still the same issue).

Upon firing the app, everything works fine.  UI loads up and displays
properly.

Now, hit the back button.

Now, open the app again.  Everything is fine.

Hit the back button again.

Now open the app again.  Breaks with this exception:

FATAL EXCEPTION: main
E/AndroidRuntime(  405): java.lang.RuntimeException: Canvas: trying to
use a recycled bitmap android.graphics.bit...@44f4c150


So after discussing this issue with some other engineers it appears it
is a bug in the garbage collector that is occurring after the 2nd
sweep.  Apparently a very similar bug existed in early .Net.

A solution may be to instead of defining the background in XML to load
a bitmap using BitmapFactory and explicitly set the background of the
FrameLayout in Java.  This is undesirable as it doesn't really allow
me to create reusable UI components in XML.

Any help is greatly appreciated.


Also, it appears this is a bug that is "declined" by the Android
team.  "Use less memory in your app" was the original solution
suggested by Romain Guy.

http://code.google.com/p/android/issues/detail?id=8488

-- 

3. Eclipse ADT update ruins XML layout files development

4. HTTPS POST problem

5. Running adb logcat and dmesg commands from within my app.

6. samsung kernel tree can't compile for non-s5p chips

7. Issue with USB device current consumption in Self Powered mode