how can retrieve data from sqlite?
<p>this is my main activity ,databse,and layout code ,
i am trying to to retrive data from SQLite databse but this code is not working .i do not understand why?? 
this problem taking so much time i am so upset plese help me . i am new in android .</p>

<p>main activity file!!</p>

<pre><code>     public class MainActivity extends AppCompatActivity {

    EditText name;
    EditText phone;
    Button submit;
    Button data;
    TextView tName;
    TextView tphone;
    Cursor getData;
    String dbString="";
    String dbString2="";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


            name=(EditText)findViewById(R.id.editText);
            phone=(EditText)findViewById(R.id.editText2);
            submit=(Button)findViewById(R.id.button);
            data=(Button)findViewById(R.id.button2);
            tName=(TextView)findViewById(R.id.textView);
            tphone=(TextView)findViewById(R.id.textView2);

        data.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                DataBase2n6 objOfDataBase2n6=new DataBase2n6(getBaseContext());
              Cursor  getData = objOfDataBase2n6.showData();
                getData.moveToFirst();
               do{
                   dbString+=getData.getString(getData.getColumnIndex("name"));
                   dbString+="\n";
                   tName.setText(dbString);
                }while(getData.moveToNext());

                Toast.makeText(getBaseContext(), "YOUR DATA", Toast.LENGTH_LONG).show();
            }
        });

        submit.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String getName=name.getText().toString();
                String getPhone=phone.getText().toString();

                DataBase2n6 objOfDataBase2n6=new DataBase2n6(getBaseContext());

                objOfDataBase2n6.insertData(getName,getPhone);
                Toast.makeText(getBaseContext(), "data is inserted", Toast.LENGTH_LONG).show();
            }
        });

    }
}
</code></pre>

<p>database file!!</p>

<pre><code>    public class DataBase2n6 extends SQLiteOpenHelper {
    SQLiteDatabase db;
    public static final String DATABASE_NAME="myDatabase.db";
    public static final String TABLE_NAME="myTable";
    public static final String NAME="name";
    public static final String PHONE="phone";
    public static final int DATABASE_VERSION=1;

    public DataBase2n6(Context context) {

        super(context,DATABASE_NAME,null,DATABASE_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        try {
            db.execSQL(//"create table" + TABLE_NAME + "(" + NAME + "," + PHONE + ")"
            "create table myTable" +
                    "(id integer primary key, name text, phone text)"
            );
        }
    catch(android.database.SQLException e){
        System.out.println("what the fuck");
    }
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

        db.execSQL("DROP TABLE IF EXISTS myTable");
        onCreate(db);
    }

    public void insertData(String nam,String mob){
        db=this.getWritableDatabase();
        ContentValues contentValues=new ContentValues();

            contentValues.put(NAME,nam);
            contentValues.put(PHONE,mob);

            db.insert(TABLE_NAME, null, contentValues);
            db.close();
        }

    public Cursor showData(){

        db=this.getWritableDatabase();

        Cursor res =  db.rawQuery("SELECT  * FROM "+TABLE_NAME,null);
        return res;

    }
}
</code></pre>

<p>layoyt file!!</p>

<pre><code>&lt;RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_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="com.example.firstproject.start2_6_16.MainActivity"&gt;

    &lt;EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/editText"
        android:layout_alignParentTop="true"
        android:layout_alignParentStart="true"
        android:hint="name"/&gt;

    &lt;EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/editText2"
        android:layout_below="@+id/editText"
        android:layout_alignParentStart="true"
        android:hint="phone"
        android:layout_marginTop="55dp"/&gt;

    &lt;Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="submit"
        android:id="@+id/button"
        android:layout_centerVertical="true"
        android:layout_centerHorizontal="true"/&gt;

    &lt;Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="data"
        android:id="@+id/button2"
        android:layout_below="@+id/button"
        android:layout_centerHorizontal="true"/&gt;

    &lt;TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="New Text"
        android:id="@+id/textView"
        android:layout_below="@+id/button2"
        android:layout_alignParentStart="true"/&gt;

    &lt;TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="New Text"
        android:id="@+id/textView2"
        android:layout_below="@+id/button2"
        android:layout_alignParentEnd="true"/&gt;

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