0

In my app I have a tab and a webview in, but when I clic on a link, the browser it's open.

I want to stay in my app, I have read this answer: android webview stay in app

But I can't do it. I don't know what exactly I must do .

Here is my EventsFragments.java :

public class EventsFragment extends Fragment 

{
     WebView myWebView;
     @Override
        public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState)
    {
            View view = inflater.inflate(R.layout.tabone, container, false);
                WebView myWebView = (WebView) view.findViewById(R.id.webview);
        myWebView.loadUrl("http://www.google.fr");
        return view;
    }
    }

Thanks in advance.

Community
  • 1
  • 1
  • 1
    What is not clear in the correct answer in [android webview stay in app](http://stackoverflow.com/questions/13542982/android-webview-stay-in-app)? – MaciejGórski Jun 13 '13 at 22:17
  • > You'll have to create a WebViewClient > New Class ? And then set it to your WebView like this: webview.setWebViewClient(new myWebViewClient()); in EventsFragments.java ? but where – user2456597 Jun 13 '13 at 22:26
  • `New Class ?` Yes. `in EventsFragments.java ? but where` Usually after inflating the `WebView`, so after `WebView myWebView = (WebView) view.findViewById(R.id.webview);` in your code. – MaciejGórski Jun 13 '13 at 22:32
  • It's work ! Thanks for precisions :) – user2456597 Jun 13 '13 at 22:50

0 Answers0