Skip to content

Instantly share code, notes, and snippets.

@wahidisna
Created March 16, 2019 16:55
Show Gist options
  • Save wahidisna/530e448a0118d93900416164c4ceec7d to your computer and use it in GitHub Desktop.
Save wahidisna/530e448a0118d93900416164c4ceec7d to your computer and use it in GitHub Desktop.
package com.just.agentweb.advancedwebview;
import android.content.Intent;
import android.net.Uri;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.FrameLayout;
import com.just.agentweb.AgentWeb;
public class AgentActivity extends AppCompatActivity {
private AgentWeb mAgentWeb;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_agent);
mAgentWeb = AgentWeb.with(this)
.setAgentWebParent((ViewGroup) findViewById(R.id.framelayout), new FrameLayout.LayoutParams(-1, -1))
.useDefaultIndicator()
.setWebViewClient(mWebViewClient)
.createAgentWeb()//
.ready()
.go("file:///android_asset/myweb.html");
}
protected WebViewClient mWebViewClient = new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(intent);
return true;
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment