Data is not saved in the Database
<p>I have created a database with the android when i add some data in it and i try to see the contents i have added it is empty
this the class of the database</p>

<pre><code>package tt.aa.xx;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

public class Dbinfo {

    public static final String KEY_ROWID="_ID";
    public static final String KEY_NAME="person_name";
    public static final String KEY_SCALERATING="person_rate";
    public static final String KEY_AGE="person_age";

    private static final String DATABASE_NAME="SignDB";
    private static final String DATABASE_TABLE="peopleTable";
    private static final int DATABASE_VERSION=1;

    private Dbhelper ourHelper;
    public final Context ourcontext;
    private SQLiteDatabase ourDatabase;
    private static class Dbhelper extends SQLiteOpenHelper
    {

        public Dbhelper(Context context)
        {
            super(context,DATABASE_NAME,null,DATABASE_VERSION);
            // TODO Auto-generated constructor stub
        }

        @Override
        public void onCreate(SQLiteDatabase db) {
            // TODO Auto-generated method stub
            db.execSQL("CREATE TABLE "+DATABASE_TABLE+"("+KEY_ROWID+" INTEGER PRIMARY KEY AUTOINCREMENT, "+
            KEY_NAME+" TEXT NOT NULL, "+KEY_AGE+" TEXT NOT NULL, "+KEY_SCALERATING+" TEXT NOT NULL);");         
        }

        @Override
        public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
            // TODO Auto-generated method stub
            db.execSQL("DROP TABLE IF EXIESTS"+DATABASE_TABLE);
            onCreate(db);
        }


    }
    public Dbinfo(Context c)
    {
        ourcontext=c;
    }
    public Dbinfo open()throws SQLException
    {
        ourHelper=new Dbhelper(ourcontext);
        ourDatabase=ourHelper.getWritableDatabase();
        return this;
    }
    public void close()
    {
        ourHelper.close();
    }
    public long create(String nameS, String ratingScaleS,String ageS) {
        // TODO Auto-generated method stub
    ContentValues cv=new ContentValues();
    cv.put(KEY_NAME,nameS);
    cv.put(KEY_SCALERATING, ratingScaleS);
    cv.put(KEY_AGE, ageS);
    return ourDatabase.insert(DATABASE_TABLE,null,cv);
    }
    public String getdata() {
        // TODO Auto-generated method stub
        String []columns=new String[]{KEY_ROWID,KEY_NAME,KEY_AGE,KEY_SCALERATING};
        String result="";
        Cursor c = ourDatabase.query(DATABASE_TABLE, columns, null, null, null, null, null);
        int iRow=c.getColumnIndex(KEY_ROWID);
        int iName=c.getColumnIndex(KEY_NAME);
        int iage=c.getColumnIndex(KEY_AGE);
        int iScale=c.getColumnIndex(KEY_SCALERATING);
        for(c.moveToFirst();c.moveToLast();c.moveToNext())
        {
            result=result+c.getString(iRow)+c.getString(iName)+c.getString(iage)+c.getString(iScale)+'\n';
        }

        return result;

    }


}
</code></pre>

<p>And this the class of the activity of the xml</p>

<pre><code>package tt.aa.xx;

import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

public class DatabaseActivity extends Activity implements OnClickListener {
    /** Called when the activity is first created. */
    EditText Name,RatingScale,age;
    Button Update_sqlDB,view;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        intialze();
    }
    private void intialze() {
        // TODO Auto-generated method stub
        Name=(EditText)findViewById(R.id.NameED);
        age=(EditText)findViewById(R.id.ageET);
        RatingScale=(EditText)findViewById(R.id.ratingscaleET);
        Update_sqlDB=(Button)findViewById(R.id.updateSQLDB_BT);
        view=(Button)findViewById(R.id.viewBT);
        Update_sqlDB.setOnClickListener(this);
        view.setOnClickListener(this);

    }
    public void onClick(View v) {
        // TODO Auto-generated method stub
        switch(v.getId())
        {
        case R.id.updateSQLDB_BT:
            Toast.makeText(this, "hsh", Toast.LENGTH_SHORT).show();
        boolean diditwork=true;
            try
            {String NameS=Name.getText().toString();
            String RatingScaleS=RatingScale.getText().toString();
            String ageS=age.getText().toString();
            Dbinfo info=new Dbinfo(this);
            info.open();
            info.create(NameS,RatingScaleS,ageS);
            info.close();
            }
            catch (Exception e)
            {
                String error=e.toString();
                Dialog d=new Dialog(this);
                d.setTitle("Error");
                TextView tt=new TextView(this);
                tt.setText("Erro in saving");
                d.setContentView(tt);
                d.show();                       
            }
            finally
            {
                if(diditwork)
                {
                    Dialog d=new Dialog(this);
                    d.setTitle("OHH YEAAH");
                    TextView tv=new TextView(this);
                    tv.setText("sucess");
                    d.setContentView(tv);
                    d.show();
                }
            }
            InputMethodManager imm=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.hideSoftInputFromInputMethod(age.getWindowToken(),0);
            break;
        case R.id.viewBT:
            Intent i=new Intent("tt.aa.xx.VIEWDB");
            startActivity(i);

            break;

        }
    }
}
</code></pre>

<p>And i create a final Activity to see the contents of the Database</p>

<pre><code>package tt.aa.xx;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class ViewDb extends Activity {

    TextView sqlinfo;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.view);
        sqlinfo=(TextView)findViewById(R.id.SQLinfoTV);
        Dbinfo infos=new Dbinfo(this);
        infos.open();
        String data=infos.getdata();
        sqlinfo.setText(data);

    }


}
</code></pre>
