How to compare and get values from remote database - android

I am reading database values from MySQL on web in the form of ClickAble List.Show only one column value like "name".Now I want to read all values related to specific name like when Click on one name show all values related to that person.now I don't know how to get name from list and send to database and then read data only related to that particular name. Still don't try any code.....

Related

Receive a specific data from fire-base real time database using android

I develop an android application for students attendance according to their seat numbers. If the student entered his seat number, it will be stored into real time database in fire-base.
Now, what I need to do is to retrieve the empty seat numbers to a list view according to students' information. for example: database has 50 seat numbers entered, but seat number (25) is not in the database then it will be retrieved to the list view.
In general how can I do that with fire-base real time database?
This is how database looks like for one student
You will need to mark seat empty in your db to later only fetch the empty seats. In current situation there is no way to put a query which can retrieve data only for absent students.
Your screenshot is limited so I suggest this structure.
{lectureId}/
seatNumber: {
isEmpty: boolean,
.... your other data
}
Then you will use orderByChild("isEmpty").equalTo(false);
And for querying a set of data from realtime database, have a look at the docs:
https://firebase.google.com/docs/database/web/lists-of-data
you can use a boolean if student is present (present = true).
put this variabble in te object
then you can run a loop on datasnashot for
i < noOfSeats
and show in te ListView with a condition
if (!present){
showInList();
}

Compare a list of String values Firebase RealTime Database

Lets assume I have a List of String (ex: List<String>). I want to match all the Strings in the List to a particular attribute already present in the Firebase Database. How do I achieve this, as the equalTo() query only accepts a single String. I also don't want to generate as many queries as the List size. Any help would be much appreciated.

How to retrieve data from SQLite table with inserted values

I have dozens of data value that already inserted inside Database class that extends SQLiteOpenHelper, however I want to get the data values from it and not just to view but use the values, to calculate them. I've been reading lots of examples and following tutorials, but none of them ever explain how to get a data or some data and make a use of it (in my case, use them as java variables(get from inserted data then send to another class)). To take few (not all at once), select 1 or couple to be a multiplier for user input. My app will calculate pmt function, which the user will input the price and etc, then when the user press calculate the app (will do in background) access data from database class (the value that have been inserted) get them, send them via intent to another class, then calculate the database values along with user input.
In short, the app have stored values inside its database that will then be called whenever a button is triggered. Passing the existing values to another class.
I've tried this far My Previous post, click here
There I was trying to send a data (testing) from database to a class(that should have retrieved but it got null values)
The question:
How to get a data(datas) from a database which have inserted values to another class and make a use of it as some calculate-able values?
UPDATE:
I found out that the cursor getting null values, any ideas why?
thanks in advance.
Solution has been added on the above link, check on the answer.

fetching data from database and set it on edittext

I am doing a registration page for my application.For this I need to insert the registration details in to sqlite DB.Once the registration is done,the edittext fields should display those details fetching it from database and the submit button and text fields should be disabled to stop from a second time registration.Can anyone suggest the suitable way?
You can write/read into database easily: read this for more details: http://developer.android.com/guide/topics/data/data-storage.html#db
and this
http://mobile.tutsplus.com/tutorials/android/android-sqlite/
To get data from edit text, you can do this: myEditText.getText().toString()
Check code for database in the following link Android SQLite
You have to store the value in an arraylist and which is retrieved from database and set the value to the edit text as
// myarraylist is the arraylist which contains
// the data retrieved from database
editText.setText(myarraylist.get(0));
After the data is retrieved, you have to check the condition whether editText.getText().toString() length is greater then zero you should not allow them to edit the text in editText by using following
editText.setFocusable(false);

Using text file in SQLite

I am dealing with ECG signal processing using Android phone. I am getting the filtered ECG signal after the series of operations as my final output, and it is saved in text file in particular location. The text file contains the values of voltages in a single column, containing 30000 samples. This is done for number of patients.
Now I have to use these text files in my database with particular patients, as a entry in their row.
I am using SQLite database.
How can it be done?
please help me with this.
Read the file and save it as blob in sqlite, but if data is too large, you will have problems with size. Another way would b to keep the files in sdcard with some id as filename, you could save these ids in db which you can refer.
OK basically what you need to do is:
bulkinsert your data.
here is the link on how to do it:
http://notes.theorbis.net/2010/02/batch-insert-to-sqlite-on-android.html
if you need to populate your second table with this data then
update yourtable set blah=(select field from yourfreshlypopulatedtable)

Categories

Resources