本文整理汇总了Java中com.activeandroid.util.Log类的典型用法代码示例。如果您正苦于以下问题:Java Log类的具体用法?Java Log怎么用?Java Log使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Log类属于com.activeandroid.util包,在下文中一共展示了Log类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import com.activeandroid.util.Log; //导入依赖的package包/类
public static synchronized void initialize(Configuration configuration) {
if (sIsInitialized) {
Log.v("ActiveAndroid already initialized.");
return;
}
sContext = configuration.getContext();
sModelInfo = new ModelInfo(configuration);
sDatabaseHelper = new DatabaseHelper(configuration);
// TODO: It would be nice to override sizeOf here and calculate the memory
// actually used, however at this point it seems like the reflection
// required would be too costly to be of any benefit. We'll just set a max
// object size instead.
sEntities = new LruCache<String, Model>(configuration.getCacheSize());
openDatabase();
sIsInitialized = true;
Log.v("ActiveAndroid initialized successfully.");
}
示例2: loadModelList
import com.activeandroid.util.Log; //导入依赖的package包/类
private List<Class<? extends Model>> loadModelList(String[] models) {
final List<Class<? extends Model>> modelClasses = new ArrayList<Class<? extends Model>>();
final ClassLoader classLoader = mContext.getClass().getClassLoader();
for (String model : models) {
try {
Class modelClass = Class.forName(model.trim(), false, classLoader);
if (ReflectionUtils.isModel(modelClass)) {
modelClasses.add(modelClass);
}
}
catch (ClassNotFoundException e) {
Log.e("Couldn't create class.", e);
}
}
return modelClasses;
}
示例3: loadSerializerList
import com.activeandroid.util.Log; //导入依赖的package包/类
private List<Class<? extends TypeSerializer>> loadSerializerList(String[] serializers) {
final List<Class<? extends TypeSerializer>> typeSerializers = new ArrayList<Class<? extends TypeSerializer>>();
final ClassLoader classLoader = mContext.getClass().getClassLoader();
for (String serializer : serializers) {
try {
Class serializerClass = Class.forName(serializer.trim(), false, classLoader);
if (ReflectionUtils.isTypeSerializer(serializerClass)) {
typeSerializers.add(serializerClass);
}
}
catch (ClassNotFoundException e) {
Log.e("Couldn't create class.", e);
}
}
return typeSerializers;
}
示例4: copyAttachedDatabase
import com.activeandroid.util.Log; //导入依赖的package包/类
public void copyAttachedDatabase(Context context, String databaseName) {
final File dbPath = context.getDatabasePath(databaseName);
// If the database already exists, return
if (dbPath.exists()) {
return;
}
// Make sure we have a path to the file
dbPath.getParentFile().mkdirs();
// Try to copy database file
try {
final InputStream inputStream = context.getAssets().open(databaseName);
final OutputStream output = new FileOutputStream(dbPath);
byte[] buffer = new byte[8192];
int length;
while ((length = inputStream.read(buffer, 0, 8192)) > 0) {
output.write(buffer, 0, length);
}
output.flush();
output.close();
inputStream.close();
}
catch (IOException e) {
Log.e("Failed to open file", e);
}
}
示例5: findOrCreateFromJson
import com.activeandroid.util.Log; //导入依赖的package包/类
public static Section findOrCreateFromJson(Section new_section) {
int sectionid = new_section.getSectionid();
Section existingSection =
new Select().from(Section.class).where("sectionid = ?", sectionid).executeSingle();
if (existingSection != null) {
// found and return existing
// UpdateSection(existingSection,new_section);
Log.d(sectionid+"",existingSection.getName());
return existingSection;
} else {
Log.d(sectionid+"",new_section.getName());
// create and return new user
Section section = new_section;
section.save();
return section;
}
}
示例6: onReceive
import com.activeandroid.util.Log; //导入依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
try {
final LocationInfo locationInfo = (LocationInfo) intent.getSerializableExtra(LocationLibraryConstants.LOCATION_BROADCAST_EXTRA_LOCATIONINFO);
ParseUser.getCurrentUser().put(Enums.ParseKey.USER_LOCATION,
new ParseGeoPoint(locationInfo.lastLat, locationInfo.lastLong));
Log.d("Location my", locationInfo.lastLat + " " + locationInfo.lastLong);
ParseUser.getCurrentUser().saveInBackground();
}
catch (Exception e){
Log.e("location error:", e.getMessage());
}
if(MainActivity.gi() != null)
MainActivity.gi().onLocationUpdate();
}
示例7: dispose
import com.activeandroid.util.Log; //导入依赖的package包/类
public static synchronized void dispose() {
closeDatabase();
sEntities = null;
sModelInfo = null;
sDatabaseHelper = null;
sIsInitialized = false;
Log.v("ActiveAndroid disposed. Call initialize to use library.");
}
示例8: ModelInfo
import com.activeandroid.util.Log; //导入依赖的package包/类
public ModelInfo(Configuration configuration) {
if (!loadModelFromMetaData(configuration)) {
try {
scanForModel(configuration.getContext());
}
catch (IOException e) {
Log.e("Couldn't open source path.", e);
}
}
Log.i("ModelInfo loaded.");
}
示例9: closeQuietly
import com.activeandroid.util.Log; //导入依赖的package包/类
/**
* <p>
* Unconditionally close a {@link Closeable}.
* </p>
* Equivalent to {@link Closeable#close()}, except any exceptions will be ignored. This is
* typically used in finally blocks.
* @param closeable A {@link Closeable} to close.
*/
public static void closeQuietly(final Closeable closeable) {
if (closeable == null) {
return;
}
try {
closeable.close();
} catch (final IOException e) {
Log.e("Couldn't close closeable.", e);
}
}
示例10: doInBackground
import com.activeandroid.util.Log; //导入依赖的package包/类
@Override
protected Void doInBackground(String... strings) {
String url = strings[0];
publishProgress(0);
OkHttpClient httpClient = new OkHttpClient();
Call call = httpClient.newCall(new Request.Builder().url(url).get().build());
try {
Response response = call.execute();
InputStream stream = response.body().byteStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
List<Sentence> sentences = new ArrayList<>();
int order = 0;
String line;
while ((line = reader.readLine()) != null) {
order += 1;
sentences.add(parseSentence(order, line));
if (sentences.size() == PROGRESS_EVERY) {
importSentences(sentences);
publishProgress(order);
}
}
importSentences(sentences);
} catch (Exception e) {
Log.e(TAG, e.getMessage(), e);
Toast.makeText(activity, R.string.error_retrieving, Toast.LENGTH_SHORT).show();
return null;
}
dao.reloadCollectionCounter(collection);
return null;
}
示例11: copyAttachedDatabase
import com.activeandroid.util.Log; //导入依赖的package包/类
public void copyAttachedDatabase(Context context, String databaseName) {
final File dbPath = context.getDatabasePath(databaseName);
// If the database already exists, return
if (dbPath.exists()) {
return;
}
// Make sure we have a path to the file
dbPath.getParentFile().mkdirs();
// Try to copy database file
try {
final InputStream inputStream = context.getAssets().open(databaseName);
final OutputStream output = new FileOutputStream(dbPath);
byte[] buffer = new byte[1024];
int length;
while ((length = inputStream.read(buffer)) > 0) {
output.write(buffer, 0, length);
}
output.flush();
output.close();
inputStream.close();
}
catch (IOException e) {
Log.e("Failed to open file", e);
}
}
示例12: executeSqlScript
import com.activeandroid.util.Log; //导入依赖的package包/类
private void executeSqlScript(SQLiteDatabase db, String file) {
try {
final InputStream input = Cache.getContext().getAssets().open(MIGRATION_PATH + "/" + file);
final BufferedReader reader = new BufferedReader(new InputStreamReader(input));
String line = null;
while ((line = reader.readLine()) != null) {
db.execSQL(line.replace(";", ""));
}
}
catch (IOException e) {
Log.e("Failed to execute " + file, e);
}
}
示例13: clear
import com.activeandroid.util.Log; //导入依赖的package包/类
public static synchronized void clear() {
sEntities.evictAll();
Log.v("Cache cleared.");
}
示例14: setLoggingEnabled
import com.activeandroid.util.Log; //导入依赖的package包/类
public static void setLoggingEnabled(boolean enabled) {
Log.setEnabled(enabled);
}
示例15: executePragmas
import com.activeandroid.util.Log; //导入依赖的package包/类
private void executePragmas(SQLiteDatabase db) {
if (SQLiteUtils.FOREIGN_KEYS_SUPPORTED) {
db.execSQL("PRAGMA foreign_keys=ON;");
Log.i("Foreign Keys supported. Enabling foreign key features.");
}
}