I used custom adapter for viewing listview. I tried to define my variables in adapter class but it didnt work. I find a temporary solution using invisible textview for this but i need to solve this problem. How can I overcome this?

Edit 1>

I have a column named date and this column contains datas like 20180723182036 and i grab this data to a list. I want to place this to listview as a variable and i will use this variable later.

My temporary solution is:

I have a code like that in database:

```
public ArrayList<SimpleNoteItem> getAllData() {
    openDatabase();
    ArrayList<SimpleNoteItem> newList = new ArrayList<>();
    String[] columns = {KEY_ROWTITLE, KEY_ROWCONTENT, KEY_ROWDATE, KEY_ROWSTRDATE};
    Cursor cs = db.query(DB_TABLE_NORMAL, columns, null, null, null, null, null);
    while(cs.moveToNext()){
        SimpleNoteItem allData = new SimpleNoteItem(cs.getString(0), cs.getString(1), cs.getLong(2), cs.getString(3));
        newList.add(allData);
    }
    Collections.reverse(newList);
    Log.d(LOGDB, "GETALLDATA STRUCTURE WORKS WELL!");
    return newList;
}

```

Listview longclick constructor is this:

```
simpleNotesDisplay.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
        @Override
        public boolean onItemLongClick(AdapterView<?> parent, View view, int position, final long id) {
            Log.d(TAG, "LONG CLICKED " + position + " ITEM!");
            //THIS AREA WILL BE EDITED FOR MORE ANDROID VERSION SUPPORT
            AlertDialog.Builder builder;
            final TextView getInvisibleDate = (TextView) view.findViewById(R.id.tv_date_invisible);
            builder = new AlertDialog.Builder(NotesActivity.this, android.R.style.Theme_Material_Dialog_Alert);
            builder.setTitle("Delete?")
                    .setMessage("Do you want to send this note to hell?")
                    .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            db.deleteSimpleNote(getInvisibleDate.getText().toString());
                            Log.d(TAG, "DELETING SUCCESSFUL ON ID = " + id + "!!!");
                            NotesActivity.this.recreate();
                        }
                    })
                    .setNegativeButton("No", new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            //empty
                        }
                    })
                    .show();

            return true;
        }
    });
}

```

And at least my invisible date:

```
<TextView
        android:id="@+id/tv_date_invisible"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:text="TextView"
        android:visibility="invisible"
        tools:layout_editor_absoluteX="351dp"
        tools:layout_editor_absoluteY="65dp" />

```

i hope it can help!