的Android如何停止数据库插入过程 [英] Android How to stop database insertion process
问题描述
我的应用程序商店大量用户数据的本地数据库,就像使用名密码,用户文件,图像等通过 IntentService 它调用多个Web服务,每一件事情运作良好。 我的问题是,如果新用户登录,而IntentService仍然在运行,我无法删除旧的用户数据的日志说数据基本锁定。 如何停止IntentService并删除数据库,更换新的用户数据。
My app stores large amount of user data in local database, like use name password, user file, images etc by IntentService which calls several web services, every thing is working well. My problem is if new user logs in, while the IntentService is still running I am unable to delete the old user data the log says Data Base locked. How to stop IntentService and delete database to replace with new user data.
修改
我跟着<一个href="http://www.outofwhatbox.com/blog/2010/12/android-using-databaseutils-inserthelper-for-faster-insertions-into-sqlite-database/"相对=nofollow>这个插入。
推荐答案
当你要更改的数据做广播的intent..like这种
when you want to change the data.. broadcast an intent..like this
Intent intent=new Intent(getApplicationContext());
intent.setAction("com.toxy.Edit");
intent.putExtra("work","Editing");
sendBroadcast(intent);
在接收机的onrecieve
in the onrecieve of the receiver
@Override
public void onReceive(Context context, Intent arg1) {
String w = arg1.getExtras().getString("work");
if(w=="Editing")
{
//pause the intent service here..
}
指这个问题暂停.. 如何禁止IntentService? 其他{
refer this question to pause.. How to stop an IntentService? else{
//resume the intent service...
}
}
这篇关于的Android如何停止数据库插入过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!