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. Touch Events in Surface View

Hey,

I'm trying to develop a scrollable tile-based map system and I'm
having some trouble getting touch events to work correctly. I
currently have a surface view in a separate thread (almost identical
to the lunar lander example) and I am passing the touch events from
the view to my thread. The method in the thread is synchronized with
the holder as in the lunar lander example.

The following code works perfectly within the emulator:

boolean onTouchEvent(MotionEvent event) {
        synchronized (_cellMap.getHolder()) {
                // touch down
                if (event.getAction() == MotionEvent.ACTION_DOWN) {
                        // start of a new event, reset the flag
                        mIsMoving = false;
                        // store the current touch coordinates for scroll
                        // calculation
                        mXTouch = (int) event.getX();
                        mYTouch = (int) event.getY();
                } else if (event.getAction() == MotionEvent.ACTION_MOVE) { // &&
                        // touch starts moving, set the flag
                        mIsMoving = true;
                        // mIsTap = false;

                        // get the new offset
                        mXOffset += mXTouch - (int) event.getX();
                        mYOffset += mYTouch - (int) event.getY();

                        // secure, that the offset is never out of view bounds
                        if (mXOffset < 0) {
                                mXOffset = 0;
                        } else if (mXOffset > mMapSize * mTerritorySize - 
getWidth() +
mTerritoryHalfSize) {
                                mXOffset = mMapSize * mTerritorySize - 
getWidth() + (int)
mTerritoryHalfSize;
                        }
                        if (mYOffset < 0) {
                                mYOffset = 0;
                        } else if (mYOffset > mMapSize * mTerritorySize - 
getHeight() -
mTerritorySize) {
                                mYOffset = mMapSize * mTerritorySize - 
getHeight() -
mTerritorySize;
                        }

                        // store the last position
                        mXTouch = (int) event.getX();
                        mYTouch = (int) event.getY();

                        calculateLoopBorders();
                } else if (event.getAction() == MotionEvent.ACTION_UP) {
                        // touch released
                        if (!mIsMoving) {
                                Territory terr = getTerritory(event.getX(), 
event.getY());
                                // show the id of the touched cell
                                if (terr != null) {
                                        selectTerritory(terr);
                                }
                        }
                }
                return true;
        }
}

and is sitting within my thread. As I said this works perfectly within
the emulator but does not work when testing on a Nexus One running 2.1
OR 2.2.

I assume this is because fingers have more contact time with the
screen than mouse clicks and tend to move a round a tiny bit and so
are being registered as tiny moves. They never register as clicks and
so my tiles never highlight. They DO, however, highlight on the
emulator.

Please can someone help me work out how to make it clear to the above
code the difference between a tap and a move?

Thanks a lot,

Patrick

-- 

2. How to get all the children views of a layout

Hello,

I'm a newbie, so please excuse if this is a basic question:

Is there a way to get all the children views of a layout, from the
Java code so that I can loop through them and set an attribute?
Specifically, I'd like to set the "layout_width" based on the screen
size.  Since this "layout_width" would be the same for all the views,
I'd prefer to loop through instead of calling each individual View
separately by their id.

I've searched, but I couldn't find anything, and I'm wondering if I'm
off the track.
I'd appreciate any help.

Thanks!


The following is my main.xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">

<LinearLayout
      android:id="@+id/myRow1"
      android:orientation="horizontal"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:layout_weight="1">
      <TextView
          android:text="1"
          android:layout_width="wrap_content"
          android:layout_height="50dip"
          android:layout_weight="1"/>

      <TextView
          android:text="2"
          android:layout_width="wrap_content"
          android:layout_height="50dip"
          android:layout_weight="1"/>

      <TextView
          android:text="3"
          android:layout_width="wrap_content"
          android:layout_height="50dip"
          android:layout_weight="1"/>

      <TextView
          android:text="4"
          android:layout_width="wrap_content"
          android:layout_height="50dip"
          android:layout_weight="1"/>

      <TextView
          android:text="5"
          android:layout_width="wrap_content"
          android:layout_height="50dip"
          android:layout_weight="1"/>

      <TextView
          android:text="6"
          android:layout_width="wrap_content"
          android:layout_height="50dip"
          android:layout_weight="1"/>

  </LinearLayout>
</LinearLayout>

-- 

3. android emulator proble

4. Android Support for Text Correction

5. Embed youtube Video in Android

6. New Mobile Developer Research names Android as top platform in developer mindshare

7. Using gmail or Android marketplace without Data plan (T-mobile)