2012-02-24 16 views
5

私のアプリケーションでは、WebViewを使用してGoogleマップの2つのジオポイント間の方向を示したいと思います。私はしようとしましたが、指示が表示されていません。標識ページだけが表示されます。どうやってするの?アンドロイド - ウェブビューで指示を表示する方法

public class android_testing extends Activity { 

public WebView webview;  
protected ProgressDialog web_pd; 
final Handler rb_web_pd_Handler = new Handler();  

@Override 
public void onCreate(Bundle icicle) 
{ 
    super.onCreate(icicle);     
    setContentView(R.layout.main);   

    webview = (WebView)findViewById(R.id.wv_direction); 
    webview.getSettings().setJavaScriptEnabled(true); 
    webview.getSettings().setPluginsEnabled(true); 
    webview.getSettings().setDomStorageEnabled(true); 
    webview.getSettings().setBuiltInZoomControls(true); 
    webview.getSettings().setSupportZoom(true); 
    webview.getSettings().setAllowFileAccess(true); 

    web_pd = ProgressDialog.show(android_testing.this, "", "Please wait...", true); 
    Thread t = new Thread() 
    { 
     public void run() 
     {    
      rb_web_pd_Handler.post(checked_LoginResp); 
     }            
    }; 
    t.start(); 

    webview.setWebViewClient(new WebViewClient() 
    { 
     @Override 
     public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) 
     { 
      // Handle the error 
     } 

     public boolean shouldOverrideUrlLoading(WebView view, String url) { 
      if (url.startsWith("tel:")) { 
        Intent intent = new Intent(Intent.ACTION_DIAL, 
          Uri.parse(url)); 
        startActivity(intent); 
      }else if(url.startsWith("http:") || url.startsWith("https:")) { 
       view.loadUrl(url); 
      } 
      return true; 
     } 
    }); 
    float source_lat = 17.493133f; 
    float source_long = 78.398438f; 
    float dest_lat = 17.444992f; 
    float dest_long = 78.379898f; 
    String page_url ="http://maps.google.com/maps?daddr="+dest_lat+","+dest_long+"&saddr="+source_lat+","+source_long;    
    System.out.println("URL:"+page_url);  
    webview.loadUrl(page_url);  
} 

final Runnable checked_LoginResp = new Runnable() 
{ 
    public void run() 
    { 
     try 
     { 
      webview.setWebChromeClient(new WebChromeClient() 
      { 
       public void onProgressChanged(WebView view, int progress) 
       { 
        if(progress == 100) 
        { 
         web_pd.dismiss(); 
        } 
       } 
      }); 
     } 
     catch(Exception e) 
     { 
      e.printStackTrace(); 
     } 
    }  
};   } 

それがこの

it shows like this

のように表示さしかし、私は直接方向のページを表示します。出来ますか? enter image description here

+0

ウェブビューでGoogleマップDirectinを表示する方法を説明しますdscribeます。このarticalを読むこの問題を解決してきましたか? –

答えて

関連する問題