LocalHtml.java
----
package com.cocci.html;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
public class LocalHtml extends Activity
{
private void forward(String paramString)
{
Uri localUri = Uri.parse(paramString);
Intent localIntent1 = new Intent();
localIntent1.setAction("android.intent.action.VIEW");
localIntent1.setData(localUri);
localIntent1.setClassName("com.android.browser", "com.android.browser.BrowserActivity");
startActivity(localIntent1);
}
private String mkForwardUri(Uri paramUri)
{
String str3 = paramUri.getEncodedPath();
StringBuffer localStringBuffer1 = new StringBuffer(str3);
localStringBuffer1.insert(0, "file://");
String str2 = localStringBuffer1.toString();
return str2;
}
public void onCreate(Bundle paramBundle)
{
super.onCreate(paramBundle);
Uri localUri = getIntent().getData();
if (localUri != null)
{
String str = mkForwardUri(localUri);
forward(str);
}
finish();
}
}
AndroidManifest.xml
---
<?xml version="1.0" encoding="utf-8"?>
<manifest android:versionCode="1" android:versionName="1.1" package="com.cocci.html"
xmlns:android="http://schemas.android.com/apk/res/android">
<application android:label="@string/app_name" android:icon="@drawable/icon">
<activity android:label="@string/app_name" android:name=".LocalHtml">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/html" />
</intent-filter>
</activity>
</application>
</manifest>