How to get news from my website in my android application? - android

I have my own news website. Now I am making an android app version of it.
How do I pick up news from my website in my android app.
My website has a tile based format of news(with a picture and a headline over it).
Now I have made a front end version of it with blank picture tiles in my android app but how do I keep refreshing the news(picture+headlines) by picking the latest news from the website so that the tile changes automatically every time I change the news in my website.
I am new to android so a very specific answer with code would be appreciated.

As i've would have done it is:
You save the news items in your Database. Just connect your android app to your MySQL database and everytime someone opens the app call the Query of SELECT * FROM selected by last inserted or on date.
Goodluck.

Create an api that the app user will connect (most common is php) to your server (ex. ursite.com\getNews.php). This server api will then perform the query to your news collections and return the news article(image url & news contents) back to the app.

Related

How to take an image as an input from the user and view it in the database w/ Android Studio

I am trying to create an app using Android Studio. My client wants to create an app for their online medicines website, wherein the user can take a photo of their prescription, the photo will be accessible by the admins and they can use that image to understand what does the user require and deliver those medications at the user's doorsteps.
So can anyone please guide me through with making this page, or maybe share a link where the making of such a page is shown? Would be really helpful, thank you for giving me your time.
There can be several possible approaches for this type of questions/requirements. I am mentioning a few steps to guide you through the process.
You will have to create a webserver, which will be storing the user data (profile, uploaded prescriptions, etc.). The user data (textual) will be stored in the Database, however, the images will be uploaded in a directory over the server, and their corresponding links will be stored in the DB for reference.
There will be a webserver API which will fetch user data (user unique ID) from app and then store it in the DB. The image part can be accepted in several ways: MultiPart, Base64 encoded, Byte Array Converted
All these methods will send the image info from the android app to the webserver, which will follow the logic mentioned in Point 1 and save the image.
The Android app will have an activity where the user will either capture an image of the prescription form, using Camera, or can upload the image (if already captured/downloaded). You will have to learn doing this from similar links as these:
https://developer.android.com/training/camera/photobasics
Dialog to pick image from gallery or from camera
The Android app will send the unique ID of the user, along with the image data, to the Webserver API, which in-turn process as per Point 2.
You can start implementing the process and then can turn up to StackOverflow again for guidance. There are numerous tutorials to implement a similar functionality too.
https://www.simplifiedcoding.net/android-upload-image-to-server/
http://programmerguru.com/android-tutorial/how-to-upload-image-to-php-server/
https://www.codepool.biz/take-a-photo-from-android-camera-and-upload-it-to-a-remote-php-server.html
All the best!

Requirement of App synchronising Data, Images & Video

Thanks for reading this query.
I have received a requirement of Developing Android Tab & Mobile App for a Restaurant, which should work Offline.
Customer should be able see the list of Menu and details of each Menu Items. It will have Images, Videos, Ingredients for each Menu.
My question is, I would like to develop a Web Services which will take care of Adding new Menu including Images, Videos & other Informations. Restaurant people should be able connect online and Synchronise the new Menu. ( If Android is re-started, synchronised data should not be lost.)
Is this possible to store the new data in the App/Mobile?
For such App which framework is appropriate?
I hope to receive positive inputs.
Thanks in advance.
For consuming web services you might look into Retrofit.
Menu can be saved in the database. It will not be lost after device is restarted.
Each time when user opens the app if the network is available you can perform a check if you have the latest version of menu in the database.

How can I display whatever I need from website?

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.

How to extract data from website?

I want to create an Android App in which student can see their attendance. Actually attendance is updated daily in website as a database. In the website homepage student must enter their log in details such as Username, password and captcha. Then their profile is displayed in which their attendance can be seen. I want to extract the data alone (that is attendance percentage). I think the website uses .asp database. Anybody just give me an idea!
Also sorry if my question doesn't sounds good...
When you say, you are saving in DB, you mean you are saving in SQL Server DB or any other DB and your web App reads DB displays data. So definitely you can develop an android App to interact with that DB and show values in that App.
You could download data from particular user in JSON format.
It depends! Try to analyse the website, How credentials are verifying and interacting with the database. Firebug is a good browser plugin to do so. For achieving the purpose you need to make a script which will take the username, password and capcha to the database and after return you the attendance page.The most hard part is to reading capcha. here is good discussion over it.
Once you get the page you can scrap the page through beautiful Library called JSOUP in java. It is quite easy to learn. After getting the desired value after parsing, you can show the data as you want to show in your app.
Second option can be you anylyse the website extract that div which has the Credential thing and show only that div in webview, WebView has options to change UI element such as background and fonts. After successful Login and getting the result page, parse the information of your use and show the result as you want.
Lastly -The lazy way to do thing by using WebView for whole app. so every thing in webview after changing the UI. It will be same but with different look.

Need to implement an image selection dialog of web-based images

I am developing a chatting/messaging app and I want to let the user select an image that they've stored online (i.e. picasa, photobucket, flickr, etc) which will be shown as part of the chat User Interface for anyone that is chatting with the user.
For example:
User_A is messaging/chatting with
User_B.
User_B will see a small thumbnail
image of User_A
User_A will see a small thumbnail of
User_B.
note: my web server is facilitating the text exchange between the two users.
At first I thought I would implement a photo upload function in my app and store the photo's on my server that each client would download. But then I realized that this is just re-inventing the wheel because there are now a lot of online picture sharing services.
So I want my server to simply store the URL of the images that User_A and User_B have selected - my app is notified of the URL's and downloads the pictures.
However, how is this implemented ? (Specifically, the image selection to obtain the URL in a userfriendly manner)
I've visualized the following userfriendly use-case...
user opens the options activity in my
app and pushes the button to select
an image to present in the chat UI.
an intent dialog is shown with all of
the possible image hosting services
installed on the mobile phone
(picasa, photobucket, etc) - but
local storage shall not be shown.
the image picker of the chosen
application is shown and the user
chooses the image.
the image picker closes and returns
the URL to my app.
If this can't be implemented, then my only alternative (that I know of) is to have users copy'n'paste the URL of the image they want to use - which is not userfriendly on mobile devices.
Any help is greatly appreciated.
That doesn't seem very difficult to me.
You can predefine which Image hosting services you wish to use.
Picassa and Flickr have their APIs AFAIK.
Present user with an option to choose from your predefined offerings.
When they choose, present the album of the user.
When the user ends up selecting an image, Image hosting will let you know about their URLs (You can download all images of that album and display them natively in your app, it will fetch information about them, like their URL with them, which will be easy to track)
Get the URL, and update the chat webservice about it.
Create the Chat activity in a way that it polls your webservice after a particular interval to check whether any one of both the users involved in chat have changed their images. If they have, load the new one.
I can detail you on this if you have any doubts.

Categories

Resources