Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to insert data into database using EditText and then save data into database in android
    primarykey
    data
    text
    <p>i am new in android development, so i am trying but i can't do the insertion data into database using Edit Text and then save the data into data using Button in android. so someone please help me out, i am just a beginner that's why please write a sample tutorial/program on it.</p> <p>advanced thank you, arnob </p> <p>ok here is my one of my class activities and an xml file i am attaching -</p> <p>one of my activity class names "Registration.java" and it contains -</p> <pre><code>package com.ggit.trip.caster; public class Registration extends AppBaseActivity { private Button submit3; private Button exit3; DatePicker d; Dialog dialog; public TextView date; private ImageView cal; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.registration); registerBaseActivityReceiver(); submit3 = (Button) findViewById(R.id.button1); exit3 = (Button) findViewById(R.id.button2); cal = (ImageView) findViewById(R.id.imageView1); date = (TextView) findViewById(R.id.textView8); submit3.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub Intent intent = new Intent(getApplicationContext(), CostManagement.class); startActivity(intent); } }); cal.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub dialog = new Dialog(Registration.this); dialog.setContentView(R.layout.date); //dialog.setTitle("Set Date"); dialog.setCancelable(true); Button ok = (Button) dialog.findViewById(R.id.button1); Button cancel = (Button) dialog.findViewById(R.id.button2); d = (DatePicker) dialog.findViewById(R.id.datePicker1); ok.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub int day = d.getDayOfMonth(); int month = d.getMonth(); int year = d.getYear(); String curDate = "" + day + "/" + month + "/" + year; Log.d("date", "" + curDate); date.setText(curDate); date.setVisibility(View.VISIBLE); cal.setVisibility(View.INVISIBLE); dialog.dismiss(); } }); cancel.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.show(); } }); exit3.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub closeAllActivities(); } }); } @Override public void onDestroy() { super.onDestroy(); unRegisterBaseActivityReceiver(); } </code></pre> <p>}</p> <p>for this class activities i have made a layout for this registration named "registration.xml" . </p> <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:background="@drawable/sea_01" &gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginTop="30dp" android:text="User Name" android:textAppearance="?android:attr/textAppearanceMedium" /&gt; &lt;EditText android:id="@+id/editText1" android:layout_width="160dp" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/textView1" android:layout_alignBottom="@+id/textView1" android:layout_alignParentRight="true" android:layout_marginRight="24dp" android:background="@drawable/rounded_edittext" android:ems="10" android:hint=" insert your name" android:inputType="textPersonName" &gt; &lt;requestFocus /&gt; &lt;/EditText&gt; &lt;TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@+id/editText1" android:layout_marginTop="20dp" android:text="Passord" android:textAppearance="?android:attr/textAppearanceMedium" /&gt; &lt;EditText android:id="@+id/editText2" android:layout_width="160dp" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/textView2" android:layout_alignBottom="@+id/textView2" android:layout_alignLeft="@+id/editText1" android:background="@drawable/rounded_edittext" android:ems="10" android:inputType="textPassword" /&gt; &lt;TextView android:id="@+id/textView3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@+id/editText2" android:layout_marginTop="20dp" android:text="E-mail" android:textAppearance="?android:attr/textAppearanceMedium" /&gt; &lt;EditText android:id="@+id/editText3" android:layout_width="160dp" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/textView3" android:layout_alignBottom="@+id/textView3" android:layout_alignLeft="@+id/editText2" android:background="@drawable/rounded_edittext" android:ems="10" android:hint=" insert your email" android:inputType="textEmailAddress" /&gt; &lt;TextView android:id="@+id/textView4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@+id/editText3" android:layout_marginTop="20dp" android:text="Phone Number" android:textAppearance="?android:attr/textAppearanceMedium" /&gt; &lt;EditText android:id="@+id/editText4" android:layout_width="160dp" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/textView4" android:layout_alignBottom="@+id/textView4" android:layout_alignRight="@+id/editText3" android:background="@drawable/rounded_edittext" android:ems="10" android:hint=" contact number" android:inputType="phone" /&gt; &lt;TextView android:id="@+id/textView5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@+id/editText4" android:layout_marginTop="32dp" android:text="Gender" android:textAppearance="?android:attr/textAppearanceMedium" /&gt; &lt;RadioButton android:id="@+id/radioButton1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/textView5" android:layout_alignBottom="@+id/textView5" android:layout_alignLeft="@+id/editText4" android:text="Male" /&gt; &lt;RadioButton android:id="@+id/radioButton2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/radioButton1" android:layout_alignBottom="@+id/radioButton1" android:layout_toRightOf="@+id/radioButton1" android:text="Female" /&gt; &lt;TextView android:id="@+id/textView7" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@+id/radioButton1" android:layout_marginTop="26dp" android:text="Location" android:textAppearance="?android:attr/textAppearanceMedium" /&gt; &lt;EditText android:id="@+id/editText5" android:layout_width="160dp" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/textView7" android:layout_alignBottom="@+id/textView7" android:layout_alignLeft="@+id/radioButton1" android:background="@drawable/rounded_edittext" android:ems="10" android:hint=" place you living" /&gt; &lt;TextView android:id="@+id/textView6" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@+id/editText5" android:layout_marginTop="32dp" android:text="Birthday" android:textAppearance="?android:attr/textAppearanceMedium" /&gt; &lt;ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/editText5" android:layout_alignTop="@+id/textView6" android:src="@drawable/calendar" /&gt; &lt;TextView android:id="@+id/textView8" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBottom="@+id/textView6" android:layout_alignLeft="@+id/imageView1" android:text="Medium Text" android:textAppearance="?android:attr/textAppearanceMedium" android:visibility="invisible" /&gt; &lt;Button android:id="@+id/button1" android:layout_width="100dp" android:layout_height="45dp" android:layout_alignParentBottom="true" android:layout_toLeftOf="@+id/imageView1" android:background="@drawable/gloss_nine_patch" android:text="Submit" /&gt; &lt;Button android:id="@+id/button2" android:layout_width="100dp" android:layout_height="45dp" android:layout_alignLeft="@+id/imageView1" android:layout_alignParentBottom="true" android:layout_marginLeft="24dp" android:background="@drawable/gloss_nine_patch" android:text="Exit" /&gt; &lt;TextView android:id="@+id/textView9" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:text="User Registration" android:gravity="center" android:textAppearance="?android:attr/textAppearanceMedium" android:textSize="12dp" /&gt; &lt;/RelativeLayout&gt; </code></pre> <p>Now please someone please full fill this "Registration.java" class using database query and after writing all the information when i ll click 'submit' button it will save into database then go to other activities. </p> <p>thanking you all please help me now </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    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