-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWebpageDisplayPage.java
More file actions
50 lines (40 loc) · 1.49 KB
/
WebpageDisplayPage.java
File metadata and controls
50 lines (40 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package com.example.natalie.test2;
import android.content.Intent;
import android.net.Uri;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.TextView;
public class WebpageDisplayPage extends AppCompatActivity {
private WebView webview;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_webpage_display_page);
Bundle bundle = getIntent().getExtras();
String URL = bundle.getString("URL");
webview = (WebView) findViewById(R.id.webview);
webview.setWebViewClient(new MyBrowser());
webview.getSettings().setJavaScriptEnabled(true);
webview.loadUrl(URL);
}
public void sendHomePage(View view){
Intent intent = new Intent(this, HomePage.class);
startActivity(intent);
}
public void sendPizza(View view){
Uri location = Uri.parse("geo:0,0?q=Pizza delivery near me");
Intent mapIntent = new Intent(Intent.ACTION_VIEW, location);
startActivity(mapIntent);
}
private class MyBrowser extends WebViewClient {
@Override
@SuppressWarnings("deprecation")
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
}
}