we can convert from Intent to URI and from URI to Intent.
from Intent to URI string
Intent intent1 = new Intent ();
String uriString = intent1.toURI ();

from URI string to Intent
Uri uri = Uri.parse (uriString);
Intent intent2 = new Intent ();
intent2.setData (uri)

after conversion, intent1 and inten2 should be same.
for example
        Intent intent1 = new Intent ();
        intent1.addCategory (Intent.CATEGORY_HOME);
        intent1.addCategory (Intent.CATEGORY_LAUNCHER);
        Log.v ("", "Intent1 = " + intent1);
        if (intent1.hasCategory (Intent.CATEGORY_HOME))
            Log.v ("Intent1", "#1 hasCategory TRUE");
        else
            Log.v ("Intent1", "#1 hasCategory FALSE");

        String str = intent1.toURI ();
        Uri uri = Uri.parse (str);
        Intent intent2 = new Intent ();
        intent2.setData (uri);
        Log.v ("", "Intent2 = " + intent2);
        if (intent2.hasCategory (Intent.CATEGORY_HOME))
            Log.v ("Intent2", "#2 hasCategory TRUE");
        else
            Log.v ("Intent2", "#2 hasCategory FALSE");
-------------- result --------------
Intent1 =
{ categories=android.intent.category.HOME,android.intent.category.LAUNCHER} }
 #1 hasCategory TRUE

Intent2
{ 
data=#Intent;category=android.intent.category.HOME;category=android.intent.category.LAUNCHER;end
 }
 #2 hasCategory FALSE

In this sample code, Intent2 is a conversion result from Intent1. If
you run this sample code, Intent1 result and Intent2 result are
differnt. because Intent1 and Intent2 have a same
Intent.CATEGORY_HOEM, the result should be Intent1 and Intent2 is TRUE
(intent.hasCategory).

I think this is bug. and the hint is Intent1 and Intent2 's toString
result is different.
Intent1 =
{categories=android.intent.category.HOME,android.intent.category.LAUNCHER}
Intent2 =
{ 
data=#Intent;category=android.intent.category.HOME;category=android.intent.category.LAUNCHER;end
 }

I don't know how to convert Intent to URI(String) and convert URI
(String)
 to Intent. I want to save Intent to DB and read Intent from DB.
please help me!



--~--~---------~--~----~------------~-------~--~----~
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