Iam currently developing an android e commerce application,were we have API to find/search products, but unfortunately the result are not correct/accurate.(Poor API).
So iam planning to download the entire list of products (Around 500-1000 products) as json file/format to device from server which consist of product_id and product_name and use some android auto complete method to search that product from json file.And i will keep flag whether new products have updated in backend , if so the json file get replaced.
**Is this a good method? Am i on right track. if not can you suggest some other methods and the procedure for doing AUTO Complete and product search.
Thanks in advance.
Related
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.
Hello I am beginner to Android development so I want to ask how to create dynamically changeable database (content) in Android?
I'm aware of sqlite shared preferences but how can I interact with them via internet and add new information like news apps? Could Parse help?
This is not a answer, but a comment rather, I don't have the 50 rep required to comment.
It all depends on the sort of functionality you want to achieve. I.e. do you want to be able to push new content to the device using the internet such as push notifications.
OR
Do you want the app to make a http connection to a api or your own news service on startup or on button press for example?
UPDATE
Ok you have decided you want something similar to option 2. I am not going to write code for you but I will point you in the right direction and if you get stuck, post a question.
Please take a look at:-
https://play.google.com/store/apps/details?id=com.rsoftware.news
If you have decided this is what you want or similar, this application uses an API calling infrastructure.
The API they use is called FAROO.
http://www.faroo.com/hp/api/api.html
I suggest reading the documentation, deciding if this is indeed what you want, then sign up and get a API key. Afterall it is free! enjoy coding, enjoy the errors that you will receive and persevere =).
How to make a API call
I suggest when using a API, test the queries through the browser first of all or use something like Runscope for testing their services. So first get their URL which is:-
http://www.faroo.com/api
If we were to go to this url we will get a 401 response code, which means unauthorised. This is because we haven't added our unique API key to the html query. So this url can take parameters. We simply append a ? to the end of the url and supply the parameters that FAROO offers such as:-
q which stands for query (what do you want FAROO to search for?)
start which is the number it should start from
length which is the number of results you want FAROO to return
key which is your unique to make the requests
etc etc...
So an example of a complete url would be:-
http://www.faroo.com/api?q=iphone&start=1&length=10&l=en&src=news&f=json
This url is for demonstration purposes... your own url will have a key=YourAPIKey
Also notice how the parameters are separated by & symbols i.e. q=iphone&start=1 so this part q we know stands for query which is iphone & start=1 & so on.
Hope this helps.
i'm developing an android application which allows different users to login and see a list of favourite songs.
Each user has its list of songs, and a song is an instance of the corresponding class Song, with some attributes (singer, year, title...). The MainActivity contains the form for the login, so the user has to set its Name and Password. After login, a second activity is started, and it contains the ListView with the user's favourite songs.
How can i associate a single user to its corresponding song's list?
I thinked to use a database to store the songs, but then?
Look at Parse it's very easy to use and let you focus on your android App, instead of spending much time writing and configuring a server-side application.
You need also to implement on your android application a service to handle json ( or xml, it's your choice ). This is an awesome library to handle json JSONP.
Look also to this link for an overview on RESTfulservices.
For example (getting user info):
You need an info on userA.
You format a json with the right info.
Start an http request to your server. It will answer you with another json containing some info.
Parse this json recieved and use the data in your app.
I hope I made myself clear.
Is there a way to integrate a mobile database for your app? If so, is it extremely hard? I have not yet started on any code, I just would like to know how it can be done and the measures that encompasses such a desire to integrate a database for the android app.
I would like to do the following:
A user would like to search for a restaurant nearby...they think they know the name of the restaurant, so they begin typing letters. If they type a U, all the restaurants that start with a "U" will show up. Once they find the restaurant they are looking for, they click on it and get the information.
Can this be done?
Thank you.
AFAIK, this is how it works, company who have database need to give you a URL which takes your search term as parameter and returns either XML (or) Json as response. You need to invoke that url by appending your search terms (entered by user) with help HTTPClient API from android, which return corresponding results either XML (or) Json. If Json response you can use android JSonObject api to parse the response. If XML response, you need to use SAX/DOM parsers.
I am making an app for my college where we have to parse RSS feed and display it. I am using SAX Parser to parse it and its working smoothly. Now I want two functionality in my app. First of all I want to run it as a service so that it may notify users about new events i.e new updates from RSS and how should I differentiate between the old RSS feed parsed and the new one so that I can show only the new updates.
Please give a overview on how can I implement these two things.
I don't know about the first question (how to make it a service) but I've done the second in a past life. The way I went about it was:
Compute the hash (sha1) from the title (you might want add other fields too)
Store the hash into a database along with time stamp
If the hash matches the entry in the database don't add it
if (3) fails add to database
Display everything in the database in descending order of timestamp (latest first)