Hallo Ferit,

as an alternative you could use a pending intent like this:

  PendingIntent pi =
caller.createPendingResult(PENDING_INTENT_NFC_TECH_DETECTED, new
Intent(), 0);
  nfcAdapter.enableForegroundDispatch(caller, pi, intentFilters,
techLists);

(where caller is the calling *activity*, nfcAdapter is an instance of
the NfcAdapter, and PENDING_INTENT_NFC_TECH_DETECTED is some random
constant)

Then you can receive the intent with onActivityResult:

  protected void onActivityResult(int requestCode, int resultCode,
Intent data) {
    switch (requestCode) {
      case PENDING_INTENT_NFC_TECH_DETECTED:
        //YOUR INTENT HANDLING CODE GOES HERE
        break;
    }
  }

br,
Michael


On Jun 14, 3:05 pm, Ferit Topcu <[email protected]> wrote:
> Thanks.
>
> Perhaps it has something to do with my PendingIntent, again. All
> nfc-logic, reading a tag etc. is realized in an external class. After
> that every Activity is only invoking the method of this external
> class. The enableForegroundDispatch() invoke is realized in this class
> and the activity methods onResume(), onPause(), onNewIntent() are
> calling the external methods.
>
> Perhaps if i'm using a PendingIntent:
>
> mPendingIntent =
> PendingIntent.getActivity(con.getApplicationContext(), 0, new
> Intent(con.getApplicationContext(),
> getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0)
>
> is it important which class is used? I mean the Context / Activity is
> given to the external class and in the Intent there is the Information
> about the context and the external class. Perhaps the dispatching
> system has a problem with this procedure where an Intent refers to
> non-acitivity class and the onNewIntent()-method is a activity class.
> At the current this the point where a inconsistency is possible for
> me.
>
> kd,
> ft

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to