当前位置: 首页>>代码示例>>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;未经允许,请勿转载。