2012-08-07 56 views
1

我有一個textview格式化與html Html.fromHtml() 當我點擊,例如,在href,瀏覽器啓動。我想要的是處理該意圖,並且不啓動瀏覽器。沒有網絡意圖的textview鏈接

這是我的代碼:

notic = Html.fromHtml(noti.getDescripcion());     
noticiacorregida = CorrigeLinks(notic); 
lbl_descripcion.setText(noticiacorregida); 
lbl_descripcion.setMovementMethod(LinkMovementMethod.getInstance()); 

我需要保存URL中的變量,而不是啓動瀏覽器。

謝謝

+0

你希望能在您的應用程序來查看它? – apw2012 2012-09-29 00:19:03

+0

是的,在我的應用程序中查看,或者,例如,如果我有一個URL是圖像資源,在手機上啓動圖像查看器。我只需要在一個變量中捕獲URL。 – 2012-09-29 07:40:50

回答

0

那麼,最好的我可以想出是一個web視圖。使用此代碼。首先這裏是java。

package com.stackoverflow.images.webview; 

import android.app.*; 
import android.os.*; 
import android.view.*; 
import android.widget.*; 
import android.content.*; 
import android.webkit.*; 

public class Site extends Activity 
{ 
    /** Called when the activity is first created. */ 
    @Override 
    public void onCreate(Bundle savedInstanceState) 
    { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.image); 
     WebView webView = (WebView) 
     findViewById(R.id.webview); 
      webView.loadUrl("http://examplesite.com/yourimage"); 

     } 


} 

現在這裏是XML。只嘗試在JAVA和URL中更改上面的包。 確保一切是正確的JAVA上述起來像的onCreate佈局

<?xml version="1.0" encoding="utf-8"?> 
<WebView 
    android:id="@+id/webview" 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:orientation="vertical" 
> 

    </WebView> 
+0

???我想你不能說明我需要什麼,或者我無法解釋自己:( – 2012-09-29 15:44:13

+0

我很抱歉..............:'(希望你能找到一些幫助的地方 – apw2012 2012-09-29 16:43:58