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]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en