2011-07-13 7 views
2

どのように私は、ブラウザの意図を開くとAndroidでローカルURLを指すようにすることができますか?ローカルURLを指定して、コマンドラインからAndroidのブラウザを開く

午前は-a android.intent.action.VIEW -dファイルを起動します。

///data/local_page/index.html動作しません。これはhttp://プレフィックスでのみ機能するようです。構成部品を追加すること

(?...誰もが知っているためandroid:scheme="inline"が何であるかわからない)

<activity android:name="BrowserActivity" android:label="@string/application_name" android:launchMode="singleTask" android:alwaysRetainTaskState="true" android:configChanges="orientation|keyboardHidden" android:theme="@style/BrowserTheme" android:windowSoftInputMode="adjustResize"> 
<intent-filter> 
<action android:name="android.speech.action.VOICE_SEARCH_RESULTS"/> 
<category android:name="android.intent.category.DEFAULT"/> 
</intent-filter> 
<!-- 
For these schemes were not particular MIME type has been supplied, we are a good candidate. 
--> 
<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:scheme="http"/> 
<data android:scheme="https"/> 
<data android:scheme="about"/> 
<data android:scheme="javascript"/> 
</intent-filter> 
<!-- 
For these schemes where any of these particular MIME types have been supplied, we are a good candidate. 
--> 
<intent-filter> 
<action android:name="android.intent.action.VIEW"/> 
<category android:name="android.intent.category.BROWSABLE"/> 
<category android:name="android.intent.category.DEFAULT"/> 
<data android:scheme="http"/> 
<data android:scheme="https"/> 
<data android:scheme="inline"/> 
<data android:mimeType="text/html"/> 
<data android:mimeType="text/plain"/> 
<data android:mimeType="application/xhtml+xml"/> 
<data android:mimeType="application/vnd.wap.xhtml+xml"/> 
</intent-filter> 
<!-- We are also the main entry point of the browser. --> 
<intent-filter> 
<action android:name="android.intent.action.MAIN"/> 
<category android:name="android.intent.category.DEFAULT"/> 
<category android:name="android.intent.category.LAUNCHER"/> 
<category android:name="android.intent.category.BROWSABLE"/> 
</intent-filter> 
<!-- 
The maps app is a much better experience, so it's not worth having this at all... especially for a demo! <intent-filter android:label="Map In Browser"> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <data android:mimeType="vnd.android.cursor.item/postal-address" /> </intent-filter> 
--> 
<intent-filter> 
<action android:name="android.intent.action.WEB_SEARCH"/> 
<category android:name="android.intent.category.DEFAULT"/> 
<category android:name="android.intent.category.BROWSABLE"/> 
<data android:scheme=""/> 
<data android:scheme="http"/> 
<data android:scheme="https"/> 
</intent-filter> 
<intent-filter> 
<action android:name="android.intent.action.MEDIA_SEARCH"/> 
<category android:name="android.intent.category.DEFAULT"/> 
</intent-filter> 
<intent-filter> 
<action android:name="android.intent.action.SEARCH"/> 
<category android:name="android.intent.category.DEFAULT"/> 
</intent-filter> 
<meta-data android:name="android.app.searchable" android:resource="@xml/searchable"/> 
</activity> 

答えて

1

てみてください:

am start ... -n com.android.browser/.BrowserActivity ... 

これは、ローカルHTMLファイルをt動作しているようですが、それはhtmlviewerではなく、ブラウザでページを開くように見える彼のAndroid 2.2への私のためのブラウザ、(HTCの欲望)と2.3(ソニー・エリクソンのXperia)

+0

。リンクなどをクリックしても動作しません。 – Tony

+0

代わりにWebViewを試すことができます:http://d.android.com/reference/android/webkit/WebView.html – mibollma

+0

私はアンドロイドブラウザを使用したいと思います。 – Tony

2

試してみてください。-t text/html

これらは、ブラウザが使用するフィルタでの追加

関連する問題