Tuesday, October 27, 2009

[android-developers] How to Use DBAdapter Class Functions inside OnclickListener - Help..

@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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments:

Post a Comment