There is a method:
//Метод формирования ListView Расходов private void setupLVtableCost() { //Формируем столбцы сопоставления String[] from = new String[]{db.COST_TABLE_NAME, db.COST_TABLE_SUMM, db.CURRENCY_TABLE_SHORT_NAME, db.CATEGORY_TABLE_NAME, db.WALLET_TABLE_NAME, db.COST_TABLE_DATE}; int[] to = new int[]{R.id.cost_lv_item_name, R.id.cost_lv_item_summ, R.id.cost_lv_item_currency, R.id.cost_lv_item_cat_name, R.id.cost_lv_item_wallet_name, R.id.cost_lv_item_date}; // создаем адаптер и настраиваем список scAdapterTableCost = new SimpleCursorAdapter(getActivity(), R.layout.item_cost, null, from, to, 0); //Привязываем адаптер в Листу lvCost.setAdapter(scAdapterTableCost); // добавляем контекстное меню к списку registerForContextMenu(lvCost); // создаем лоадер для чтения данных loaderCost = getActivity().getSupportLoaderManager().initLoader(Constants.LOADER_ID_TABEL_COST, null, this); } He works here no questions. It is necessary for the same example to build another list, "translation". The hitch is that I need information from the same field, but for different wallets (related to another table). It turns out you need to specify the field where to get the info and ID where to insert, but the field with the name of one. How to specify that in the first ID you need a name from the first key, and three times from the second?
//В формировании курсора надо заполнить 2 массива - это не работает, как правильно? String[] from = new String[]{db.WALLET_TABLE_NAME, db.WALLET_TABLE_NAME, db.TRANSFER_TABLE_SUMM, db.CURRENCY_TABLE_SHORT_NAME}; int[] to = new int[]{R.id.trans_wall_name_one, R.id.trans_wall_name_sec, R.id.trans_summ, R.id.trans_wall_curr}; request:
select * from transfer t, wallet w1, wallet w2 where t.wall_id_one=w1._id and t.wall_id_sec=w2._id
from. - Yura Ivanovselect w1.id as w1id, w2.id as w2id...and then inString[] from = new String[]{"w1id","w2id"....}- Yura Ivanovselect *needs to be rewritten, specifying an alias for each of your fields. Otherwise, SQLite duplicates the column names for you (two times id, two times name, etc.), the other subd would either give an error, either display only one column, or come up with an alias of name_1 themselves. - Yura Ivanov