I want to create an app like Ali express. An app for an online store. I am using the bottom navigation activity in android studio with Java language but I don't know how to use the webview so that if any of the bottom activity is clicked it would display a particular URL. For instance, the home, categories, cart.
Try this code :
In Xml add webview according to you for example like this:
<WebView
<!-- covers 368dp width as required. -->
android:layout_width="368dp"
<!-- unique ID of WebView -->
android:id="#+id/web"
<!-- covers 495dp height as required. -->
android:layout_height="495dp"/>
In Java add this :
WebView w = (WebView) findViewById(R.id.web);
// loading http://www.google.com url in the the WebView.
w.loadUrl("http://www.google.com");
// this will enable the javascipt.
w.getSettings().setJavaScriptEnabled(true);
// WebViewClient allows you to handle
// onPageFinished and override Url loading.
w.setWebViewClient(new WebViewClient());
for more information visit Web View Documention
OUTPUT :
Related
I have webpage but I don't want navigation menu and search box. Can we float the webview container?
How to hide through android-webview?
mWebView.setVisibility(View.GONE); & mWebView.setVisibility(View.VISIBLE);
Do not use INVISIBLE setting.
I want to create a custom relative layout for fb login, and on click of this layout, the default fb login button should get triggered for fb login, using fb login api.
Found a much better method, without using GoogleFirebase. Create a layout and onclick of that layout, call LoginButton.performClick();
You can Integrate Facebook Login into your app by Using Google Firebase.
REfer this link:
https://firebase.google.com/docs/auth/android/facebook-login
i am using Appium(java) to test android app that contains pop-up window ,(pop-up appears after clicking a button..)
the popup compose from :
Framelayout with resource-id : android:id/content
LinearLayout with resource-id :android:id/parentPanel
LinearLayout (contain 2 buttons) with resource-id :android:id/buttonPanel
i want to press 1 of the buttons inside it ...
i tried verity of options that i found on the web , but nothing works
you can use self.driver.find_element_by_name("text to be clicked")
I need my widget to interact with any built-int browser. What I mean by an interaction is to know the content of the visible web page. Is it possible for a floating widget to "know" what DOM element lies below and read some info about the element? The following scenario is demanded: user moves the widget across a browser with some HTML page visible, the widget then recognizes HTML elements and shows the user some information about that element.
If there is no such possibility, is it possible to read the whole text from the actual web page? Only text, without any other objects.
if you want to show a web page directly on your app, you can use android webview. Make a activity with a webview.
webveiw.xml
<?xml version="1.0" encoding="utf-8"?>
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
then you can use in the activity
WebView myWebView = (WebView) findViewById(R.id.webview);
myWebView.loadUrl("http://www.example.com");
you have to add this part in your manfiest file
<manifest ... >
<uses-permission android:name="android.permission.INTERNET" />
...
</manifest>
Use this guide
http://developer.android.com/guide/webapps/webview.html
I have just started to do things with JavaFX and I'm trying to 'build' an browser. Right now I have a TabPane with two tabs. One tab has a WebView and the other tab is able to add new tabs. Over the TabPane is a Textfield. When I enter an internet adress I want to load a website in the selected Tab.
My Problem is, that I dont know how to get the Webview inside the selected Tab. I was able to get the selected Tab, but I have no Idea how to get the WebView inside it.
int index = TabPane.getSelectionModel().getSelectedIndex();
Tab selectedTab = TabPane.getTabs().get(index);
You could always call selectedTab.getContent(), and then navigate down through the scene graph hierarchy until you get to the right element. E.g. if your tab content is a BorderPane and the WebView is in the center you could do
BorderPane selectedBorderPane = (BorderPane) selectedTab.getContent();
WebView selectedWebView = (WebView) selectedBorderPane.getCenter();
This is pretty ugly code, though, and you'd have to rewrite it any time you changed the layout, which means your application becomes hard to maintain.
A (much) better way would be to create a variable at the appropriate scope (controller for the view that displays the tab pane, or the class that contains it if you're doing the layout in Java) for the current web view:
private WebView currentWebView ;
Then whenever you create a new tab containing a web view, add a listener to the tab's selectedProperty:
Tab tab = new Tab(...);
// ...
WebView webView = new WebView(...);
// ... layout, etc tab content, etc...
tab.selectedProperty().addListener((obs, wasSelected, isNowSelected) -> {
if (isNowSelected) {
currentWebView = webView ;
}
});
Now currentWebView always references the currently displayed web view. (You will also need to initialize it to the first web view displayed at startup.)