How can I run my process of insert into database in background when my application is running? I want to run the process of insert query of the database in background.
Please can you give suggestion or a sample code?
Thanks in advance.
How can I run my process of insert into database in background when my application is running? I want to run the process of insert query of the database in background.
Please can you give suggestion or a sample code?
Thanks in advance.
You use a class that extends AsynTask... Please refer this link for that.
Inside ur doInBackground() call ur method for doing insertion.
More Explanation:
Create an inner class InsertTask inside ur activity like:
Inside ur onCreate() give:
By doing this, when ur activity is called, the things written inside doInBackground() runs, there by inserting ur values.