NFC - missing method getParcelableExtra( ... )

by Lars Nielsen Lind » Tue, 15 Mar 2011 06:21:10 GMT


Sponsored Links
 Hi,

I have used the following code which is published on various sites:


PendingIntent intent =
PendingIntent.getActivity(this.getApplicationContext(), 0,new
Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP),0);

NfcAdapter.getDefaultAdapter(this).enableForegroundDispatch(this,intent,
null, null);

Tag tag = (Tag) intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);


Here is the error message:

The method getParcelableExtra(String) is undefined for the type
PendingIntent

Anyone that knows why I can't call getParcelable(....) as shown above?

Thanks,

Lars


-- 



Re: NFC - missing method getParcelableExtra( ... )

by Mark Murphy » Tue, 15 Mar 2011 06:24:51 GMT


 You can call getParcelableExtra() on an Intent, not on a PendingIntent.

On Mon, Mar 14, 2011 at 6:21 PM, Lars Nielsen Lind





-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://github.com/commonsguy 
 http://commonsware.com/blog  |  http://twitter.com/commonsguy 

Android Training in Oslo:  http://bit.ly/fjBo24 

-- 


Sponsored Links


Other Threads

1. listview disable items

Hi all, I have a listview and when an item is selected a new activity
is started. I want when an item is selected to disable the entire
listview so no other items can be selected before the activity is
displayed. I tried setEnabled(false),setChoiseMode(1) but it didn't
help, so how can i disable item clicking in listview thanks :)
--~--~---------~--~----~------------~-------~--~----~

2. error creating avd with --force

PS C:\Users\cyryl\workspace> android create avd --name test --target 2
Android 1.6 is a basic Android platform.
Do you wish to create a custom hardware profile [no]
Error: Folder C:\Users\cyryl\.android\avd\test.avd is in the way. Use
--force if you want to overwrite.


PS C:\Users\cyryl\workspace> android create avd --name test --target 2
--force
Android 1.6 is a basic Android platform.
Do you wish to create a custom hardware profile [no]
Exception in thread "main" java.lang.StackOverflowError
        at java.io.WinNTFileSystem.list(Native Method)
        at java.io.File.list(Unknown Source)
        at java.io.File.listFiles(Unknown Source)
        at com.android.sdklib.internal.avd.AvdManager.recursiveDelete
(AvdManager.java:952)
        at com.android.sdklib.internal.avd.AvdManager.recursiveDelete
(AvdManager.java:954)
        at com.android.sdklib.internal.avd.AvdManager.recursiveDelete
(AvdManager.java:954) \

[[and so on....]


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

3. Adding Undo feature in FingerPaint app bundled with APIdemos.

4. How to create a Icon on Home screen through Activity

5. How to create a Icon on Home screen through Activity

6. Memory corruption

7. Portage d'Android sur IMX27 /// Android porting on IMX27 - confusion in downloading the kernel - android