I know the following is probably simple, but I can't seem to get it to work. It compile and runs, but doesn't load any URL I throw at it. I have Internet set in permisions, even checked to make sure it was running in some other code.
package com.richardmather.autoaccidentattorney;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
public class FindHospitalFragment extends Fragment {
public FindHospitalFragment(){}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_find_hospital, container, false);
final WebView webView = (WebView) rootView.findViewById(R.id.webView);
String searchURL = "http://www.stackoverflow.com";
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl("searchURL");
return rootView;
}
}
Here is the XML
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/webView"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</LinearLayout>
I know it's something simple I'm missing.
EDIT: Took out the quotation marks, now it's loading the URL in Google Chrome....