@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main);
DBAdapter db = new DBAdapter(this); db.open(); // Some Insert Functions db.close(); The above codes is used inside Oncreate. I wand to use “db” functions inside Onclick Listener Like the Below to add some data to DB Onclick What I want to Do addbtnListener.setOnClickListener(new View.OnClickListener(){ public void onClick(View v) { // Here i need to Execute a Add Database... How ?? Like //db.open(),db.close()..etc...deb.insert() } }); --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---