public Long typeId; @Override protected void onCreate(Bundle savedInstanceState) { listType = (ListView)findViewById(R.id.listType); userCursor = mSqLiteDatabase.rawQuery("Select * FROM table_type;", null); System.out.println("Найдено элементов: " + String.valueOf(userCursor.getCount())); listType.setChoiceMode(ListView.CHOICE_MODE_SINGLE); final String[] headers = new String[] {DBHelper.PROP_VALUE}; userAdapter = new SimpleCursorAdapter(this, android.R.layout.simple_list_item_single_choice, userCursor, headers, new int[]{android.R.id.text1}, 0); System.out.println(userAdapter); listType.setAdapter(userAdapter); listType.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long checkId) { Log.d(LOG_TAG, "itemClick: position = " + position + ", id = " + checkId); typeId = checkId; } }); } public void add_type(View view){ System.out.println(typeId); } There is a cursor code, an adapter and a listView filling itself, I can display a selected position with a log and transfer it to another activation, but I cannot understand how to transfer it to the button press method public void add_type (View view).