Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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;
- }
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement