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. Using the dev phone without a wireless carrier

Is it possible to use the dev phone without having a service contract
with any mobile carrier? I want to use the dev phone in a class to
teach app development using all the other features of the device
except for telephony. Is that possible?

Also, does anyone know of institutions that have classes that teach
app development using the Android platform?

--~--~---------~--~----~------------~-------~--~----~

2. Alarm manager on boot only runs once?

I'm trying to set up a service that gets started when the device
boots.  I see that service being started once in the logs but it never
seems to run again.  So the fact that I see it in the right after boot
up means that I am properly intercepting the boot up notification and
firing off the service and that everything is registered correctly in
the the manifest (DeviceBootReceiver and service.)

What I want to have happen is the service to be fired up, regardless
of whether the owning application is running periodically, say every 6
hours.  I'm able to fire up the services and run them from main.java
but obviously this only works if the user has the application in
memory.  Eventually the service will be garbage collected.  So I think
I'm doing something wrong here, but after a day of playing around
(even looking at android:process) can't seem to get it to work.

Any leads will earn a beer.

Thanks! and here's some code!

// this class gets the Boot Broadcast and supposedly :-) sets up the
Alarm Manger to run every 20 seconds and call DownloadAlarm Class.

public class DeviceBootReceiver extends BroadcastReceiver {
private static final String TAG= "DeviceBootReceiver";
@Override
public void onReceive(Context context, Intent intent) {

        Log.d(TAG, "Starting the alarms from device boot receiver....");
         Intent i  = new Intent(context, DownloadAlarm.class);
         PendingIntent sender = PendingIntent.getBroadcast(context,
0, i, 0);


         Log.d(TAG, "Got bootup notice....");
         // Schedule the alarm for every thirty seconds after the
first 15 second delay....
         AlarmManager am = (AlarmManager)context.getSystemService
(Context.ALARM_SERVICE);
         am.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP,
SystemClock.elapsedRealtime(), 20000, sender);

        }

}
----
Download Alarm Class listens for that pending intent and fires up the
service...

public class DownloadAlarm extends BroadcastReceiver
{


private static final String TAG= "DownloadAlarm";

    @Override
    public void onReceive(Context context, Intent intent)
    {
        Log.d(TAG, "Received intent for service: Starting app service");
         context.startService(new Intent(context, AppService.class));



    }


--------------
 App service does some stuff...
public class AppService extends Service {

    private static final String TAG= "AppService";
    @Override
    public void onCreate() {
         Log.d(TAG, "Started the app service");

        Thread thr = new Thread(null, mTask, "AppService");
        thr.start();
    }

    @Override
    public void onDestroy() {

    }

    /**
     * The function that runs in our worker thread
     */
    Runnable mTask = new Runnable() {
        public void run() {
                try {
                        // Download files.
                        HttpClient httpclient =  new DefaultHttpClient();
                  //    Log.d(TAG, "Attempting to load:"+ mURL);
                         HttpGet httpget = new HttpGet("http://www.yahoo.com");
                        httpclient.getParams().setParameter
("http.socket.timeout", new Integer(10000));
                        httpget.getParams().setParameter
("http.socket.timeout", new Integer(10000));
                         // Create a response handler

                        ResponseHandler<String> responseHandler = new
BasicResponseHandler();



                } catch (Exception e) {
                        Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString
(e));
                    }

              File log=new File(Environment.getExternalStorageDirectory(),
"AlarmLog.txt");

          try {
          BufferedWriter out=new BufferedWriter(new FileWriter
(log.getAbsolutePath(), true));

          out.write(new Date().toString());
          out.write("\n");
          out.close();
          }
          catch (IOException e) {
          Log.e("AppService", "Exception appending to log file", e);
          }
            Log.d(TAG, "In thread");

            // Done with our work...  stop the service!
            AppService.this.stopSelf();
        }
    };

    @Override
    public IBinder onBind(Intent intent) {
        return mBinder;
    }



    /**
     * This is the object that receives interactions from clients.
See RemoteService
     * for a more complete example.
     */
    private final IBinder mBinder = new Binder() {

    };

--~--~---------~--~----~------------~-------~--~----~

3. Stuck at starting Intent ??

4. Package Problems following Notepad Tutorial in Eclipse for Android 1.5_r3: android.app not Included

5. Must have missed something...1.5->1.6

6. build path error (solved)

7. WebView Dimensions