本文整理汇总了Java中de.ub0r.android.logg0r.Log.e方法的典型用法代码示例。如果您正苦于以下问题:Java Log.e方法的具体用法?Java Log.e怎么用?Java Log.e使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类de.ub0r.android.logg0r.Log
的用法示例。
在下文中一共展示了Log.e方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fillConversation
import de.ub0r.android.logg0r.Log; //导入方法依赖的package包/类
/**
* Fill Conversations data. If needed: spawn threads.
*
* @param context {@link Context}
* @param c {@link Conversation}
* @param sync fetch of information
*/
public static void fillConversation(final Context context, final Conversation c,
final boolean sync) {
Log.d(TAG, "fillConversation(ctx, conv, ", sync, ")");
if (context == null || c == null || c.getThreadId() < 0) {
return;
}
AsyncHelper helper = new AsyncHelper(context, c);
if (sync) {
helper.doInBackground((Void) null);
} else {
try {
helper.execute((Void) null);
} catch (RejectedExecutionException e) {
Log.e(TAG, "rejected execution", e);
}
}
}
示例2: send
import de.ub0r.android.logg0r.Log; //导入方法依赖的package包/类
/**
* Send a message.
*
* @return true, if message was sent
*/
private boolean send() {
if (TextUtils.isEmpty(to) || TextUtils.isEmpty(text)) {
return false;
}
for (String r : to.split(",")) {
r = MobilePhoneAdapter.cleanRecipient(r);
if (TextUtils.isEmpty(r)) {
Log.w(TAG, "skip empty recipient: ", r);
continue;
}
try {
send(r, text);
} catch (Exception e) {
Log.e(TAG, "unable to send message: ", to, e);
Toast.makeText(this, R.string.error_sending_failed,Toast.LENGTH_LONG).show();
}
}
return true;
}
示例3: isDefaultApp
import de.ub0r.android.logg0r.Log; //导入方法依赖的package包/类
static boolean isDefaultApp(final Context context) {
// there is no default sms app before android 4.4
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
return true;
}
try {
// check if this is the default sms app.
// If the device doesn't support Telephony.Sms (i.e. tablet) getDefaultSmsPackage() will
// be null.
final String smsPackage = Telephony.Sms.getDefaultSmsPackage(context);
return smsPackage == null || smsPackage.equals(BuildConfig.APPLICATION_ID);
} catch (SecurityException e) {
// some samsung devices/tablets want permission GET_TASKS o.O
Log.e(TAG, "failed to query default SMS app", e);
return true;
}
}
示例4: getConversation
import de.ub0r.android.logg0r.Log; //导入方法依赖的package包/类
/**
* Get a {@link Conversation}.
*
* @param context {@link Context}
* @param threadId threadId
* @param forceUpdate force an update of that {@link Conversation}
* @return {@link Conversation}
*/
public static Conversation getConversation(final Context context, final int threadId,
final boolean forceUpdate) {
Log.d(TAG, "getConversation(", threadId, ")");
synchronized (CACHE) {
Conversation ret = CACHE.get(threadId);
if (ret == null || ret.getContact().getNumber() == null || forceUpdate) {
Cursor cursor = context.getContentResolver().query(URI_SIMPLE, PROJECTION_SIMPLE,
ID + " = ?", new String[]{String.valueOf(threadId)}, null);
if (cursor.moveToFirst()) {
ret = getConversation(context, cursor, true);
} else {
Log.e(TAG, "did not found conversation: ", threadId);
}
cursor.close();
}
return ret;
}
}
示例5: onReceive
import de.ub0r.android.logg0r.Log; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
Log.d(TAG, "onReceive(context, ", intent, ")");
if (ACTION_MARK_READ.equals(intent.getAction())) {
try {
Bundle extras = intent.getExtras();
if (extras == null) {
Log.w(TAG, "empty extras");
return;
}
// remember that we have to add the package here ..
String muri = extras.getString(EXTRA_MURI);
Log.d(TAG, "received uri: ", muri);
ConversationListActivity.markRead(context, Uri.parse(muri), 1);
} catch (Exception e) {
Log.e(TAG, "unable to mark message read", e);
}
}
}
示例6: markRead
import de.ub0r.android.logg0r.Log; //导入方法依赖的package包/类
/**
* Mark all messages with a given {@link Uri} as read.
*
* @param context {@link Context}
* @param uri {@link Uri}
* @param read read status
*/
static void markRead(final Context context, final Uri uri, final int read) {
Log.d(TAG, "markRead(", uri, ",", read, ")");
if (uri == null) {
return;
}
String[] sel = Message.SELECTION_UNREAD;
if (read == 0) {
sel = Message.SELECTION_READ;
}
final ContentResolver cr = context.getContentResolver();
final ContentValues cv = new ContentValues();
cv.put(Message.PROJECTION[Message.INDEX_READ], read);
try {
cr.update(uri, cv, Message.SELECTION_READ_UNREAD, sel);
} catch (IllegalArgumentException | SQLiteException e) {
Log.e(TAG, "failed update", e);
Toast.makeText(context, e.getMessage(), Toast.LENGTH_LONG).show();
}
SmsReceiver.updateNewMessageNotification(context, null);
}
示例7: onItemClick
import de.ub0r.android.logg0r.Log; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
public void onItemClick(final AdapterView<?> parent, final View view, final int position,
final long id) {
final Conversation c = Conversation.getConversation(this,
(Cursor) parent.getItemAtPosition(position), false);
final Uri target = c.getUri();
final Intent i = new Intent(this, MessageListActivity.class);
i.setData(target);
try {
startActivity(i);
} catch (ActivityNotFoundException e) {
Log.e(TAG, "error launching intent: ", i.getAction(), ", ", i.getData());
Toast.makeText(this,
"error launching messaging app!\n" + "Please contact the developer.",
Toast.LENGTH_LONG).show();
}
}
示例8: buildIntent
import de.ub0r.android.logg0r.Log; //导入方法依赖的package包/类
/**
* Build an {@link Intent} for sending it.
*
* @param autosend autosend
* @param showChooser show chooser
* @return {@link Intent}
*/
private Intent buildIntent(final boolean autosend, final boolean showChooser) {
//noinspection ConstantConditions
if (conv == null || conv.getContact() == null) {
Log.e(TAG, "buildIntent() without contact: ", conv);
throw new NullPointerException("conv and conv.getContact() must be not null");
}
final String text = etText.getText().toString().trim();
final Intent i = ConversationListActivity.getComposeIntent(this, conv.getContact()
.getNumber(), showChooser);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
i.putExtra(Intent.EXTRA_TEXT, text);
i.putExtra("sms_body", text);
if (autosend && enableAutosend && text.length() > 0) {
i.putExtra("AUTOSEND", "1");
}
if (showChooser) {
return Intent.createChooser(i, getString(R.string.reply));
} else {
return i;
}
}
示例9: send
import de.ub0r.android.logg0r.Log; //导入方法依赖的package包/类
/**
* Answer/send message.
*
* @param autosend enable autosend
* @param showChooser show chooser
*/
private void send(final boolean autosend, final boolean showChooser) {
try {
final Intent i = buildIntent(autosend, showChooser);
startActivity(i);
//noinspection ConstantConditions
PreferenceManager
.getDefaultSharedPreferences(this)
.edit()
.putString(PreferencesActivity.PREFS_BACKUPLASTTEXT,
etText.getText().toString()).commit();
etText.setText("");
} catch (ActivityNotFoundException | NullPointerException e) {
Log.e(TAG, "unable to launch sender app", e);
Toast.makeText(this, R.string.error_sending_failed, Toast.LENGTH_LONG).show();
}
}
示例10: setInfos
import de.ub0r.android.logg0r.Log; //导入方法依赖的package包/类
public void setInfos(final Context context) {
if (mUri == null) {
return;
}
try {
getInfos(context, MediaStore.MediaColumns.DISPLAY_NAME, MediaStore.MediaColumns.TITLE,
MediaStore.MediaColumns.MIME_TYPE);
} catch (IllegalArgumentException e) {
Log.e(TAG, "failed fetching meta data", e);
try {
getInfos(context, MediaStore.MediaColumns.DISPLAY_NAME, null,
MediaStore.MediaColumns.MIME_TYPE);
} catch (IllegalArgumentException e1) {
Log.e(TAG, "failed fetching meta data", e1);
}
}
}
示例11: contains
import de.ub0r.android.logg0r.Log; //导入方法依赖的package包/类
public boolean contains(final String url) {
Log.v(TAG, "contains(", url, ")");
if (mDiskCache == null) {
Log.w(TAG, "disk cache does not exist");
return false;
}
final String key = getKey(url);
DiskLruCache.Snapshot snapshot = null;
try {
snapshot = mDiskCache.get(key);
return snapshot != null;
} catch (IOException e) {
Log.e(TAG, "contains failed", e);
} finally {
if (snapshot != null) {
snapshot.close();
}
}
return false;
}
示例12: setSelectedItem
import de.ub0r.android.logg0r.Log; //导入方法依赖的package包/类
public void setSelectedItem(final int pos, boolean selected) {
if (pos < 0 || pos >= mDataSet.size()) {
Log.e(TAG, "setSelectedItem(%d): invalid index", pos);
return;
}
if (!mInSelectionMode) {
// disable all selected items when not in CAB mode
int l = mSelectedItems.size();
for (int i = 0; i < l; i++) {
int p = mSelectedItems.keyAt(i);
mSelectedItems.delete(p);
notifyItemChanged(p);
}
}
if (selected) {
mSelectedItems.put(pos, true);
} else {
mSelectedItems.delete(pos);
}
notifyItemChanged(pos);
}
示例13: unmatch
import de.ub0r.android.logg0r.Log; //导入方法依赖的package包/类
/**
* Run RuleMatcher.unmatch locally.
*
* @param db {@link SQLiteDatabase}
*/
private static void unmatch(final SQLiteDatabase db) {
Log.d(TAG, "unmatch()");
if (db.isReadOnly()) {
Log.e(TAG, "Database is readonly, can not unmatch on upgrade!");
return;
}
ContentValues cv = new ContentValues();
cv.put(DataProvider.Logs.PLAN_ID, DataProvider.NO_ID);
cv.put(DataProvider.Logs.RULE_ID, DataProvider.NO_ID);
// reset all but manually set plans
db.update(DataProvider.Logs.TABLE, cv, DataProvider.Logs.RULE_ID + " is null or NOT ("
+ DataProvider.Logs.RULE_ID + " = " + DataProvider.NOT_FOUND + " AND "
+ DataProvider.Logs.PLAN_ID + " != " + DataProvider.NOT_FOUND + ")", null);
cv.clear();
cv.put(DataProvider.Plans.NEXT_ALERT, 0);
db.update(DataProvider.Plans.TABLE, cv, null, null);
}
示例14: reload
import de.ub0r.android.logg0r.Log; //导入方法依赖的package包/类
/**
* Reload backup into table.
*
* @param db {@link SQLiteDatabase}
* @param table table
* @param values {@link ContentValues}[] backed up with backup()
*/
private static void reload(final SQLiteDatabase db, final String table,
final ContentValues[] values) {
if (values == null || values.length == 0) {
return;
}
Log.d(TAG, "reload(db, ", table, ", cv[", values.length, "])");
db.beginTransaction();
try {
for (ContentValues cv : values) {
Log.d(TAG, "reload: ", table, " insert: ", cv);
db.insert(table, null, cv);
}
db.setTransactionSuccessful();
} catch (SQLException e) {
Log.e(TAG, "error reloading row: " + table, e);
} finally {
db.endTransaction();
}
}
示例15: doInBackground
import de.ub0r.android.logg0r.Log; //导入方法依赖的package包/类
@Override
protected String doInBackground(final Void... params) {
String ret = null;
if (CallMeter.hasPermission(ctx, Manifest.permission.READ_CONTACTS)) {
// resolve names only when permission is granted
try {
//noinspection ConstantConditions
Cursor c = ctx.getContentResolver().query(
Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, num),
new String[]{PhoneLookup.DISPLAY_NAME}, null, null, null);
if (c != null) {
if (c.moveToFirst()) {
ret = c.getString(0);
}
c.close();
}
} catch (Exception e) {
Log.e(TAG, "error loading name", e);
}
}
return ret;
}