Java Code Examples for com.lidroid.xutils.DbUtils#save()

The following examples show how to use com.lidroid.xutils.DbUtils#save() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MyEventLogicImpl.java    From ALLGO with Apache License 2.0 6 votes vote down vote up
@Override
public void saveEvent(ArrayList<EventVo> eventsData) {
	
	SharedPreferences sharedPref = context.getSharedPreferences("userdata",Context.MODE_PRIVATE);
	int uid = sharedPref.getInt("uid", -1) ;
   	try{
	    DbUtils db = DbUtils.create(context,uid + ".db");
	    db.configAllowTransaction(true);
        db.configDebug(true);
        db.deleteAll(MyEventVo.class);
        Log.i("DB", "deleteAll =saveBindingId=>" + eventsData.size()) ;
        for(int i=0 ; i<20 && i<eventsData.size() ; i++){
        	db.save(ChangEventVo.event2MyEvent(eventsData.get(i)));
        }
		}catch(DbException e){
	    	Log.e("DB", "error :" + e.getMessage() + "\n");
	    }

}
 
Example 2
Source File: PastEventLogicImpl.java    From ALLGO with Apache License 2.0 6 votes vote down vote up
@Override
public void saveEvent(ArrayList<EventVo> eventsData) {
	
	SharedPreferences sharedPref = context.getSharedPreferences("userdata",Context.MODE_PRIVATE);
	int uid = sharedPref.getInt("uid", -1) ;
   	try{
	    DbUtils db = DbUtils.create(context,uid + ".db");
	    db.configAllowTransaction(true);
        db.configDebug(true);
        db.deleteAll(PastEventVo.class);
        Log.i("DB", "deleteAll =saveBindingId=>" + eventsData.size()) ;
        for(int i=0 ; i<20 && i<eventsData.size() ; i++){
        	db.save(ChangEventVo.event2PastEvent(eventsData.get(i)));
        }
		}catch(DbException e){
	    	Log.e("DB", "error :" + e.getMessage() + "\n");
	    }

}
 
Example 3
Source File: FriendsEventLogicImpl.java    From ALLGO with Apache License 2.0 6 votes vote down vote up
/**
 * 保存列表数据到数据库
 * @param eventsData
 */
@Override
public void saveEvent(ArrayList<EventVo> eventsData) {
	SharedPreferences sharedPref = context.getSharedPreferences("userdata",Context.MODE_PRIVATE);
	int uid = sharedPref.getInt("uid", -1) ;
   	try{
	    DbUtils db = DbUtils.create(context,uid + ".db");
	    db.configAllowTransaction(true);
        db.configDebug(true);
        db.deleteAll(FriendEventVo.class);
        Log.i("DB", "deleteAll =saveFriendEvent=>" + eventsData.size()) ;
        for(int i=0 ; i<20 && i<eventsData.size() ; i++){
        	db.save(ChangEventVo.event2FriendEvent(eventsData.get(i)));
        }
		}catch(DbException e){
	    	Log.e("DB", "error :" + e.getMessage() + "\n");
	    }
}
 
Example 4
Source File: CommonEventLogicImpl.java    From ALLGO with Apache License 2.0 6 votes vote down vote up
/**
 * 保存列表数据到数据库
 * @param context
 * @param eventsData
 */
@Override
public void saveEvent(ArrayList<EventVo> eventsData) {
	
	SharedPreferences sharedPref = context.getSharedPreferences("userdata",Context.MODE_PRIVATE);
	int uid = sharedPref.getInt("uid", -1) ;
   	try{
	    DbUtils db = DbUtils.create(context,uid + ".db");
	    db.configAllowTransaction(true);
        db.configDebug(true);
        db.deleteAll(CommonEventVo.class);
        Log.i("DB", "deleteAll =saveCommonEvent=>" + eventsData.size()) ;
        for(int i=0 ; i<20 && i<eventsData.size() ; i++){
        	db.save(ChangEventVo.event2CommonEvent(eventsData.get(i)));
        }
		}catch(DbException e){
	    	Log.e("DB", "error :" + e.getMessage() + "\n");
	    }
}