當前位置: 首頁>>代碼示例>>Java>>正文


Java OpenHelperManager類代碼示例

本文整理匯總了Java中com.j256.ormlite.android.apptools.OpenHelperManager的典型用法代碼示例。如果您正苦於以下問題:Java OpenHelperManager類的具體用法?Java OpenHelperManager怎麽用?Java OpenHelperManager使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


OpenHelperManager類屬於com.j256.ormlite.android.apptools包,在下文中一共展示了OpenHelperManager類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initGlobalObjects

import com.j256.ormlite.android.apptools.OpenHelperManager; //導入依賴的package包/類
private static void initGlobalObjects(Context context, Options options) {
	GlobalObjectRegistry.addObject(OpenHelperManager.getHelper(context, DatabaseHelper.class));
	Gson gson = new GsonBuilder()
		.setFieldNamingPolicy(FieldNamingPolicy.UPPER_CAMEL_CASE)
		.create();
	GlobalObjectRegistry.addObject(gson);
	ImageLoader.init(context);
	EmbeddedSocialServiceProvider serviceProvider = new EmbeddedSocialServiceProvider(context);
	GlobalObjectRegistry.addObject(EmbeddedSocialServiceProvider.class, serviceProvider);
	GlobalObjectRegistry.addObject(new Preferences(context));
	GlobalObjectRegistry.addObject(new RequestInfoProvider(context));
	GlobalObjectRegistry.addObject(new UserAccount(context));
	GlobalObjectRegistry.addObject(new NotificationController(context));
	NetworkAvailability networkAccessibility = new NetworkAvailability();
	networkAccessibility.startMonitoring(context);
	GlobalObjectRegistry.addObject(networkAccessibility);
	FacebookSdk.sdkInitialize(context);
	FacebookSdk.setApplicationId(options.getFacebookApplicationId());
}
 
開發者ID:Microsoft,項目名稱:EmbeddedSocial-Android-SDK,代碼行數:20,代碼來源:EmbeddedSocial.java

示例2: DaoManager

import com.j256.ormlite.android.apptools.OpenHelperManager; //導入依賴的package包/類
private DaoManager(Context context){

		if (helper == null) {
			helper = OpenHelperManager.getHelper(context, DataBaseHelper.class);
		}

		try {
			dao_contact = helper.getContactsDao();
			dao_userConversation = helper.getUserConversationDao();
			dao_session = helper.getSessionDao();
			dao_message = helper.getMessageDao();
			dao_sessionMember = helper.getSessionMemberDao();
			dao_userSession = helper.getUserSessionDao();
			dao_timeStamp = helper.getTimeStampDao();
			dao_user = helper.getUserDao();
			dao_emoji = helper.getEmojiDao();
			dao_webValue = helper.getWebValueDao();
		} catch (Exception e) {
			e.printStackTrace();
		}
		
	}
 
開發者ID:yun2win,項目名稱:yun2win-sdk-android,代碼行數:23,代碼來源:DaoManager.java

示例3: onCreate

import com.j256.ormlite.android.apptools.OpenHelperManager; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_main);
	database = OpenHelperManager.getHelper(this, DatabaseHelper.class);

	// Set the custom toolbar
	final Toolbar toolbar = (Toolbar) findViewById(R.id.my_toolbar);
	setSupportActionBar(toolbar);
	getSupportActionBar().setLogo(R.mipmap.ic_launcher);
	
	floatingButton = (FloatingActionButton) findViewById(R.id.floatingButton);

	if (savedInstanceState == null) {
		getFragmentManager().beginTransaction().add(R.id.container, new ServersListFragment()).commit();
	}
	getFragmentManager().addOnBackStackChangedListener(new FragmentManager.OnBackStackChangedListener() {
		@Override
		public void onBackStackChanged() {
			shouldDisplayNavigateUp();
		}
	});
	shouldDisplayNavigateUp();
}
 
開發者ID:sylvain121,項目名稱:Xpra-client-android,代碼行數:25,代碼來源:MainActivity.java

示例4: doInBackground

import com.j256.ormlite.android.apptools.OpenHelperManager; //導入依賴的package包/類
@Override
protected Void doInBackground(Void... voids) {
    ArrayList<Track> mTrackList = Utils.musicLoader(mContext);
    OrmHandler ormHandler = OpenHelperManager.getHelper(mContext, OrmHandler.class);
    try {
        Dao<Track, String> dbTrack = ormHandler.getDao(Track.class);
        List<Track> _temp = dbTrack.queryForAll();
        _temp.removeAll(mTrackList);
        for (Track t :
                mTrackList) {
            dbTrack.createIfNotExists(t);
        }
        dbTrack.delete(_temp);
    } catch (SQLException e) {
        e.printStackTrace();
    }
    OpenHelperManager.releaseHelper();
    return null;
}
 
開發者ID:Circle-Of-Music-Makers,項目名稱:com-android,代碼行數:20,代碼來源:DatabaseSynchronization.java

示例5: bucketOps

import com.j256.ormlite.android.apptools.OpenHelperManager; //導入依賴的package包/類
public static void bucketOps(String path, Boolean bucket, Context mContext) {
    final OrmHandler ormHandler = OpenHelperManager.getHelper(mContext, OrmHandler.class);
    try {
        Dao<Track, String> dbTrack = ormHandler.getDao(Track.class);
        QueryBuilder<Track, String> queryBuilder = dbTrack.queryBuilder();
        SelectArg selectArg = new SelectArg();
        queryBuilder.where().eq("path", selectArg);
        PreparedQuery<Track> preparedQuery = queryBuilder.prepare();
        selectArg.setValue(path);
        List<Track> lister = dbTrack.query(preparedQuery);
        Track temp_track = lister.get(0);
        temp_track.setBucket(bucket);
        dbTrack.update(temp_track);
        BUCKET_OPS = true;
    } catch (SQLException | IndexOutOfBoundsException e) {
        e.printStackTrace();
    }
}
 
開發者ID:Circle-Of-Music-Makers,項目名稱:com-android,代碼行數:19,代碼來源:Utils.java

示例6: onCreate

import com.j256.ormlite.android.apptools.OpenHelperManager; //導入依賴的package包/類
@Override
    public void onCreate() {
        super.onCreate();
//        This is here because onStart is not called when BIND_AUTO_CREATE is used
        mContext = this;
        localBroadcastManager = LocalBroadcastManager.getInstance(this);
        final OrmHandler ormHandler = OpenHelperManager.getHelper(this, OrmHandler.class);
        Dao<Track, String> dbTrack;
        try {
            dbTrack = ormHandler.getDao(Track.class);
            mTrackList = dbTrack.queryForAll();
            mBucketList = dbTrack.queryForEq("bucket", true);
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
 
開發者ID:Circle-Of-Music-Makers,項目名稱:com-android,代碼行數:17,代碼來源:MusicPlayerService.java

示例7: getDiaryTalks

import com.j256.ormlite.android.apptools.OpenHelperManager; //導入依賴的package包/類
public static List<Talk> getDiaryTalks(Context context){
    DataBaseHelper dataBaseHelper = OpenHelperManager.getHelper(context, DataBaseHelper.class);
    try {
        QueryBuilder<Talk, String> builder = dataBaseHelper.getTalkDao().queryBuilder();
        builder.orderBy("order",true);
        Where<Talk,String> where = builder.where();
        where.eq("scheduled", true);
        List<Talk> talkList = builder.query();
        if(!talkList.isEmpty() && talkList!=null) {
            return talkList;
        }
    } catch (SQLException e) {
        e.printStackTrace();
    }
    return null;
}
 
開發者ID:viniciusDSL,項目名稱:Google-I-O-extended,代碼行數:17,代碼來源:TalkController.java

示例8: onCreate

import com.j256.ormlite.android.apptools.OpenHelperManager; //導入依賴的package包/類
@Override
public void onCreate() {
    super.onCreate();

    Fabric.with(this, new Crashlytics());

    if (BuildConfig.DEBUG) {
        Timber.plant(new Timber.DebugTree());
    } else {
        Timber.plant(new CrashlyticsTree());
    }

    registerActivityLifecycleCallbacks( new LifecycleHandler() );

    OpenHelperManager.setOpenHelperClass(DatabaseHelper.class);


    RoboGuice.getOrCreateBaseApplicationInjector(
            this,
            RoboGuice.DEFAULT_STAGE,
            RoboGuice.newDefaultRoboModule(this),
            new ServerModule());
}
 
開發者ID:AMOS-2015,項目名稱:amos-ss15-proj2,代碼行數:24,代碼來源:MainApplication.java

示例9: searchMangaByCover

import com.j256.ormlite.android.apptools.OpenHelperManager; //導入依賴的package包/類
private static Manga searchMangaByCover(String cover){

        DatabaseHelper dbs = OpenHelperManager.getHelper(
                App.getInstance().getApplicationContext(),
                DatabaseHelper.class);
        Manga manga = null;
        try {
            manga = dbs.getMangaRunDao().queryBuilder().where().eq(Manga.COVER_COLUMN_NAME, cover)
                    .queryForFirst();
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            OpenHelperManager.releaseHelper();
        }

        return manga;
    }
 
開發者ID:Vrael,項目名稱:eManga,代碼行數:18,代碼來源:CoverListener.java

示例10: cancelAllAlarms

import com.j256.ormlite.android.apptools.OpenHelperManager; //導入依賴的package包/類
private void cancelAllAlarms()
{
	UpdateAlarmsService.cancelAutoUpdateAlarm( m_context );

	final DatabaseHelper databaseHelper = OpenHelperManager.getHelper( m_context, DatabaseHelper.class );
	if( databaseHelper != null )
	{
		try
		{
			final Dao<Launch, Integer> launchDao = databaseHelper.getDao( Launch.class );
			for( final Launch launch : launchDao )
			{
				UpdateAlarmsService.cancelAlarmsForLaunch( launch, m_context );
			}
		}
		catch( SQLException e )
		{
			e.printStackTrace();
		}

		OpenHelperManager.releaseHelper();
	}
}
 
開發者ID:Wavesonics,項目名稱:TMinus,代碼行數:24,代碼來源:SettingsFragment.java

示例11: doInBackground

import com.j256.ormlite.android.apptools.OpenHelperManager; //導入依賴的package包/類
@Override
protected Launch doInBackground( final Integer... ids )
{
	Launch launch = null;

	if( m_context != null )
	{
		final DatabaseHelper databaseHelper = OpenHelperManager.getHelper( m_context, DatabaseHelper.class );
		if( databaseHelper != null )
		{
			try
			{
				Dao<Launch, Integer> launchDao = databaseHelper.getDao( Launch.class );
				launch = launchDao.queryForId( ids[ 0 ] );
			}
			catch( final SQLException e )
			{
				e.printStackTrace();
			}

			OpenHelperManager.releaseHelper();
		}
	}

	return launch;
}
 
開發者ID:Wavesonics,項目名稱:TMinus,代碼行數:27,代碼來源:LaunchLoader.java

示例12: cleanUpOldLaunches

import com.j256.ormlite.android.apptools.OpenHelperManager; //導入依賴的package包/類
private void cleanUpOldLaunches()
{
	final DatabaseHelper databaseHelper = OpenHelperManager
			                                      .getHelper( LaunchUpdateService.this, DatabaseHelper.class );
	if( databaseHelper != null )
	{
		try
		{
			final Dao<Launch, Integer> launchDao = databaseHelper.getDao( Launch.class );

			DeleteBuilder<Launch, Integer> builder = launchDao.deleteBuilder();
			builder.where().lt( "net", getOldLaunchThreshold() );

			launchDao.delete( builder.prepare() );
		}
		catch( final SQLException e )
		{
			e.printStackTrace();
		}
		finally
		{
			OpenHelperManager.releaseHelper();
		}
	}
}
 
開發者ID:Wavesonics,項目名稱:TMinus,代碼行數:26,代碼來源:LaunchUpdateService.java

示例13: getDataPieces

import com.j256.ormlite.android.apptools.OpenHelperManager; //導入依賴的package包/類
/**
 * Returns all the DataPieces currently within the application's database.
 * 
 * @param {@link Context}
 * @return a {@link List} of the {@link DataPiece}s within the database.
 */
public static List<DataPiece> getDataPieces(final Context context) {
    final ResilienceDbHelper dBHelper = getDbHelper(context);
    List<DataPiece> pieces = null;

    try {
        final Dao<DataPiece, String> dao = dBHelper.getDataPieceDao();
        pieces = dao.queryForAll();
    } catch (SQLException e) {
        if (Flags.DEBUG) {
            Log.e(ResilienceDbManager.class.getSimpleName(), e.getMessage());
        }
    } finally {
        OpenHelperManager.releaseHelper();
    }
    return pieces;
}
 
開發者ID:lolletsoc,項目名稱:dissertation-project,代碼行數:23,代碼來源:ResilienceDbManager.java

示例14: persistDataPiece

import com.j256.ormlite.android.apptools.OpenHelperManager; //導入依賴的package包/類
/**
 * @param context
 * @param dataPiece
 */
public static void persistDataPiece(final Context context, final DataPiece dataPiece) {
    final ResilienceApplication resilApp = (ResilienceApplication) context.getApplicationContext();
    resilApp.getDatabaseThreadExecutorService().execute(new Runnable() {
        @Override
        public void run() {
            final ResilienceDbHelper dbHelper = getDbHelper(context);
            try {
                final Dao<DataPiece, String> pieceDao = dbHelper.getDataPieceDao();
                pieceDao.createOrUpdate(dataPiece);
            } catch (Exception e) {

            } finally {
                OpenHelperManager.releaseHelper();
            }
        }
    });
}
 
開發者ID:lolletsoc,項目名稱:dissertation-project,代碼行數:22,代碼來源:ResilienceDbManager.java

示例15: getDao

import com.j256.ormlite.android.apptools.OpenHelperManager; //導入依賴的package包/類
public static <T, ID> Dao<T, ID> getDao(Context context, Class<T> t) {
	Dao<T, ID> dao = null;
	try {

		dao = ((DatabaseHelper) OpenHelperManager.getHelper(context,
				DatabaseHelper.class)).getDao(t);

	} catch (SQLException e) {
		e.printStackTrace();
	}

	Log.i(DBFactory.class.getSimpleName(), "SqliteDao");
	return dao;
}
 
開發者ID:longtaoge,項目名稱:SelectName,代碼行數:15,代碼來源:DBFactory.java


注:本文中的com.j256.ormlite.android.apptools.OpenHelperManager類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。