I want my activity to link to a web page which I have created.
I want to create the web page contents in Android.
How is it possible?
A little unclear what your requirements are... But it sounds like WebView is probably what you are looking for.
It allows you to include web pages inside of your app. i.e. linking to a web from within a view, and stay within an app. This also allows you to potentially "create" content inside of an activity, save it to the file system and load it through your WebView. Otherwise, if you want to "create" content you can use your own homegrown web services to send content to a remote server to then accessed by your webview, or through the regular browser.
If you are just trying to open a link from your app in the standard browser try looking using intents. See here for an example.
Related
I was wondering if there is a best practice in Android about WebView/Browsers. I want to open an url in my app to show a web page but I do not have anything to retrieve from that page so I do not need to show it in a webview inside my app. Should I show that page in a browser or in a webview ?
If you should open an URL in WebView or Browser that totally depends upon your requirements. Still I am adding some points that you can consider:
Browser:
If you have some data like Privacy Policy of your organization, that just for user information. You do not require any inputs from user.
WebView:
If you want to,
Customize content of URL
Get some input from User
Send some information to Server
Thank You!
Quick Answer:
From your context, it looks going the Browser way is good enough.
Details:
When you don't have user inputs to process and it is not part of the user-flow in your app, go about showing it in the Browser. It's easier that way, because you don't have to manage anything explicitly.
When you have something to process or that this window is some part of your in-app flow, you should go the WebView way. It gives you the power to manage things and you really need to code of situations like user pressing "back button", and the like. I mean, you're the owner of the life-cycle management of the WebView and see how it seamlessly fits in your user flow while (s)he is at it.
I have a website with a button that when clicked displays a message.
My site example: http://catcheat.net/Test/test.html
I am creating an application which should show the message that the button of my site has generated.
I wanted to know if there is some way that allows me to press that button (and then generate the text) without having to open the browser??
And most of all I wanted to know if you can take the text that was generated from the button and show it in my app (without opening the browser of course)??
I'm not sure I quite understand your question, but here I will try
As said JSoup is a Java library providing a set of API to extract and manipulate HTML files. There are several methods to read and parse an HTML page; in our case we want to retrieve it from a remote server and then we have to provide an URL.
For more information visit link
As shown here it is possible to:
1. Create an Android WebView with setJavaScriptEnabled=true
2. Load a URL
3. Override onPageFinished and change the Web page displayed to the user
Now, is it possible for the Web page owner to implement anything server-side which prevents this from happening? The risk is that a malicious app could spoof the user by amending the Web page for nefarious means...
Many thanks!
It is not really possible to prevent the web response being modified. You can only think of making it difficult for the spoofer to edit it.
I'm developing an app that we will put on Android tablets on be used by employees in the field. We want to lock down internet access as much as possible to minimize data usage (so that the employees can't go streaming Netflix movies or something and driving up our data usage). As part of that effort, I'd like to have http(s)?:// links open up in a custom activity I made. Now, I can easily do that by registering the activity with an intent filter on the http/https schemas, but I'd prefer not to have the user have to choose between browsers when opening a link, and I don't want my activity to become the default activity for every link (there may be situations in which the user should be using the Android browser).
Is there a way to set up my activity as the http handler...but only for links launched from my app?
Is there a way to set up my activity as the http handler...but only for links launched from my app?
If the links are from your app, just use startActivity() with an Intent identifying your activity, rather than some generic Intent like ACTION_VIEW.
If your issue is that you are displaying the Web content in a WebView and links clicked there lead to the browser, use setWebViewClient() along with a WebViewClient implementation that handles shouldOverrideUrlLoading().
I want to develop an android application that will access web pages.Like my browser will first load "www.mail.yahoo.com".then it automatically set yahoo id and password that i will tell from my program.then it will automatically click in sign in to sign in.Like web browser control in visual basic 6 or in c# application.In android i can browse pages using web view but not getting any way to access html content as i have been trying for a week.If any body will help it will be great pleasure.
Thanks
You can use WebView for accessing URLs and let the users see the content.
A poorman's solution to get the HTML is to open the URL with another HttpConnection in another thread and read the contents of it. just because I haven't find any other way to access the HTML that is loaded in the WebView