Ok, I have a short program written that I'd like to see change the
system wallpaper.
I use setWallpaper(Bitmap bitmap);
It is crashing my system.
I think it is because it is broadcasting an intent and I'm
not set up to receive it correctly.
Any help is appreciated. Thank you!

--Here is the code: Look at the try block for my comment--

import --ALL IMPORTS CORRECT--

public class wallpaper1 extends Activity {
    /** Called when the activity is first created. */
   SampleView mview;
        @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mview = new SampleView(this);

        setContentView(mview);

    }

    private static class SampleView extends View {

        private  Canvas mCanvas;
        private final Paint mPaint;
        private Bitmap mBitmap;
        private Drawable mdrawable;
        private string wallstring;
        public SampleView(Context context)  {

                super(context);

                mPaint = new Paint();
            mPaint.setAntiAlias(true);
            mPaint.setARGB(255, 255, 255, 255);


            try {

                //This line right here crashes the program
                // The graphic darkcleanlinux is valid. (640x480)
                // The API for setWallpaper states that an intent
                // ACTION_WALLPAPER_CHANGED is broadcast.
               //Do I need to set up a listener? How?
                  
context.setWallpaper(BitmapFactory.decodeResource(getResources(),
                      R.drawable.darkcleanlinux));

                                mdrawable = context.getWallpaper();

                        } catch (IOException e) {
                                 //TODO Auto-generated catch block
                                e.printStackTrace();
                        }

                }


}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to