How can I display whatever I need from website? - android

I have developed some company website in that i had careers option.now using text view i am displaying job openings,but when they update in website app also should get update and if they want to post in app only means how i update or post job opening after placing in google play store. please explain with code.
WebView webView = (WebView)findViewById(R.id.wv);
webView.loadUrl("http://www.emergtechinc.com/Careers/careers-cjo.aspx");
I used webview and displayed the currenopenings page. Is it right but I got whole website page. How can I display whatever I need from website?

If you want to load specific data only, I would suggest an API on the backend of your website. Create a specific Activity in you app that queries the API, which would return data for job postings, and display it in any manner you would like.
If you want users to post to the site from the application, you will also need an API to handle the post.
#Prerak's answer will work as well and be less code than the method I am suggesting.

Related

In android studio with java How to load web text as string from an activity for Android 6+ devices

From an Activity, How can I retrieve code or text from a website and display to the user ? I'm having difficulties programming back to Android, now developing as for Android 6.0 and newer. Getting deprecated about http client etc.. so I need a little of help.
Can you paste me some code example including "imports" in order to when the app load, from an Activity class, and also when a user click a "button1", to retrieve the text displayed from a web say "yahoo.es", and show a message to the user with the text from the web (loaded and parsed to a string) using Toast.
Help much appreciated in advance
Firstly you are way too ambiguous about your question. Correct me if i am wrong, what you basically want is to get data from internet and display them to user. Right.
If Yes, then the best way to do this is to get JSON response and parse it to display the relevant information onto the screen.
Take for example, you want an App displaying current Weather status of a city.Then to get the Weather data from Internet you need to connect to those websites which provide you that data.
Now one such website is OpenWeatherMap.org. You can use its APIs to retrieve data in JSON format and then display. You need to go through its API documentation.
This is link which will explain you the full process of connecting to an website's API, its retrieval of Data in Json format and ways to render and display them on screen effectively.
https://www.udacity.com/course/android-basics-networking--ud843
Hope it helps.

How to get entire news content from a news website

I am planning to make a desktop application which will have 5 regional newspapers and the user can select either of them to read it.
I need seperate colums such as Opinion,Editorial,Breaking News,Sports,etc. which means I need data of their every column.
But when I visited few papers' websites,they are just giving the headline, one line description and a link to read more as xml feed.On clicking the link the user is directed to their website.
I have seen many android applications like news Hunt ,World news,etc , which show the entire content.How do they do it?Are they using any backdoor or hack or something?
Use Jaunt Api .
The Api has easy-to-learn structure and also the code is efficient as well as fast.
You should give it a try.
Try to use a third service like
http://import.io/ or http://www.mozenda.com
As you said apps like Flipboard, Breaking news sport etc are based on services like import.io
With this you can transform information from the web into usable data easily !
Some of this app used JSON in retrieving the content from the web and pass into android app. check this link
They use an API that allows them to retrieve news (load from a server).
For example yahoo, google, etc
Not tested yet but it works (I'm sure) see yahoo API
In your case, You should write another view to display news details according to the news ID: Read their documentation carefully
Some Websites will write their own public API, which everyone can access with some HTTP header values sent. After sending HTTP request, they return the response in XML / JSON formats which you have to parse them inside your Android app and produce them on UI.
If in case they do not provide any API as such, then you need write a server side Crawler which crawls and parses the information(HTML Tagged information) from their websites and store them. Again then you need to write your own Web services(RESTful / SOAP) that send the parsed information to Android app via URL's or something.
This can be achieved using RSS feed.
visit here and see page source, here you can get all news in item tags like this
<item>
<title>..</title>
<description>...</description>
</item>
where each item tag is for each news, you can fetch both title and description from there.
and you can get data from any link using HTTPPOST or HTTPGET mehods

Recommended way to login to a website through an application

My application has to login to a website by posting a form, and keep track of the cookie provided till the application is terminated.
I have achieved this using the "WebView" class. I have doubts on weather this is the most efficient way to achieve this as I do not wish to display any webpages but Simply submitting another form once logged in.
Is their any other solution/Classes that can handle this with less traffic (smaller footprint)?
You can submit data to the login form just as you can to any other.
Using the HTTP library you can add a payload (of type x-www-form-encoded) to a RequestEntity. The JavaDocs are fairly clear on how to do this.

Allow Android SDK to search through website?

Let's say there's website X. Website X has a search function that'll return articles/documents/whatever. Whatever it returns will include a link so the user could click on it to go to said article. All of this would be without an API. Would it be possible for an android application to query a search on a random website, get the results and display them in the app, without the user actually seeing the website?
Yes, of course. All you want to do is write the app such that it performs the query to the website on behalf of the user; that way it gets the HTML response. When it gets the HTML page as a response, you parse that and reformat it into something more appropriate for the app.
Look at this SO question if you want more information on HTML parsers in Java: Parse HTML in Android

Best way to show updated results

Hey basicaly im developing an application for the rugby team i play for and need a way to display match results is there a way to update these easily within an application? or is it best to just use web view and link it to a html page i'd rather they didnt have to load a web page each time if at all possible but at the same time thats better than doing a full app update each week.
Thanks in advance
Ashley Waters
Use xml parsing, in your app and check on each launch of your app if your live xml is updated, otherwise save the data and keep showing that data on your app.
For that you have to create a web-service which throws/get request/response either in XML or JSON. While getting response you have to parse XML or JSON and display it inside the application.
If you want to update the application by making web call automatically then implement Background call and set timer for service so that it continuously check whether any data is updated at web or not.

Categories

Resources