WebView using NumberPicker | Eclipse | Android

Published: 29 October 2019
on channel: Rayncode
266
1

Join Discord Community:   / discord  

MainActivity.java

NumberPicker np;
Button btn;
WebView wv;

String[] array = { "MyPage", "Google", "Bing", "Yahoo" };
np = (NumberPicker) findViewById(R.id.numberPicker1);
np.setDisplayedValues(array);
np.setMinValue(0);
np.setMaxValue(array.length-1);

wv = (WebView) findViewById(R.id.webView1);
btn =(Button) findViewById(R.id.button1);

btn.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View v) {
// TODO Auto-generated method stub

int choice = np.getValue();
if(choice == 0)
wv.loadUrl("file:///android_asset/mypage.html");
else if(choice == 1) {

wv.setWebViewClient(new WebViewClient());
wv.loadUrl("https://www.google.com");

}
else if(choice == 2)
wv.loadUrl("https://www.bing.com");
else if(choice == 3)
wv.loadUrl("https://www.yahoo.com");


Source Code: https://github.com/Yaseen549/WebView.git


On this page of the site you can watch the video online WebView using NumberPicker | Eclipse | Android with a duration of hours minute second in good quality, which was uploaded by the user Rayncode 29 October 2019, share the link with friends and acquaintances, this video has already been watched 266 times on youtube and it was liked by 1 viewers. Enjoy your viewing!