当前位置: 首页>>代码示例>>Java>>正文


Java DB.close方法代码示例

本文整理汇总了Java中com.snappydb.DB.close方法的典型用法代码示例。如果您正苦于以下问题:Java DB.close方法的具体用法?Java DB.close怎么用?Java DB.close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.snappydb.DB的用法示例。


在下文中一共展示了DB.close方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: snappydbExecute

import com.snappydb.DB; //导入方法依赖的package包/类
/**
 * @param context Context
 * @param dbName String
 * @param updateOperation SnappyDBUpdateOperation
 */
public static void snappydbExecute(Context context, String dbName, SnappyDBUpdateOperation updateOperation) {
    DB snappydb = null;

    try {
        snappydb = DBFactory.open(context, dbName);

        updateOperation.update(snappydb);

        snappydb.close();

    } catch (SnappydbException e) {
        Log.e(TAG, e.getLocalizedMessage());

        try {
            if (snappydb != null && snappydb.isOpen() ) {
                snappydb.close();
            }
        } catch (SnappydbException e1) {
            Log.e(TAG, e.getLocalizedMessage());
        }
    }
}
 
开发者ID:IamAlchemist,项目名称:AlchemistAndroidUtil,代码行数:28,代码来源:SnappyDBHelper.java

示例2: savePinnedApps

import com.snappydb.DB; //导入方法依赖的package包/类
public void savePinnedApps () throws SnappydbException
{
	/*
	SharedPreferences prefs = this.getContext ().getSharedPreferences ("pinned", Context.MODE_PRIVATE);
	SharedPreferences.Editor editor = prefs.edit ();

	editor.clear ();

	for (int i = 0; i < this.pinned.size (); i++)
	{
		App app = this.pinned.get (i);
		StringBuilder packageAndActivityName = new StringBuilder (app.getPackageName ())
			.append ("\n")
			.append (app.getActivityName ());

		editor.putString (Integer.toString (i), packageAndActivityName.toString ());
	}

	editor.apply ();*/

	DB db = DBFactory.open (this.getContext ());
	db.put ("launcher_pinnedApps", this.pinned.toArray ());
	db.close ();

	this.parent.pinnedAppsChanged ();
}
 
开发者ID:RobinJ1995,项目名称:DistroHopper,代码行数:27,代码来源:AppManager.java

示例3: onClick

import com.snappydb.DB; //导入方法依赖的package包/类
@Override
public void onClick(View v) {
    new GuillotineAnimation.GuillotineBuilder(guillotineMenu, guillotineMenu.findViewById(R.id.guillotine_hamburger), contentHamburger)
            .setStartDelay(RIPPLE_DURATION)
            .setActionBarViewForAnimation(toolbar)
            .setClosedOnStart(true)
            .build();
    switch (v.getId())
    {
        case R.id.activity_group:
            Toast.makeText(this,"My Events",Toast.LENGTH_SHORT).show();
            break;
        case R.id.feed_group:
            Intent intent2=new Intent(HomeActivity.this,FeedActivity.class);
            startActivity(intent2);
            break;
        case R.id.profile_group:
            Intent intent1=new Intent(HomeActivity.this,ProfileActivity.class);
            startActivity(intent1);
            break;
        case R.id.settings_group:
            LogSaver.appendLog("Facebook Logged Out :"+LoginManager.getInstance());
            LoginManager.getInstance().logOut();
            try {
                DB db = DBFactory.open(getApplicationContext(), "users");
                db.destroy();
                db.close();
            }
            catch (SnappydbException e){e.printStackTrace();}
            Intent intent=new Intent(HomeActivity.this,MainActivity.class);
            startActivity(intent);
            finish();
            LogSaver.appendLog("Facebook Logged Out");
           break;
    }
}
 
开发者ID:rishabh115,项目名称:Odyssey2017,代码行数:37,代码来源:HomeActivity.java

示例4: getAppStateFromDB

import com.snappydb.DB; //导入方法依赖的package包/类
private AppState getAppStateFromDB() {
    AppState appstate = null;
    try {
        DB db = DBFactory.open(getTargetContext());
        appstate = AppState.fromJson(db.get(TAG_APP_STATE));
        db.close();
    } catch (SnappydbException | IOException e) {
        Log.e(getClass().getSimpleName(), "error", e);
    }
    return appstate;
}
 
开发者ID:Catbag,项目名称:redux-android-sample,代码行数:12,代码来源:DataManagerTest.java

示例5: saveAppState

import com.snappydb.DB; //导入方法依赖的package包/类
private void saveAppState(AppState appState) {
    try {
        DB db = DBFactory.open(getTargetContext());
        db.put(TAG_APP_STATE, appState.toJson());
        db.close();
    } catch (SnappydbException | IOException e) {
        Log.e(getClass().getSimpleName(), "error", e);
    }
}
 
开发者ID:Catbag,项目名称:redux-android-sample,代码行数:10,代码来源:DataManagerTest.java

示例6: saveEnabledLenses

import com.snappydb.DB; //导入方法依赖的package包/类
public void saveEnabledLenses () throws SnappydbException
{
	DB db = DBFactory.open (this.context);

	List<String> enabledLenses = new ArrayList<String> ();
	for (int j = 0; j < this.enabled.size (); j++)
		enabledLenses.add (this.enabled.get (j).getClass ().getSimpleName ());

	db.put ("dash_enabledLenses", enabledLenses);
	db.close ();
}
 
开发者ID:RobinJ1995,项目名称:DistroHopper,代码行数:12,代码来源:LensManager.java

示例7: getAppState

import com.snappydb.DB; //导入方法依赖的package包/类
public AppState getAppState() throws SnappydbException, IOException {
    DB db = DBFactory.open(mContext);
    AppState appState = AppState.fromJson(db.get(TAG_APP_STATE));
    db.close();
    return appState;
}
 
开发者ID:Catbag,项目名称:redux-android-sample,代码行数:7,代码来源:Database.java

示例8: saveAppState

import com.snappydb.DB; //导入方法依赖的package包/类
public void saveAppState(AppState appState) throws SnappydbException, JsonProcessingException {
    DB db = DBFactory.open(mContext);
    db.put(TAG_APP_STATE, appState.toJson());
    db.close();
}
 
开发者ID:Catbag,项目名称:redux-android-sample,代码行数:6,代码来源:Database.java

示例9: LensManager

import com.snappydb.DB; //导入方法依赖的package包/类
public LensManager (Context context, LinearLayout llDashHomeAppsContainer, LinearLayout llDashHomeLensesContainer, ProgressWheel pwDashSearchProgress, AppManager apps) throws SnappydbException
{
	this.context = context;
	this.enabled = new ArrayList<Lens> ();
	this.llDashHomeAppsContainer = llDashHomeAppsContainer;
	this.llDashHomeLensesContainer = llDashHomeLensesContainer;
	if (llDashHomeAppsContainer != null)
		this.lvDashHomeLensResults = (ListView) llDashHomeLensesContainer.findViewById (R.id.lvDashHomeLensResults);
	this.pwDashSearchProgress = pwDashSearchProgress;

	SharedPreferences prefs = this.context.getSharedPreferences ("prefs", Context.MODE_PRIVATE);
	DB db = DBFactory.open (this.context);

	if (apps != null)
		context = apps.getContext ();

	this.lenses.put ("AskUbuntu", new AskUbuntu (context));
	this.lenses.put ("DuckDuckGo", new DuckDuckGo (context));
	this.lenses.put ("GitHub", new GitHub (context));
	this.lenses.put ("GooglePlus", new GooglePlus (context));
	this.lenses.put ("InstalledApps", new InstalledApps (context, apps));
	this.lenses.put ("LocalFiles", new LocalFiles (context)); // LocalFiles needs to show an AlertDialog in some cases, thus it needs the activity's Context (which AppsManager has) in stead of the Application Context (this.context). //
	this.lenses.put ("Reddit", new Reddit (context));
	this.lenses.put ("ServerFault", new ServerFault (context));
	this.lenses.put ("StackOverflow", new StackOverflow (context));
	this.lenses.put ("SuperUser", new SuperUser (context));

	List<String> defaultLenses = new ArrayList<String> ();
	defaultLenses.add ("InstalledApps");
	defaultLenses.add ("LocalFiles");

	List<String> enabledLenses;
	if (db.exists ("dash_enabledLenses"))
	{
		enabledLenses = db.get ("dash_enabledLenses", ArrayList.class);
	}
	else
	{
		enabledLenses = new ArrayList<String> ();
		enabledLenses.addAll (defaultLenses);
	}

	for (String lensName : enabledLenses)
	{
		Lens lens = this.lenses.get (lensName);

		if (lens != null && (! this.isLensEnabled (lens)))
			this.enabled.add (lens);
	}

	db.close ();

	this.maxResultsPerLens = Integer.valueOf (prefs.getString ("dashsearch_lenses_maxresults", "10"));
}
 
开发者ID:RobinJ1995,项目名称:DistroHopper,代码行数:55,代码来源:LensManager.java


注:本文中的com.snappydb.DB.close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。