本文整理汇总了Java中com.j256.ormlite.android.apptools.OpenHelperManager.getHelper方法的典型用法代码示例。如果您正苦于以下问题:Java OpenHelperManager.getHelper方法的具体用法?Java OpenHelperManager.getHelper怎么用?Java OpenHelperManager.getHelper使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.j256.ormlite.android.apptools.OpenHelperManager
的用法示例。
在下文中一共展示了OpenHelperManager.getHelper方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
}
示例2: 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();
}
示例3: 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;
}
示例4: 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();
}
}
示例5: 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();
}
}
示例6: 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;
}
示例7: 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;
}
示例8: 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;
}
示例9: openDB
import com.j256.ormlite.android.apptools.OpenHelperManager; //导入方法依赖的package包/类
public static void openDB(final Context ctx) {
Runnable r = new Runnable() {
@Override
public void run() {
BackupUtil.backuprestore();
Globo.dbHelper = OpenHelperManager.getHelper(ctx, DatabaseHelper.class);
Globo.db = Globo.dbHelper.getWritableDatabase();
}
};
Globo.dbHandler.post(r);
}
示例10: queriedTracks
import com.j256.ormlite.android.apptools.OpenHelperManager; //导入方法依赖的package包/类
public void queriedTracks(String query) {
OrmHandler orm = OpenHelperManager.getHelper(mContext, OrmHandler.class);
try {
Dao<Track, String> mTrack = orm.getDao(Track.class);
QueryBuilder<Track, String> queryBuilder = mTrack.queryBuilder();
queryBuilder.where().like("name", "%" + query + "%").or().like("artist", "%" + query + "%").or().like("album", "%" + query + "%");
PreparedQuery<Track> preparedQuery = queryBuilder.prepare();
mTrackList = mTrack.query(preparedQuery);
} catch (SQLException e) {
e.printStackTrace();
}
OpenHelperManager.releaseHelper();
notifyDataSetChanged();
}
示例11: getBucketedTracks
import com.j256.ormlite.android.apptools.OpenHelperManager; //导入方法依赖的package包/类
public void getBucketedTracks() {
bucketBool = true;
OrmHandler orm = OpenHelperManager.getHelper(mContext, OrmHandler.class);
try {
Dao<Track, String> mTrack = orm.getDao(Track.class);
mTrackList = mTrack.queryForEq("bucket", true);
} catch (SQLException e) {
e.printStackTrace();
}
OpenHelperManager.releaseHelper();
notifyDataSetChanged();
}
示例12: initChannelId
import com.j256.ormlite.android.apptools.OpenHelperManager; //导入方法依赖的package包/类
private void initChannelId() {
ORMLiteDBHelper helper = OpenHelperManager.getHelper(getContext(), ORMLiteDBHelper.class);
try {
ChannelDao channelDao =
new ChannelDao(((Dao<Channel, Integer> ) helper.getDao(Channel.class)));
Channel okChannel = channelDao.getOkChannel();
if (okChannel != null) {
tvChannelId.setText(String.valueOf(okChannel.cId));
}
} catch (SQLException e) {
Log.e("AddressBatchActivity_", "Could not create DAO addressBatchDao", e);
}
}
示例13: getAddressDao
import com.j256.ormlite.android.apptools.OpenHelperManager; //导入方法依赖的package包/类
private AddressDao getAddressDao(){
try {
ORMLiteDBHelper ormLiteDBHelper = OpenHelperManager.getHelper(this, ORMLiteDBHelper.class);
return new AddressDao(((Dao<Address, Integer>) ormLiteDBHelper
.getDao(Address.class)));
} catch (SQLException e) {
log.error("Could not create DAO", e);
}
return null;
}
示例14: getAddressBatchDao
import com.j256.ormlite.android.apptools.OpenHelperManager; //导入方法依赖的package包/类
private AddressBatchDao getAddressBatchDao(){
try {
ORMLiteDBHelper ormLiteDBHelper = OpenHelperManager.getHelper(this, ORMLiteDBHelper.class);
return new AddressBatchDao(((Dao<AddressBatch, Integer>) ormLiteDBHelper
.getDao(AddressBatch.class)));
} catch (SQLException e) {
log.error("Could not create DAO", e);
}
return null;
}
示例15: getTalkById
import com.j256.ormlite.android.apptools.OpenHelperManager; //导入方法依赖的package包/类
public static Talk getTalkById(Context context,String talkId){
DataBaseHelper dataBaseHelper = OpenHelperManager.getHelper(context, DataBaseHelper.class);
Talk result;
try {
result = dataBaseHelper.getTalkDao().queryForId(talkId);
} catch (SQLException e) {
e.printStackTrace();
result = null;
}
return result;
}