Will the addPreferredActivity method available in the future?

by Dianne Hackborn » Tue, 10 Feb 2009 07:28:06 GMT

Sponsored Links
 You don't get to do that.  The user gets to decide which activities they

This is the last time I am answering this question.


Other Threads

1. Open proper app with intent

Forgive me if this is a topic that has already been discussed, but
I've searched for hours and can't seem to find the answer I'm looking
for. I'm trying to cut my teeth on Android programming with a simple
file manager app and currently have most all functions working, but I
can't seem to open a selected file with the appropriate app. Here is
my current code:

String extension =
String mimeType =

if (mimeType != null &&
MimeTypeMap.getSingleton().hasMimeType(mimeType)) {
        try {
                File fileToOpen = new File(filePath + "/" + label.getText());
                Intent i = new Intent();
                i.setDataAndType(Uri.fromFile(fileToOpen), mimeType);
        catch (Exception e) {
                Toast.makeText(this, "Could Not Open File!",
} else {
        Toast.makeText(this, "Unknown Mime Type", Toast.LENGTH_SHORT).show();

The strange thing is that I get some rather interesting results with
this code. On my handset, it doesn't seem to want to open doc files at
all, but will open the one xls file I have without a problem in
Docs2Go. Also, when throwing about 10 pdf files at it, it will open 2
of them with no problem but claims "Unknown Mime Type" on the other 8.
Theoretically, this code should find the extension on the file, then
figure out the appropriate MIME type from the extension, then call the
activity handing over the MIME type as an argument, but theory doesn't
seem to be enough to get me through this one. Any suggestions you guys
can make, or tutorials you can point me at would be greatly
appreciated. Thanks!



2. Stop the launcher activity from starting the application


I have a enable and disable button. When this button is enable, user can
launch my application normally. But when the button is in disable state, I
don't want to start the application, that is the launcher activity should
not start, but the icon for application will be there.

When we click on the icon for application to launch it should not start. Any
Idea please.

Nithin M Warrier

Dream Big and Work Smart To Make It a Reality !!!


3. libmms & libffmpeg in Android to Stream WMA

4. help with fade of view

5. Is there a mechanism for installing native processes with root for network operators / device manufacturers?

6. How do I refer to a drawable with a variable

7. Stream WMA using libmms & libffmpeg