Register ContentObserver for AppWidgetProvider

by Manjunatha M » Tue, 08 Sep 2009 15:55:57 GMT


Sponsored Links
 Hi,

I am writing an application on the widget framework provided by Android.

I want to listen to contacts DB through the contentObserver and update
accordingly on the db change.

I want to register the contentobserver on the chip is enabled and unregister
on the chip disable.

Now that, i can override onEnabled and onDisabled and implement the methods
to register and unregister the contentobservers.

However, I am able to register  the observer in the onEnabled function.

But in the onDisabled, I am seeing the observer as null.

Does any body know or anybody has docs pertaining to this, please share..

Thanks in advance,
Manjunatha

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



Other Threads

1. Making a game pack.

I want to do an update for my game that adds more missions and hence a
fair amount of new data (2-4Megs).  I already have have people
complaining about the space asking me to support install to SD.  So
far I have resisted the install to SD since the game doesn't have the
new licensing support.  Also isn't install to SD only 2.2?
Anyway I was considering making an app that was pretty much only
data.  When you run the app it will ask you to unpack all the data to
the SD.  Then the main game app will look in a specific spot for an
data and use it.  Other than version problems I think this will work.
Any thoughts?

-- 

2. onProgressUpdate executed only once

I am trying to update TextView in my Activity with text messages from
DatagramServer ( see below)
The problem I have is that "backgound UDP server receives plenty of
traffic, but onProgessUpdate is ever executed only once so only the
first of the messages appear in the TextView
Any idea what is my error here would be appreciated...


public class MyActivity extends Activity {

TextView txtStatus;
// txtStatus initialized

new BackgroundAsyncTask().execute();

public class BackgroundAsyncTask extends
           AsyncTask<Void, String, Void> {
                public static final String SERVERIP = "127.0.0.1"; // 'Within' 
the
emulator!
                public static final int SERVERPORT = 2222;
                private DatagramSocket socket;


            protected Void doInBackground(Void... params)
            {
                try {
                                InetAddress serverAddr = 
InetAddress.getByName(SERVERIP);
                                Log.d("UDP", "S: Waiting for connection...");
                                socket = new DatagramSocket(SERVERPORT,
                                                serverAddr);

                                while(true)
                                {
                                        byte[] buf = new byte[1024];
                                        DatagramPacket packet = new 
DatagramPacket(buf, buf.length);
                                        Log.i("telemetry server", " waiting for 
packet");
                                        socket.receive(packet);

                                        Log.i("received", new 
Integer(packet.getLength()).toString());
                                        Log.i("UDPServer received:", new 
String(packet.getData()));

                                        publishProgress(new 
String(packet.getData()));


                                }

                        } catch (Exception e) {

                                Log.i("Dbg server", e.getMessage());

                        } // end of try
                        Log.i("Dbg server", "Dbg server: Done.");
                        socket.close();

                return null;
            }

          @Override
          protected void onPostExecute(Void result) {
           // TODO Auto-generated method stub
           //it will never been shown in this exercise...

          }

          @Override
          protected void onPreExecute() {
           // TODO Auto-generated method stub

          }

          @Override
          protected void onProgressUpdate(String... values) {
                 txtStatus.append(values[0] + "\n");



          }
        }

-- 

3. Using USB HSDPA dongle on Android

4. Home screen

5. Setting textSize for ListView, it doesn't show all separator line

6. how to make Multi-touch support softKeyboard

7. can we read and write a same file using 2 thread