Android database from website - java

i was wondering a few things.
I Have a database with 3 rows, and i have to use the database on my website cause it has to be shared with every one that downloads my app cause they can add more things.
Table is called
Poka
And the rows are
- ID
- word(TEXT)
- reply(TEXT)
The Reply is hooked onto the word.
Sense there can be more then 1 of the same "word" text i need it to search threw each of the word that was inputed in the EditText and pick a random reply from that and display it in EditText . And if there are no words, it will say cannot find one.

for that you have to use text box edit listener whenever the value of text box changes call the web service that give you response depend on what you send to it and then pass that response to text box.
refer therefer the answer of the question
in above link I explain the answer with code.Using that that code you can definitely do that.
the main thing is built web service so that it give you proper response.Just return table of words from the web service then catch that table get relevant column data and show it in your application.
obj3.getProperty(0).toString();//id
obj3.getProperty(1).toString();//word
If you returning id and word nad you want only word column then you can choose
obj3.getProperty(1).toString();//word
all the answer is explain in above link.refer that too.
Please write comment if you are facing more problem in that.

Related

Search automatically on website and get their content

For my project, i need to insert an EAN (Productcode like 4009900508599) on this website: codecheck.info
In a normal case it isnt really an problem, because you can send the content directly to the website.
On this website, the call is:
https://www.codecheck.info/product.search?q=4009900508599&r=03AOLTBLSbwq8TlZl9bDf72tOekXcyrp8vCBu6pgfYvI-0fuFv40FWCX5XX5Z9DTOlo0J-l3WGmSRRUMmxGLl_oO9miNeJExZsrZwbaFFDovw5FrOMaM2CeuOTFQOMr4q__ixGx7jV7509DF_y7Y19maVN40kuCrjIE7JCV7p3uiu4DhOgU6BVlW8O5yrx8px7_fknOwseOiLXIFbxDlbZ6nD-67765YdL6zOiyoH3nHL1LO1L0_GQQkPOrP3QnjXHjjaDzg_RYT48cvkGnt3ER-8AUwB9LPwP-9OJp4uWzxtG-TiWngZEwzcJDJS4FEfsd2Xq2taU7sOhZquEiwi4pFdXQgAwb0PRYNEv9GR1tBb0LYnHUiF9LLMwOhvL3pnaididlwl--jMP_-ZvSnK04EHIKYKQm5CLPbgcfs68iC4GtWnLv63g6hD_W_1kElHdhR3rT_VdAhkjESo7CGcmUyKJ_TVw3Xy4rOZS8t3TCJSux98-otnmJh4
With q=03A... they generate some stuff, that i cant know.
So my question is, does someone know a way to insert the number into the searchbox automatically and get their content?

Android - send / receive data to online mysql database

I have an edit text and a button when the user type for example the word "hi"
I want to make when he clicks on the button the following steps
get the word in the edit text send it to mysql online database
on the database I will be having many conditions if the word is for example "hi it will send "hello" .. if "how are you" I'll send "good"
the the app receive the new string and print it.
what can i do is getting the text from the edit text and printing it
but how to send a certain value to online mysql database and if it is equal to the stored value it receive another value ?
What you are asking is very basic , a little try and you can do it yourself. Basically you need to take values from your EditText fields using getText method, then you will call a php , other server end api to send these values to your server using get or post methods .
Refer this link for more help this link

faceBook auto shows your friends Name while tagging or mensioning

when we add any status in facebook, it auto shows your friends Name, if name is half then it complete, it also gives us place name . HOw? I want to implement in my app like that it will search automatic its name to whose we want to tag after few word. plz help
Use > AutoCompleteTextView
it shows completion suggestions automatically while the user is typing.
Look here
https://github.com/linkedin/Spyglass
read all documentation, every thing is here

I want my old data even I refresh the webpage

First Question:
Consider, I am filling any form then I refresh that page,what I want is what ever I fill in that page should not clear not only refresh page even if network problem occurred during filling the form.
Second Question:
If I login with any username and password then I fill in form and if network problem occurrs during filling the form then I go to another machine and login with same username password, I want whatever I entered In previous system should be show in this machine.
Sorry for my poor english, please tell any idea.
You should try and leverage client side storage. This will allow you to store the user data on the local browser. Here is an article on this http://www.html5rocks.com/en/tutorials/offline/storage/
I hope it helps
Fixing the following requires:
1 - Background worker on the client side that posts the data to the server .
Worker;
//or
window.setInterval();
2 - A banner or a status div showing the user that he is connected or disconnected.
var isOnline = window.navigator.onLine;
3 - Notify the user about reloading the page.
window.addEventListener("beforeunload", function (e) { alert('Your leaving...') });
Your first question has a pretty simple and straightforward solution: you'd want to save the data on the local machine, using something like cookies or localStorage.
For your second question, you'd need a much more complicated solution. Basically, you need to constantly persist the view data (input values, etc.) to the server for "safekeeping", since you assume the machine might crash at any given moment.
So your backend should support saving "temp form data", and whenever a user enters the relevant screen, you need to check for such temp form data on the backend, and populate the form accordingly. This will probably cause lots of edge cases and isn't trivial IMO.

Showing Suggestions below text field taking values from database

I am having a form. I want to show user suggestions about the name of the security he can enter. For the same I want to use the values of securities that I have installed in my Oracle Database.
I want to do something like this, if user enters a, he should get all security names below the text field which starts from a, when user selects anyone of them, then the text field must show the selected values.
Thanks in Advance.
You need autocomplete enabled text field. There's a tutorial how to build one. Even better, use jQuery java script library for this and many other features.
I'd suggest a trie. They are great for things like predicive text and auto complete.
Get all the valid security names and put them into the trie, then query the trie with whatever prefix the use has entered and it will give you all the matching names.
Note that Java doesn't come with a Trie implementation itself buy it would be pretty easy to write your own or borrow one, for eg from here; http://forums.sun.com/thread.jspa?threadID=5295936
Edit: You didn't say if this was going to be on the web or desktop (eg Swing)....

Categories