Android: Associating Browser to File Type in App

Posted by tekmunki on Stack Overflow See other posts from Stack Overflow or by tekmunki
Published on 2010-06-15T14:58:23Z Indexed on 2010/06/15 15:02 UTC
Read the original article Hit count: 210

Filed under:

I'm attempting to write a simple app that associates a file type to the browser; this is assuming the browser will open the file locally... If this doesn't work, the local file - editor will be fine.

I have an option of auto-mailing .ELC files from a custom app, they are basically html formatted TEXT or TXT only files; I would like to associate the .elc extension so that it will open direct from mail rather than just "Save to SD Card" as a mail option.

Here's the code I'm at right now;

AndroidManifest.xml:

ELCViewer.java:

package com.tekmunki.ELCViewer;

import android.app.Activity; import android.os.Bundle; import android.widget.TextView;

public class ELCViewer 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("ELC Viewer Installed! Now, when you receive the ELC files, they will open in the browser."); setContentView(tv); } }

1) How do I make the browser associated with the ELCViewer Activity? (Do I need to make a second activity, or can that all be done in the manifest?) 2) How do I make it persist after the app has been ran once?

© Stack Overflow or respective owner

Related posts about android