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


Java Log类代码示例

本文整理汇总了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.");
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:Cache.java

示例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;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:Configuration.java

示例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;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:Configuration.java

示例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);
	}
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:32,代码来源:DatabaseHelper.java

示例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;
    }
}
 
开发者ID:UWICompSociety,项目名称:OurVLE,代码行数:18,代码来源:Section.java

示例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();
}
 
开发者ID:DobrinAlexandru,项目名称:Wabbit-Messenger---android-client,代码行数:17,代码来源:LocationReceiver.java

示例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.");
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:Cache.java

示例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.");
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:ModelInfo.java

示例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);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:IOUtils.java

示例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;
}
 
开发者ID:tkrajina,项目名称:10000sentences,代码行数:37,代码来源:ImporterAsyncTask.java

示例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);
	}
}
 
开发者ID:DobrinAlexandru,项目名称:Wabbit-Messenger---android-client,代码行数:32,代码来源:DatabaseHelper.java

示例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);
	}
}
 
开发者ID:DobrinAlexandru,项目名称:Wabbit-Messenger---android-client,代码行数:15,代码来源:DatabaseHelper.java

示例13: clear

import com.activeandroid.util.Log; //导入依赖的package包/类
public static synchronized void clear() {
	sEntities.evictAll();
	Log.v("Cache cleared.");
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:Cache.java

示例14: setLoggingEnabled

import com.activeandroid.util.Log; //导入依赖的package包/类
public static void setLoggingEnabled(boolean enabled) {
	Log.setEnabled(enabled);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:4,代码来源:ActiveAndroid.java

示例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.");
	}
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:7,代码来源:DatabaseHelper.java


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