import android.widget.EditText;
import android.widget.ProgressBar;
-import java.net.URL;
-
-
public class Webview extends AppCompatActivity {
static String formattedUrlString;
int menuItemId = menuItem.getItemId();
final WebView mainWebView = (WebView) findViewById(R.id.mainWebView);
- // Use the menu items to go forward or back.
+ // Sets the commands that relate to the menu entries.
switch (menuItemId) {
+ case R.id.home:
+ mainWebView.loadUrl(homepage);
+ break;
case R.id.back:
mainWebView.goBack();
break;
android:orientation="horizontal"
android:id="@+id/topBarLayout">
+ // android:inputType="textUri" sets the keyboard to have a go arrow.
<EditText
android:id="@+id/urlTextBox"
android:layout_width="0dp"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".Webview">
+ <item
+ android:id="@+id/home"
+ android:title="@string/home"
+ android:orderInCategory="100"
+ app:showAsAction="ifRoom" />
<item
android:id="@+id/back"
android:title="@string/back"
- android:orderInCategory="100"
+ android:orderInCategory="200"
app:showAsAction="ifRoom" />
<item
android:id="@+id/forward"
android:title="@string/forward"
- android:orderInCategory="200"
+ android:orderInCategory="300"
app:showAsAction="ifRoom" />
</menu>
<string name="privacy_browser">Privacy Browser</string>
// Menu.
+ <string name="home">Home</string>
<string name="back">Back</string>
<string name="forward">Forward</string>