Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat Makes My EditText Empty?
    primarykey
    data
    text
    <p>I created the database. I used edittext to insert data to my database. There is a problem in my edittexts. When i used log to show the data in my edittexts but they are empty. I don't understand where the problem is. Please help me. Thanks in advance.</p> <p>Adding Data:</p> <pre><code>public void AddData() { setContentView(R.layout.dbase2); EditText e1 = (EditText) findViewById(R.id.eText1); EditText e2 = (EditText) findViewById(R.id.eText2); EditText e3 = (EditText) findViewById(R.id.eText3); EditText e4 = (EditText) findViewById(R.id.eText4); String bn = dContents; String pn = e1.getText().toString(); String at = e2.getText().toString(); String tp = e3.getText().toString(); String py = e4.getText().toString(); SQLiteDatabase db = book.getWritableDatabase(); ContentValues cv = new ContentValues(); cv.put("bNum", bn); cv.put("pName", pn); cv.put("author", at); cv.put("type", tp); cv.put("pyear", py); db.insert("btable", null, cv); db.close(); } </code></pre> <p>Dbase 2.xml</p> <p><pre> </p> <code> &lt;TextView android:id="@+id/t1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="27dp" android:text="Ürün İsmi" android:textAppearance="?android:attr/textAppearanceMedium" /&gt; &lt;TextView android:id="@+id/t2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/eText1" android:layout_centerHorizontal="true" android:text="Yazar" android:textAppearance="?android:attr/textAppearanceMedium" /&gt; &lt;EditText android:id="@+id/eText2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/eText1" android:layout_below="@+id/t2" android:ems="10" /&gt; &lt;EditText android:id="@+id/eText1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/t1" android:gravity="top" android:layout_centerHorizontal="true" android:ems="10" &gt; &lt;requestFocus /&gt; &lt;/EditText&gt; &lt;TextView android:id="@+id/t3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/t2" android:layout_below="@+id/eText2" android:text="Türü" android:textAppearance="?android:attr/textAppearanceMedium" /&gt; &lt;EditText android:id="@+id/eText3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/eText2" android:layout_below="@+id/t3" android:ems="10" /&gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignRight="@+id/t1" android:layout_below="@+id/eText3" android:text="Yayın Yılı" android:textAppearance="?android:attr/textAppearanceMedium" /&gt; &lt;EditText android:id="@+id/eText4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/eText3" android:layout_below="@+id/textView1" android:ems="10" /&gt; &lt;Button android:id="@+id/adding" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/eText4" android:layout_centerHorizontal="true" android:layout_marginTop="36dp" android:text="Kayıt Ekle" /&gt; &lt;/RelativeLayout&gt; &lt;/pre&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload