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 data binding from XML (REST-RPC request)

Hi,

I currently building an adnroid apps that retrive data from a distant
Web service and i search an efficient way to bind data form XML to
ListView.
I already use CursorAdapter and i search on the web for an
"XmlAdapter". I read on Google IO topic "Coding for Life -- Battery
Life, That Is" (http://code.google.com/events/io/sessions/
CodingLifeBatteryLife.html) that is more efficient to use "stream
parser" instead of "tree parser" but i don't find the way to build a
class that implement ListAdapter because of stream parser can't
navigate backward so i don't understand how implement method that use
"position" parameter (How retrive data before curent XML Parser
position ???).

I don't find solution for this problem on the web after make search
(maybe a don't make good search), so could you give me the way to
solve my problem ?

Thanks

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

2. HTC Hero has multi-touch. SDK support?

Doesn't apple have a multitouch patent?



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

3. Drawing in a child View

4. Vertical and Horizontal Scrolling together

5. Open Market

6. Gempa Mentawai

7. Telit GSM Module & Dialer