Android - Retrieving data from SQLite database, based on onclick listview
<p>so my problem is that I need to retrieve data from database to one specific pre-define activity. When i click on any item from listview it will every time show the same activity just fill with different data. Item 1 has different data then item 2. I've already had the saving data and opening specific pre-define activity. But I don't know how to fill the activity with my data. I'm starting to be desperate. So i would be gratefull for any help.</p>

<p><strong>this is my code</strong> 
<strong>DataListActivity.java</strong></p>

<pre><code>public class DataListActivity extends AppCompatActivity {
    ListView listView;
    SQLiteDatabase sqLiteDatabase;
    DbOperace dbOperace;
    Cursor cursor;
    ListDataAdapter listDataAdapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.data_list_layout);

        listView = (ListView) findViewById(R.id.lis_view);
        listDataAdapter = new ListDataAdapter(getApplicationContext(),R.layout.row_layout);
        listView.setAdapter(listDataAdapter);

        dbOperace = new DbOperace(getApplicationContext());
        sqLiteDatabase = dbOperace.getReadableDatabase();
        cursor = dbOperace.getInformations(sqLiteDatabase);

        if (cursor.moveToFirst())
        {
            do {

                String kod,den;
                kod = cursor.getString(0);
                den = cursor.getString(1);
                DataProvider dataProvider = new DataProvider(kod,den);
                listDataAdapter.add(dataProvider);

            }while (cursor.moveToNext());
        }

        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
                Intent intent = new Intent(DataListActivity.this, RetrieveData.class);
                intent.putExtra("data", listView.getSelectedItemPosition());
                startActivity(intent);
            }
        });


    }
}
</code></pre>

<p><strong>Retrieve Data</strong></p>

<pre><code>public class RetrieveData extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_retrieve_data);
        Bundle bundle = getIntent().getExtras();
        if (bundle != null) {
            DataProvider dataProvider = bundle.getParcelable("data");
        }
    }
}
</code></pre>

<p><strong>DataProvider.java</strong></p>

<pre><code>    package jansoldat.formular100;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Created by Monsignore Frajeris on 02.08.2016.
 */
public class DataProvider implements Parcelable {

    private String kod;
    private String den;

    public String getKod() {
        return kod;
    }

    public void setKod(String kod) {
        this.kod = kod;
    }

    public String getDen() {
        return den;
    }

    public void setDen(String den) {
        this.den = den;
    }

    public DataProvider(String kod, String den)
    {
        this.kod=kod;
        this.den=den;

    }

    protected DataProvider(Parcel in) {
        kod = in.readString();
        den = in.readString();
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(kod);
        dest.writeString(den);
    }

    @SuppressWarnings("unused")
    public static final Parcelable.Creator&lt;DataProvider&gt; CREATOR = new Parcelable.Creator&lt;DataProvider&gt;() {
        @Override
        public DataProvider createFromParcel(Parcel in) {
            return new DataProvider(in);
        }

        @Override
        public DataProvider[] newArray(int size) {
            return new DataProvider[size];
        }
    };
}
</code></pre>

<p>RetrieveData.xml</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;ScrollView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/scrollView"
    xmlns:android="http://schemas.android.com/apk/res/android"&gt;


    &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"
        tools:context="jansoldat.formular100.MainActivity"&gt;


        &lt;TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Úsek komunikace:"
            android:id="@+id/textView81"
            android:textStyle="bold"
            android:textSize="20dp"
            android:textColor="#870b0f"
            android:layout_marginTop="30dp"
            android:layout_alignParentTop="true"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true" /&gt;

        &lt;EditText
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/editText_Usek_komunikace"
            android:layout_below="@+id/textView81"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true" /&gt;

        &lt;TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Kód úseku komunikace:"
            android:id="@+id/textView82"
            android:layout_column="0"
            android:textColor="#870b0f"
            android:textStyle="bold"
            android:layout_below="@+id/editText_Usek_komunikace"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:layout_marginTop="15dp" /&gt;

        &lt;EditText
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/kod"
            android:layout_below="@+id/textView82"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true" /&gt;

        &lt;TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Kódy sousedících objektů/ komunikací"
            android:id="@+id/textView83"
            android:layout_column="0"
            android:textColor="#870b0f"
            android:textStyle="bold"
            android:layout_below="@+id/kod"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true"
            android:layout_marginTop="15dp" /&gt;

        &lt;TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="na počátku úseku komunikace:"
            android:id="@+id/textView84"
            android:layout_column="0"
            android:textColor="#870b0f"
            android:textStyle="bold"
            android:layout_below="@+id/textView83"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:layout_alignRight="@+id/textView81"
            android:layout_alignEnd="@+id/textView81"
            android:layout_marginTop="10dp" /&gt;

        &lt;EditText
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/editText3"
            android:layout_below="@+id/textView84"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:layout_alignRight="@+id/textView84"
            android:layout_alignEnd="@+id/textView84" /&gt;

        &lt;TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="na konci úseku komunikace:"
            android:id="@+id/textView85"
            android:layout_column="0"
            android:textColor="#870b0f"
            android:textStyle="bold"
            android:layout_below="@+id/textView83"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true"
            android:layout_toRightOf="@+id/textView86"
            android:layout_toEndOf="@+id/textView86"
            android:layout_marginTop="10dp" /&gt;

        &lt;EditText
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/editText4"
            android:layout_below="@+id/textView84"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true"
            android:layout_alignLeft="@+id/textView85"
            android:layout_alignStart="@+id/textView85" /&gt;

        &lt;TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Součást měřené trasy/ lokality:"
            android:id="@+id/textView86"
            android:layout_column="0"
            android:textColor="#870b0f"
            android:textStyle="bold"
            android:layout_below="@+id/editText3"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:layout_marginTop="15dp" /&gt;

        &lt;EditText
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/editText5"
            android:layout_below="@+id/textView86"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true" /&gt;

        &lt;TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="GPS souřadnice"
            android:id="@+id/textView87"
            android:layout_column="0"
            android:textColor="#870b0f"
            android:textStyle="bold"
            android:layout_below="@+id/editText5"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:layout_marginTop="15dp" /&gt;

        &lt;TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="počátek měřeného úseku:"
            android:id="@+id/textView88"
            android:layout_column="0"
            android:textColor="#870b0f"
            android:textStyle="bold"
            android:layout_below="@+id/textView87"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:layout_marginTop="10dp"
            android:layout_marginLeft="10dp" /&gt;

        &lt;EditText
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/editText6"
            android:layout_alignParentStart="true"
            android:inputType="numberDecimal"
            android:digits="0123456789,.°&amp;apos;"
            android:layout_below="@+id/textView88"
            android:layout_alignParentLeft="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp" /&gt;

        &lt;TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="konec měřeného úseku:"
            android:id="@+id/textView89"
            android:layout_column="0"
            android:textColor="#870b0f"
            android:textStyle="bold"
            android:layout_below="@+id/editText6"
            android:layout_alignParentLeft="true"
            android:layout_marginTop="10dp"
            android:layout_marginLeft="10dp" /&gt;

        &lt;EditText
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/editText7"
            android:digits="0123456789,.°&amp;apos;"
            android:inputType="numberDecimal"
            android:layout_below="@+id/textView89"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp" /&gt;

        &lt;TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Mapové schéma:"
            android:id="@+id/textView90"
            android:layout_column="0"
            android:textColor="#870b0f"
            android:textStyle="bold"
            android:layout_below="@+id/editText7"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:layout_marginTop="15dp" /&gt;

        &lt;ImageView
            android:layout_width="250dp"
            android:layout_height="250dp"
            android:id="@+id/imageView_mapa"
            android:contextClickable="false"
            android:adjustViewBounds="false"
            android:background="#850202"
            android:layout_below="@+id/textView90"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="10dp" /&gt;

        &lt;TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Měření provedl(i):"
            android:id="@+id/textView91"
            android:layout_column="0"
            android:textColor="#870b0f"
            android:textStyle="bold"
            android:layout_below="@+id/imageView_mapa"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:layout_marginTop="15dp" /&gt;

        &lt;TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="dne:"
            android:id="@+id/textView92"
            android:layout_column="0"
            android:textColor="#870b0f"
            android:textStyle="bold"
            android:layout_above="@+id/editText8"
            android:layout_toRightOf="@+id/textView86"
            android:layout_toEndOf="@+id/textView86" /&gt;

        &lt;EditText
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:inputType="date"
            android:ems="10"
            android:id="@+id/editText8"
            android:layout_below="@+id/textView91"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:layout_alignRight="@+id/textView88"
            android:layout_alignEnd="@+id/textView88" /&gt;

        &lt;EditText
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/den"
            android:layout_below="@+id/textView92"
            android:layout_alignLeft="@+id/textView92"
            android:layout_alignStart="@+id/textView92"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true" /&gt;

        &lt;TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Délka úseku komunikace:"
            android:id="@+id/textView93"
            android:layout_column="0"
            android:textColor="#870b0f"
            android:textStyle="bold"
            android:layout_alignParentStart="true"
            android:layout_below="@+id/den"
            android:layout_alignParentLeft="true"
            android:layout_marginTop="10dp" /&gt;

        &lt;EditText
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/editText10"
            android:layout_alignParentStart="true"
            android:inputType="numberDecimal"
            android:digits="0123456789,.m"
            android:layout_below="@+id/textView93"
            android:layout_alignParentLeft="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true" /&gt;

        &lt;TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Typ komunikace:"
            android:id="@+id/textView94"
            android:layout_column="0"
            android:textColor="#870b0f"
            android:textStyle="bold"
            android:layout_below="@+id/editText10"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:layout_marginTop="15dp" /&gt;

        &lt;TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Materiál povrchu:"
            android:id="@+id/textView95"
            android:layout_column="0"
            android:textColor="#870b0f"
            android:textStyle="bold"
            android:layout_below="@+id/radioGroup3"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:layout_marginTop="15dp" /&gt;

        &lt;RadioGroup
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/radioGroup3"
            android:layout_below="@+id/textView94"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:layout_marginTop="10dp"&gt;

            &lt;RadioButton
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="pás pro pěší (chodník)"
                android:id="@+id/radioButton"
                android:checked="false" /&gt;

            &lt;RadioButton
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="stezka pro chodce (označeno značkou C07)"
                android:id="@+id/radioButton2"
                android:checked="false" /&gt;

            &lt;RadioButton
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="stezka pro chodce a cyklisty ( označeno značkou C09 nebo C10)"
                android:id="@+id/radioButton3"
                android:checked="false" /&gt;

            &lt;RadioButton
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="nezpevněná komunikace (pěšina, polní cesta...)"
                android:id="@+id/radioButton4"
                android:checked="false" /&gt;

            &lt;RadioButton
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="pěší zóna (označeno značkou IP27)"
                android:id="@+id/radioButton5"
                android:checked="false" /&gt;

            &lt;RadioButton
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="obytná zóna (označeno značkou IP26)"
                android:id="@+id/radioButton6"
                android:checked="false" /&gt;

            &lt;RadioButton
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="pohyb po motoristické komunikaci (krajnice...)"
                android:id="@+id/radioButton7"
                android:checked="false" /&gt;
        &lt;/RadioGroup&gt;

        &lt;Spinner
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/spinner2"
            android:layout_below="@+id/textView95"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true" /&gt;

        &lt;EditText
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/editText11"
            android:visibility="visible"
            android:layout_below="@+id/spinner2"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true" /&gt;

    &lt;/RelativeLayout&gt;


&lt;/ScrollView&gt;
</code></pre>

<p><strong><em>EDIT 3</em></strong>
<strong>ListDataAdapter</strong></p>

<pre><code>public class ListDataAdapter extends BaseAdapter{
    DbOperace dbOperace;
    Context context;
    SurfaceHolder newViewHolder;
    SQLiteDatabase sqliteDatabase;
    List newsList = new ArrayList();
    ArrayList&lt;ClassA&gt; list = new ArrayList();


    public class NewViewHolder
    {
        TextView kod,den;
    }


    @Override
    public long getItemId(int position) {
        return list.get(position).getId();
    }
    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }


    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View new_view = convertView;
        try {
            LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

            if (new_view == null) {

                new_view = inflater.inflate(R.layout.row_layout, null);

                newViewHolder = new NewViewHolder();
                newViewHolder.kod =((TextView) new_view.findViewById(R.id.t_kod));
                newViewHolder.setTag(newViewHolder);



            } else {
                newViewHolder = (NewViewHolder)new_view.getTag();
                newViewHolder.kod.setText ="your text";
            }

            // set parameters here



        } catch (Exception e) {

        }
        return new_view;
    }}
</code></pre>

<p><strong>ClassA</strong></p>

<pre><code>public class ClassA {
    private long id;

    public long getId()
    {
        return id;
    }

    public ClassA(long id)
    {
        this.id=id;


    }
}
</code></pre>

<p><strong><em>EDIT 4</em></strong></p>

<pre><code>import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RadioButton;

public class RetrieveData extends AppCompatActivity {
    EditText usek_kom,kod_1,pocatek_1;



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_retrieve_data);


        usek_kom = (EditText) findViewById(R.id.usek_komunikace1);
        kod_1 = (EditText) findViewById(R.id.kod_1);
        pocatek_1 = (EditText) findViewById(R.id.pocatek_1);





        Bundle bundle = getIntent().getExtras();
        if (bundle!=null){
            DataProvider dataProvider = bundle.getParcelable("data");
            usek_kom.setText(dataProvider.getDen());
            kod_1.setText(dataProvider.getKod());
            pocatek_1.setText(dataProvider.getUsek_komun());




        }
    }
}
</code></pre>