本文整理汇总了Java中com.github.snowdream.android.util.Log类的典型用法代码示例。如果您正苦于以下问题:Java Log类的具体用法?Java Log怎么用?Java Log使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Log类属于com.github.snowdream.android.util包,在下文中一共展示了Log类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: startAccept
import com.github.snowdream.android.util.Log; //导入依赖的package包/类
/**
* Start the chat service. Specifically start AcceptThread to begin a
* session in listening (server) mode. Called by the Activity onResume()
*/
public synchronized void startAccept() {
Log.d(TAG, "BTS startAccept");
// Cancel any thread attempting to make a connection
if (mConnectThread != null) {
mConnectThread.cancel();
mConnectThread = null;
}
// Cancel any thread currently running a connection
if (mConnectedThread != null) {
mConnectedThread.cancel();
mConnectedThread = null;
}
setState(STATE_LISTEN);
// Start the thread to listen on a BluetoothServerSocket
if (mSecureAcceptThread == null) {
mSecureAcceptThread = new AcceptThread();
}
mSecureAcceptThread.start();
}
开发者ID:Last-Mile-Health,项目名称:ODK-Liberia,代码行数:28,代码来源:BluetoothService.java
示例2: stop
import com.github.snowdream.android.util.Log; //导入依赖的package包/类
/**
* Stop all threads
*/
public synchronized void stop() {
Log.d(TAG, "BTS stop");
if(cdt!=null)
cdt.cancel();
if (mConnectThread != null) {
mConnectThread.cancel();
mConnectThread = null;
}
if (mConnectedThread != null) {
mConnectedThread.cancel();
mConnectedThread = null;
}
if (mSecureAcceptThread != null) {
mSecureAcceptThread.cancel();
mSecureAcceptThread = null;
}
setState(STATE_NONE);
}
开发者ID:Last-Mile-Health,项目名称:ODK-Liberia,代码行数:27,代码来源:BluetoothService.java
示例3: deletePreferences
import com.github.snowdream.android.util.Log; //导入依赖的package包/类
private void deletePreferences() {
TinyDB tinydb = new TinyDB(mContext);
// String[] rolesName = tinydb.getListString(ROLES).toArray(new String[tinydb.getListString(ROLES).size()]);
ArrayList<String> rolesName = tinydb.getListString(ROLES);
Log.d("~", "[deletePreferences] roles length : " + rolesName.size());
for (int i = 0; i < rolesName.size(); i++) {
Log.d("~", "[deletePreferences] remove role : " + rolesName.get(i));
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(mContext);
// preferences.edit().remove(rolesName.get(i)).commit();
tinydb.remove(rolesName.get(i));
}
tinydb.remove(ROLES);
tinydb.remove(AdminPreferencesActivity.CURRENT_PERMISSIONS);
tinydb.remove(AdminPreferencesActivity.CURRENT_ROLE);
}
开发者ID:Last-Mile-Health,项目名称:ODK-Liberia,代码行数:20,代码来源:BluetoothService.java
示例4: doDiscovery
import com.github.snowdream.android.util.Log; //导入依赖的package包/类
/**
* Start device discover with the BluetoothAdapter
*/
private void doDiscovery() {
Log.d(TAG, "doDiscovery()");
// Indicate scanning in the title
setProgressBarIndeterminateVisibility(true);
setTitle(R.string.scanning);
// Turn on sub-title for new devices
findViewById(R.id.title_new_devices).setVisibility(View.VISIBLE);
// If we're already discovering, stop it
if (mBtAdapter.isDiscovering()) {
mBtAdapter.cancelDiscovery();
}
// Request discover from BluetoothAdapter
mBtAdapter.startDiscovery();
}
开发者ID:Last-Mile-Health,项目名称:ODK-Liberia,代码行数:22,代码来源:DeviceListActivity.java
示例5: onItemClick
import com.github.snowdream.android.util.Log; //导入依赖的package包/类
public void onItemClick(AdapterView<?> av, View v, int arg2, long arg3) {
// Cancel discovery because it's costly and we're about to connect
mBtAdapter.cancelDiscovery();
try {
// Get the device MAC address, which is the last 17 chars in the View
String info = ((TextView) v).getText().toString();
String address = info.substring(info.length() - 17);
String name = info.substring(0, info.lastIndexOf("\n"));
//Log.d("~", "info: "+info);
//Log.d("~", "address : "+address);
//Log.d("~", "name : "+name);
// Create the result Intent and include the MAC address
Intent intent = new Intent();
intent.putExtra(EXTRA_DEVICE_ADDRESS, address);
intent.putExtra(EXTRA_DEVICE_NAME, name);
// Set result and finish this Activity
setResult(Activity.RESULT_OK, intent);
} catch (Exception e) {
Log.e("AdapterView.OnItemClickListener ", e);
}
finish();
}
开发者ID:Last-Mile-Health,项目名称:ODK-Liberia,代码行数:27,代码来源:DeviceListActivity.java
示例6: onReceive
import com.github.snowdream.android.util.Log; //导入依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
Log.d(TAG, "[BroadcastReceiver] action : " + action);
// When discovery finds a device
if (BluetoothDevice.ACTION_FOUND.equals(action)) {
// Get the BluetoothDevice object from the Intent
BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
if(/*BluetoothDevice.BOND_BONDED == device.getBondState() &&*/ !alreadyExistInList(mDiviceAdapter, device)){
Log.d(TAG, "[BroadcastReceiver BluetoothDevice.BOND_BONDED] : " + device.getName() + "\n" + device.getAddress());
mDiviceAdapter.add(device.getName() + "\n" + device.getAddress());
}
} else if (BluetoothAdapter.ACTION_DISCOVERY_FINISHED.equals(action)) {
setProgressBarIndeterminateVisibility(false);
setTitle(R.string.select_device);
if (mDiviceAdapter.getCount() == 0) {
String noDevices = getResources().getText(R.string.none_found).toString();
mDiviceAdapter.add(noDevices);
}
Log.d(TAG, "[BroadcastReceiver BluetoothAdapter.ACTION_DISCOVERY_FINISHED] devices count : " + mDiviceAdapter.getCount());
}
}
开发者ID:Last-Mile-Health,项目名称:ODK-Liberia,代码行数:27,代码来源:DeviceListActivity.java
示例7: dismissDialog
import com.github.snowdream.android.util.Log; //导入依赖的package包/类
/**
* 关闭对话框
*
* @param joinPoint
* @throws IllegalAccessException
*/
@After("execution(@zilla.libcore.ui.SupportMethodLoading * *(..))")
public void dismissDialog(ProceedingJoinPoint joinPoint) {
try {
Object container = joinPoint.getTarget();
Field[] fields = container.getClass().getFields();
for (Field field : fields) {
if (field.getAnnotation(LifeCircleInject.class) != null) {
if (IDialog.class.isAssignableFrom(field.getType())) {
IDialog iDialog = (IDialog) field.get(container);
iDialog.dismiss();
return;
}
}
}
} catch (Exception e) {
Log.e(e.getMessage());
}
}
开发者ID:zillachan,项目名称:LibZilla,代码行数:26,代码来源:ASupportLoading.java
示例8: saveModel
import com.github.snowdream.android.util.Log; //导入依赖的package包/类
/**
* Save container to model
*
* @param container container
* @param model model
*/
public static void saveModel(Object container, Object model) {
Field[] fields = container.getClass().getDeclaredFields();
if (fields == null) return;
if (model == null) return;
for (Field field : fields) {
InjectBinding binding = field.getAnnotation(InjectBinding.class);
if (binding != null) {
field.setAccessible(true);
try {
String fieldName = binding.value();
saveValue(field, fieldName, model, container);
} catch (Exception e) {
Log.e(e.getMessage());
}
}
}
}
开发者ID:zillachan,项目名称:LibZilla,代码行数:24,代码来源:ZillaBinding.java
示例9: update
import com.github.snowdream.android.util.Log; //导入依赖的package包/类
/**
* batch update rows,if the key is empty,insert it.
* <br>
* 批量更新已经存在的数据,如果主键值为空,则插入
*
* @param list the list to be updated
* @return boolean
*/
public boolean update(List<?> list) {
lock.writeLock().lock();
if (list == null || list.size() == 0) {
return false;
}
Object temp = list.get(0);
filter(temp.getClass());
String tableName = AnnotationUtil.getClassName(temp.getClass());
Cursor cursor = null;
try {
cursor = database.query(tableName, null, null, null, null, null, null, "1");
for (int i = 0, l = list.size(); i < l; i++) {
Object model = list.get(i);
update(tableName, model, null, cursor);
}
} catch (Exception e) {
Log.e(e.getMessage());
} finally {
closeCursor(cursor);
lock.writeLock().unlock();
}
return true;
}
开发者ID:zillachan,项目名称:LibZilla,代码行数:32,代码来源:ZillaDB.java
示例10: queryAll
import com.github.snowdream.android.util.Log; //导入依赖的package包/类
/**
* query all rows from table
* <br>
* 查询表中所有记录,并转化成model数组
*
* @param c Type
* @return model list
*/
public <T> List<T> queryAll(Class<T> c) {
lock.readLock().lock();
filter(c);
String tableName = AnnotationUtil.getClassName(c);
List<T> list = new ArrayList<T>();
Cursor cursor = null;
try {
cursor = database.query(tableName, null, null, null, null, null, null);
int count = cursor.getCount();
if (count == 0) {
return list;
}
for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) {
T cloneModel = cursor2Model(cursor, c);
list.add(cloneModel);
}
} catch (Exception e) {
Log.e("Exception", e);
} finally {
closeCursor(cursor);
lock.readLock().unlock();
}
return list;
}
开发者ID:zillachan,项目名称:LibZilla,代码行数:33,代码来源:ZillaDB.java
示例11: queryById
import com.github.snowdream.android.util.Log; //导入依赖的package包/类
/**
* query one row form table by key
* <br>
* 查询单条记录
*
* @param c Type
* @param id id
* @return Object 没有查找到返回null
*/
public <T> T queryById(Class<T> c, String id) {
lock.readLock().lock();
filter(c);
String tableName = AnnotationUtil.getClassName(c);
Cursor cursor = null;
T result = null;
String key = AnnotationUtil.getClassKey(c);
try {
cursor = this.database.query(tableName, null, key + "=?", new String[]{id}, null, null, null);
if (cursor.getCount() == 0) {
return null;
}
cursor.moveToFirst();
result = cursor2Model(cursor, c);
} catch (Exception e) {
Log.e("Exception", e);
} finally {
closeCursor(cursor);
lock.readLock().unlock();
}
return result;
}
开发者ID:zillachan,项目名称:LibZilla,代码行数:32,代码来源:ZillaDB.java
示例12: query
import com.github.snowdream.android.util.Log; //导入依赖的package包/类
/**
* query first row by the given condition
* <br>
* 根据条件查询一条记录
*
* @param c Type
* @param selection where string
* @param condition where list
* @return Object 没有查找到返回null
*/
public <T> T query(Class<T> c, String selection, String[] condition) {
lock.readLock().lock();
T result = null;
try {
filter(c);
List<T> items = query(c, selection, condition, null, "1");
if (items != null && items.size() > 0) {
result = items.get(0);
}
} catch (Exception e) {
Log.e("Exception", e);
} finally {
lock.readLock().unlock();
}
return result;
}
开发者ID:zillachan,项目名称:LibZilla,代码行数:27,代码来源:ZillaDB.java
示例13: getLast_insert_rowid
import com.github.snowdream.android.util.Log; //导入依赖的package包/类
/**
* return rowid of current table.
* <br>
* 返回插入的自增字段的值
*
* @return the rowid of table
*/
private int getLast_insert_rowid() {
lock.readLock().lock();
String sql = "select last_insert_rowid() newid;";
Cursor cursor = null;
int rowid = 0;
try {
cursor = database.rawQuery(sql, null);
if (cursor != null && cursor.moveToNext()) {
rowid = cursor.getInt(0);
}
} catch (Exception e) {
Log.e("Exception", e);
} finally {
closeCursor(cursor);
lock.readLock().unlock();
}
return rowid;
}
开发者ID:zillachan,项目名称:LibZilla,代码行数:26,代码来源:ZillaDB.java
示例14: setKeyValue
import com.github.snowdream.android.util.Log; //导入依赖的package包/类
/**
* set keyvalue of an saved obj
*
* @param obj
* @param key
* @return
*/
public static void setKeyValue(Object obj, Object key) {
Field[] fields = obj.getClass().getDeclaredFields();
if (fields != null) {
Id id = null;
Field idField = null;
for (Field field : fields) { //获取ID注解
id = field.getAnnotation(Id.class);
if (id != null) {
idField = field;
break;
}
}
if (id != null) { //有ID注解
// primaryKey = idField.getName();
try {
idField.setAccessible(true);
idField.set(obj, key);
} catch (IllegalAccessException e) {
Log.e("set key value failed:" + e.getMessage());
}
} else {
throw new RuntimeException("@Id annotation is not found, Please make sure the @Id annotation is added in Model!");
}
}
}
开发者ID:zillachan,项目名称:LibZilla,代码行数:33,代码来源:AnnotationUtil.java
示例15: copyFile
import com.github.snowdream.android.util.Log; //导入依赖的package包/类
/**
* 拷贝文件
*
* @param srcPath srcPath of file
* @param desPaht desPathe of file
* @return boolean if copy success
*/
public static boolean copyFile(String srcPath, String desPaht) {
try {
File originFile = new File(srcPath);
File destFile = new File(desPaht);
String tempsrcName = originFile.getName();
String tempsrcPath = originFile.getCanonicalPath().replace(tempsrcName, "");
String tempdesName = destFile.getName();
String tempdesPath = destFile.getPath().replace(tempdesName, "");
return copyFile(tempsrcPath, tempsrcName, tempdesPath, tempdesName);
} catch (Exception e) {
Log.e("copyFileError", e);
}
return false;
}
开发者ID:zillachan,项目名称:LibZilla,代码行数:23,代码来源:FileHelper.java
示例16: uncaughtException
import com.github.snowdream.android.util.Log; //导入依赖的package包/类
/**
* 当UncaughtException发生时会转入该函数来处理
* @param thread thread
* @param ex exception
*/
@Override
public void uncaughtException(Thread thread, Throwable ex) {
if (!handleException(ex) && mDefaultHandler != null) {
//如果用户没有处理则让系统默认的异常处理器来处理
mDefaultHandler.uncaughtException(thread, ex);
} else {
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
Log.e("error : ", e);
}
//退出程序
AppManager.getAppManager().AppExit(mContext);
android.os.Process.killProcess(android.os.Process.myPid());
System.exit(1);
}
}
开发者ID:zillachan,项目名称:LibZilla,代码行数:23,代码来源:CrashHandler.java
示例17: onPageSelected
import com.github.snowdream.android.util.Log; //导入依赖的package包/类
@Override
public void onPageSelected(int position) {
Log.i("onPageSelected position:" + position);
if (imageUrls != null && imageUrls.size() > position) {
imageUri = imageUrls.get(position);
Uri uri = Uri.parse(imageUri);
fileName = uri.getLastPathSegment();
getSupportActionBar().setSubtitle(fileName);
Log.i("The path of the image is: " + imageUri);
}
Intent shareIntent = createShareIntent();
if (shareIntent != null) {
doShare(shareIntent);
}
Log.i("onPageSelected imageUri:" + imageUri);
}
开发者ID:snowdream,项目名称:android-imageviewer,代码行数:20,代码来源:ImageViewerActivity.java
示例18: getView
import com.github.snowdream.android.util.Log; //导入依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Image image = getItem(position);
if (image == null) {
Log.w("The Image is null!");
return null;
}
final ImageView imageView;
if (convertView == null) {
LayoutInflater inflater = LayoutInflater.from(mContext);
imageView = (ImageView) inflater.inflate(R.layout.item_grid_image, parent, false);
} else {
imageView = (ImageView) convertView;
}
ImageLoader.getInstance().displayImage(image.getThumb(), imageView, options);
imageView.setTag(image);
return imageView;
}
开发者ID:snowdream,项目名称:android-wallpaper,代码行数:23,代码来源:ImageGridAdapter.java
示例19: onUpgrade
import com.github.snowdream.android.util.Log; //导入依赖的package包/类
/**
* This is called when your application is upgraded and it has a higher
* version number. This allows you to adjust the various data to match the
* new version number.
*/
@Override
public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource, int oldVersion,
int newVersion) {
try {
Log.i("onUpgrade");
TableUtils.dropTable(connectionSource, Album.class, true);
TableUtils.dropTable(connectionSource, Albums.class, true);
TableUtils.dropTable(connectionSource, Image.class, true);
// after we drop the old databases, we create the new ones
onCreate(db, connectionSource);
} catch (SQLException e) {
Log.e("Can't drop databases", e);
throw new RuntimeException(e);
}
}
开发者ID:snowdream,项目名称:android-wallpaper,代码行数:22,代码来源:DatabaseHelper.java
示例20: getAlbumsFromNet
import com.github.snowdream.android.util.Log; //导入依赖的package包/类
@Override
public Albums getAlbumsFromNet(String url) throws Exception {
Albums albums = null;
String json = SyncHttpClient.get(url);
if (!TextUtils.isEmpty(json)) {
Gson gson = new Gson();
albums = gson.fromJson(json, Albums.class);
Log.i(json);
} else {
throw new NullPointerException("json for the albums is empty");
}
return albums;
}
开发者ID:snowdream,项目名称:android-wallpaper,代码行数:18,代码来源:INetImpl.java
注:本文中的com.github.snowdream.android.util.Log类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论