Notification View - Getting Values from Intent

by Siju » Thu, 01 Oct 2009 06:05:26 GMT


Sponsored Links
 I have a Notification in my application and a view attached to see the
notification. In my view I want to get the values that I put using
putExtras method. I want to use this value to display the details to
the user about the notification.

I used following
Intent intent= new Intent(context, MyNotificationView.class);
 intent.putExtra("MYKEY", "VALUE");

and attached this intent in the PendingIntent as given below:
        PendingIntent contentIntent = PendingIntent.getActivity
(context, 0,
                intent, 0);

In my NotificationView, I tried to get the value from the intent as
follows:
String ts = getIntent().getStringExtra("MYKEY");

This gives the correct value the first time, but with subsequent
notifications, it gives the same value as what is put before. This I
can understand from documentation that I need to use the onNewIntent()
call back to set my new intent so that getIntent() can get the updated
intent, I have following:

                protected void onNewIntent(Intent intent) {
                        super.onNewIntent(intent);
                        setIntent(intent);
                }

But that is not solving my problem, I am not seeing a callback for
onNewIntent() method and I am still getting the first intent.

Can someone tell me what I am doing wrong?

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



Other Threads

1. TableLayout text wrapping issue

 I was configuring a two-column table where the TextView column on the 
right sometimes has a long text string and I wanted it to wrap around 
and expand the table cell vertically as it would in HTML. I found that I 
had to configure the TextView with layout height & width of wrap_content 
in order for it to wrap, but I was losing some of the text content as if 
the TextView were extending to the right of the edge of the screen 
before wrapping.


I finally got it to work by applying shrinkColumns to the RH column. It now wraps properly, but I'm a bit at a loss to explain this behavior. Is this a quirk of this layout type? --

2. Android market time to refund.

Hi,
can you refresh my mind please?

How much time a customers have to ask for a refund once he bought our
software from the market?

Thanks.

-- 

3. Threading and the emulator

4. "recv failed, errno = 11 (Try again)" when trying to play video from certain hosts

5. regarding iperf tool

6. getting the Froyo kernel source

7. Task Manager Killing process. Incomplete kill.