Associate Browser to File Type

by tekmunki » Sat, 19 Jun 2010 03:12:38 GMT


Sponsored Links
 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:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android=" http://schemas.android.com/apk/res/android" ;
      package="com.tekmunki.ELCViewer"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:icon="@drawable/icon" android:label="@string/
app_name">
        <activity android:name=".ELCViewer"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category
android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category
android:name="android.intent.category.DEFAULT" />
                <category
android:name="android.intent.category.BROWSABLE" />
                <data android:mimeType="text/elc" />
                <data android:mimeType="application/elc" />
                <data android:mimeType="file/elc" />
        </activity>
        </intent-filter>
    </application>
    <uses-sdk android:minSdkVersion="2" ></uses-sdk>
</manifest>




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?


--



Other Threads

1. ImageView not showing image

Hi All,

I am trying to display the image on run time using ImageView, but it
is not showing up, below is the code: Please sugegst what is the issue

super.onCreate(savedInstanceState);
setContentView(R.layout.myimageview);
mImageView = (ImageView) findViewById(R.id.imageview);
mImageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
mImageView.setImageResource(R.drawable.wall_img02);
mImageView.setFocusable(true);
mImageView.setFocusableInTouchMode(true);
mImageView.invalidate();

Thanks

-- 

2. how to center aligned multiline text

Hi All,

In my application, I am displaying some text in textview on tabs. I
have customized tabs view. because of the text length it is wrapping
in two line which is fine with me.

But this text is getting aligned with the left and no more in center
of the tab view.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:background="@layout/mailbox_tab_bg_state"
  android:gravity="center">

        <TextView
                android:id="@+id/tabTxt"
                android:text="list view"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="@layout/tab_text_color_selector">
        </TextView>
</LinearLayout>

I tried to set text view's gravity property as center then text in two
line get in center but it wasn't left aligned with respect to each
other. I wish that lines should be in center of the tab view and left
aligned with themselves.

Thanks & Regards,
Manish Garg

-- 

3. ListView+ContextMenu

4. Android Web Browser Plugin - Detection, Feasibility & Usage

5. ViewFlipper responsive animation on view switches

6. downloadan image from google

7. how to connect to specified available network through wifi with my android application