The API you are calling is just for the web kit when running in your own
process.  If you want other apps to be able to see what you can do, that is
what AndroidManifest.xml is for.

On Thu, Jan 28, 2010 at 6:08 AM, Varun Khaneja <[email protected]> wrote:

> Hi,
>
> I want to register my application for files of a certain popular and
> well-documented MIME-type.
> The problem is that Android does not seem to recognize this MIME-type.
>
> The following sample code demonstrates this:
>
> package com.example.helloandroid;
>
> import android.app.Activity;
> import android.os.Bundle;
> import android.util.Log;
> import android.widget.TextView;
>
> public class HelloAndroid extends Activity {
>    /** Called when the activity is first created. */
>     @Override
>    public void onCreate(Bundle savedInstanceState) {
>        super.onCreate(savedInstanceState);
>         TextView tv = new TextView(this);
>        tv.setText("Hello, Android");
>        setContentView(tv);
>        String extn =
> android.webkit.MimeTypeMap.getFileExtensionFromUrl("/data/a.xyz");
>        String xyzMimeType =
> android.webkit.MimeTypeMap.getSingleton().getMimeTypeFromExtension
> (extn);
>        Log.d ("HelloAndroid", "extn: " + extn + " | xyzMimeType: " +
> xyzMimeType);
>    }
> }
>
> The MIME-type returned by this API is NULL although it correctly
> returns the extension (extn = "xyz").
>
> So in my main application, if I skip the <data android:mimeType="..."
> /> line in the manifest file, the application does not receive the
> intent which means it is not launched.
> And there seems to be no way to specify android:mimeType as NULL.
>
> I also tried using <data android:mimeType="*" />, but with that, I get
> an error saying "Malformed XML".
> (Read about it here:
>
> http://stackoverflow.com/questions/1733195/android-intent-filter-for-a-particular-file-extension
> )
>
> Could someone please throw some light on this?
>
> Thanks,
> -Varun
>
> --
> 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]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

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