我有一個文本視圖。在這我有這樣的文字「你可以訪問這個:http://www.google.com」。點擊此鏈接後,應該在webview中打開它,而不是默認瀏覽器。我的代碼是:點擊texview中的鏈接後,如何在webview而不是默認瀏覽器中打開該鏈接?
//MainActivity.java
link = (TextView) findViewById(R.id.textView);
link.setText("You may visit here : http://www.google.com");
link.setMovementMethod(LinkMovementMethod.getInstance());
//清單
<activity
android:name="com.xpointers.xpmediaapp.mediaapp.WebViewActivity"
android:label="@string/app_name">
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.action.VIEW" />
</intent-filter>
</activity>
我嘗試使用此鏈接:handle textview link click in my android app但未能理解和我應該在WebviewActivity寫? 請幫我解決這個問題。
http://stackoverflow.com/questions/22962621/open-url-in-webview-instead-of-default-browser – duggu
@Golu我得到這個,但有沒有必要使用點擊監聽器的文本視圖也? – Ak10147
查看Emanuel Moecklin的回答 – duggu