How would one go about enabling the ActionBar in a webview. My current code goes straight to loading the page in a web browser and skips all of my other activity logic, but I’m not sure why.
Main Activity
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.webview);
ActionBar actionBar = getSupportActionBar();
actionBar.setTitle("My Page");
actionBar.setDisplayShowHomeEnabled(false);
WebView myWebView = (WebView) findViewById(R.id.webview);
myWebView.loadUrl(http://www.google.com);
}
XML File
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<WebView
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginTop="5dip"
/>
</LinearLayout>
I have also tried creating a dialog to show the webview, but that also proved unsuccessful.
Thanks!
Alright, so I found the answer to my problem, but it was more of a technicality than anything.
The problem was that the link was a redirect page, so the built in web-browser app was hijacking my session, adding this into my onCreate method solved it.
Thanks for the replies though!