Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to access data stored from a row of two separate databases, having a common field value?
    primarykey
    data
    text
    <p>*Hi I am new to android development and I am no where a professional as you'll soon find out, anyways here's the problem I am having: I have two databases, namely 1->DatabaseClass and 2->TransactionDatabase The database DatabaseClass has an entry for bank_name field and account_number(and others, but it doesn't matter at this point). The TransactionDatabase also has a field for bank_name and account_number. A spinner item in transaction side holds the list of all bank_names, these names are accessed from the DatabaseClass, by using a cursor.The items selected from the spinner are stored in the TransactionDatabase. Now the user enters the account number for that selected bank in TransactionDatabase. If that bank's account number matches the account number added in the database 'DatabaseClass', all the fields contained in that "particular" row which has that "particular" account number should be picked up from both the tables and should be inserted in different strings. How can I compare the account_numbers ?, I collected the text contained in the edit text field named 'account number' in the transaction side.Also a bank name from spinner is selected. Now how can I get the account number from the 'DatabaseClass' corresponding to that bank name, for comparison? I used this to set up the bank name in spinner :* </p> <pre><code> SimpleCursorAdapter myAdapter; Cursor cursor = myDatabase.getData(); cursor.moveToFirst(); myAdapter = new SimpleCursorAdapter(AddTransaction.this, R.layout.spinnerlayout, cursor, new String[] { DatabaseClass.KEY_BANK_NAME_ID, }, new int[] { R.id.bankName }); mySpinner.setAdapter(myAdapter); </code></pre> <p><em>So far I am able to get the position of the item selected from spinner through the database DatabaseClass, please help me I am very confused.</em></p> <pre><code> int item = mySpinner.getSelectedItemPosition(); Cursor cursor = myDatabase.getData(); cursor.moveToPosition(item); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload