android sqlite insert query error
Guys i am getting an syntax error . I know its simple but i am not able to find the error . plz help. It has got to do something with paranthesis but idont get the error.

    
   package com.pdd.sqlite;

import java.util.ArrayList;

    import android.app.Activity;
    import android.database.Cursor;
    import android.database.sqlite.SQLiteDatabase;
    import android.os.Bundle;
    import android.util.Log;
    import android.view.View;
    import android.view.View.OnClickListener;
    import android.widget.ArrayAdapter;
    import android.widget.Button;
    import android.widget.EditText;
    import android.widget.ListView;
    
    public class SqliteDemoActivity extends Activity implements OnClickListener {
    	SQLiteDatabase db ;
    	ArrayList<String> al;
    	ArrayAdapter<String> aa;
    	ListView lv;
    	Button add;
    	Button remove;
    	String username;
    	EditText user;
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
        
        lv=(ListView) findViewById(R.id.listView1);
        al=new ArrayList<String>();
        aa=new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,al);
        lv.setAdapter(aa);
        
        add=(Button) findViewById(R.id.add);
        remove=(Button) findViewById(R.id.remove);
        user=(EditText) findViewById(R.id.username);
        
        username=user.getText().toString();
        
        add.setOnClickListener(this);
        remove.setOnClickListener(this);
        
        db = openOrCreateDatabase("MyDb", MODE_PRIVATE, null);
        
        db.execSQL("create TABLE if not exists users (name varchar);");
        
        //db.execSQL("insert into users values('harsha')");
        
        getdata();
        
       // db.close();
    }
    
    void getdata()
    {
    	Cursor c=db.rawQuery("select * from users", null);
    	//int i=0;
    	if(c.getCount()<=0)
    		return;
    	
    	Log.d("Count",Integer.toString(c.getCount()));
    	if(c.moveToFirst())
    	{
    		do
    		{
    		//i++;
    		
    	
    		al.add(c.getString(c.getColumnIndex("name")));
    		//Log.d("user",c.getString(0));
    	
    		
    		}
    		while(c.moveToNext());
    	}
    	for(int i=0;i<al.size();i++)
    		Log.d("User",al.get(i));
    	
    	aa.notifyDataSetChanged();
    }

	public void onClick(View v)
	{
		
		switch (v.getId())
		{
		case R.id.add:
			String sql="insert into users values (";
			sql=sql+username;
			sql=sql+");";
			db.execSQL(sql);
			break;
			
		case R.id.remove:
			break;
		}
		
	}
}


I am sry to put the entire code. I had to do that as i was not allowed to put only d insertion code.
android sqlite insert query error
===

Guys i am getting an syntax error . I know its simple but i am not able to find the error . plz help. It has got to do something with paranthesis but idont get the error.

    
   package com.pdd.sqlite;

import java.util.ArrayList;

    import android.app.Activity;
    import android.database.Cursor;
    import android.database.sqlite.SQLiteDatabase;
    import android.os.Bundle;
    import android.util.Log;
    import android.view.View;
    import android.view.View.OnClickListener;
    import android.widget.ArrayAdapter;
    import android.widget.Button;
    import android.widget.EditText;
    import android.widget.ListView;
    
    public class SqliteDemoActivity extends Activity implements OnClickListener {
    	SQLiteDatabase db ;
    	ArrayList<String> al;
    	ArrayAdapter<String> aa;
    	ListView lv;
    	Button add;
    	Button remove;
    	String username;
    	EditText user;
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
        
        lv=(ListView) findViewById(R.id.listView1);
        al=new ArrayList<String>();
        aa=new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,al);
        lv.setAdapter(aa);
        
        add=(Button) findViewById(R.id.add);
        remove=(Button) findViewById(R.id.remove);
        user=(EditText) findViewById(R.id.username);
        
        username=user.getText().toString();
        
        add.setOnClickListener(this);
        remove.setOnClickListener(this);
        
        db = openOrCreateDatabase("MyDb", MODE_PRIVATE, null);
        
        db.execSQL("create TABLE if not exists users (name varchar);");
        
        //db.execSQL("insert into users values('harsha')");
        
        getdata();
        
       // db.close();
    }
    
    void getdata()
    {
    	Cursor c=db.rawQuery("select * from users", null);
    	//int i=0;
    	if(c.getCount()<=0)
    		return;
    	
    	Log.d("Count",Integer.toString(c.getCount()));
    	if(c.moveToFirst())
    	{
    		do
    		{
    		//i++;
    		
    	
    		al.add(c.getString(c.getColumnIndex("name")));
    		//Log.d("user",c.getString(0));
    	
    		
    		}
    		while(c.moveToNext());
    	}
    	for(int i=0;i<al.size();i++)
    		Log.d("User",al.get(i));
    	
    	aa.notifyDataSetChanged();
    }

	public void onClick(View v)
	{
		
		switch (v.getId())
		{
		case R.id.add:
			String sql="insert into users values (";
			sql=sql+username;
			sql=sql+");";
			db.execSQL(sql);
			break;
			
		case R.id.remove:
			break;
		}
		
	}
}


I am sry to put the entire code. I had to do that as i was not allowed to put only d insertion code.