android - intent to google maps from webview -


i have webview in android, , open html webpage in it. there several link google maps , want intent native apps. have set other link host file intent native apps. have tried several way other failed. idea?

public boolean shouldoverrideurlloading(webview view, string url) {         // when user clicks hyperlink, load in existing webview              if(uri.parse(url).gethost().endswith("googledrive.com")) {                 return false;             }              intent intent = new intent(intent.action_view, uri.parse(url));             view.getcontext().startactivity(intent);             return true;     } 

androidmanifest.xml

<intent-filter>             <data                 android:host="maps.apple.com"                 android:pathpattern="/.*"                 android:scheme="http" >             </data>             <action android:name="android.intent.action.main" />             <category android:name="android.intent.category.default" />             <category android:name="android.intent.category.browsable" />             <category android:name="android.intent.category.view" />         </intent-filter> 

try code....!

import android.app.activity; import android.content.context; import android.os.bundle; import android.view.view; import android.view.view.onclicklistener; import android.view.inputmethod.inputmethodmanager; import android.webkit.webview; import android.widget.button; import android.widget.edittext;   /*  *   * class create browser handaling.  *   */ public class simplebrowser extends activity implements onclicklistener {      edittext url;     webview ourbrow;      @override     protected void oncreate(bundle savedinstancestate) {         // todo auto-generated method stub         super.oncreate(savedinstancestate);         setcontentview(r.layout.simplebrowser);          ourbrow = (webview) findviewbyid(r.id.wvbrowser);          ourbrow.getsettings().setjavascriptenabled(true);         ourbrow.getsettings().setloadwithoverviewmode(true);         ourbrow.getsettings().setusewideviewport(true);          ourbrow.setwebviewclient(new ourviewclient());         try {             ourbrow.loadurl("http://admstest.netau.net/adms/view/loginview.php");         } catch (exception e) {             e.printstacktrace();         }       }  } 

xml layout..........!

   <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:orientation="vertical"     android:padding="5dp" >      <linearlayout         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:orientation="horizontal"         android:padding="5dp"         android:weightsum="10" >          <edittext             android:id="@+id/eturl"             android:layout_width="fill_parent"             android:layout_height="wrap_content"             android:layout_weight="2"             android:ems="10"             android:inputtype="text"             tools:ignore="textfields" />          <button             android:id="@+id/bgo"             android:layout_width="fill_parent"             android:layout_height="wrap_content"             android:layout_weight="8"             android:text="go"             tools:ignore="hardcodedtext" />     </linearlayout>       <webview  android:layout_width="fill_parent" android:layout_height="fill_parent"         android:id="@+id/wvbrowser"/>    </linearlayout> 

androimainfest.xml

 <activity         android:name="viewactivity.simplebrowser"         android:label="@string/app_name" >         <intent-filter>             <action android:name="android.intent.action.simplebrowser" />             <category android:name="android.intent.category.default" />         </intent-filter>     </activity> 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -