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. How to refresh ListView?

Hello,

I'm facing to one problem with ListView. I would like to refresh the
ListView every time I change the base data. Please see the following
example:

@Override
public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setListAdapter(new ArrayAdapter<Object>(this,
                        android.R.layout.simple_list_item_1, mStrings));

        new Timer().scheduleAtFixedRate(new TimerTask() {
                public void run() {
                        Log.d(TAG, "running timer: num=" + num);
                        mStrings[0] = "Unpdate " + num;
                        num++;

                        /** refresh the ListView - HOW??? **/
                        //TestList.this.getListView().invalidateViews();
                        //TestList.this.getListView().refreshDrawableState();
                        // what else???
                }
        }, 5000, 2000);
}

Can somebody give me a hint how to implement this feature?

Best regards,
Jiri

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

2. Buying an Dev Phone with Credit Card

Hi,

maybe not the right group, but I don't know where to ask.

I wanted to buy a Dev Phone. I'am already registered as developer and
my registration is approved.

But when I go to the checkout I get an error message that I have to do
a verbal authorization at my creditcard issuer. But I never heard from
this before and don't know what to do!

Hopefully someone can tell me what I have to do. I'm from germany.

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

3. Problems with webapp form submit from the android browser

4. bugs in Dev Guide's "Hello, Form Stuff" sample ?

5. Notepad tutorial is not updated

6. ERROR: Please insert SD card before using camera

7. Can wallpaper images be retrieved?