List of usage examples for android.util Log ERROR
int ERROR
To view the source code for android.util Log ERROR.
Click Source Link
From source file:com.radicaldynamic.groupinform.services.DatabaseService.java
public boolean isDbLocal(String db) { final String tt = t + "isDbLocal(): "; boolean result = false; try {// w w w .j a v a 2 s .co m if (mLocalDbInstance == null) connectToLocalServer(); if (mLocalDbInstance.getAllDatabases().indexOf("db_" + db) != -1) result = true; } catch (DbAccessException e) { if (Collect.Log.WARN) Log.w(Collect.LOGTAG, tt + e.toString()); } catch (Exception e) { if (Collect.Log.ERROR) Log.e(Collect.LOGTAG, tt + "unhandled exception: " + e.toString()); } return result; }
From source file:com.google.android.marvin.mytalkback.ProcessorFocusAndSingleTap.java
private void handleViewScrolled(AccessibilityEvent event, AccessibilityRecordCompat record) { mLastViewScrolledEvent = event.getEventTime(); final AccessibilityNodeInfoCompat source = record.getSource(); if (source == null) { LogUtils.log(this, Log.ERROR, "Drop scroll with no source node"); return;/*from w ww .j a v a 2 s .co m*/ } // Only move focus if we've already seen the source. if (source.equals(mLastScrollSource)) { final boolean isMovingForward = (mLastScrollAction == AccessibilityNodeInfo.ACTION_SCROLL_FORWARD) || (event.getFromIndex() > mLastScrollFromIndex) || (event.getToIndex() > mLastScrollToIndex); final boolean wasScrollAction = (mLastScrollAction != 0); mHandler.followScrollDelayed(source, isMovingForward, wasScrollAction); // Performing a scroll action results in smooth scrolling, which may // send multiple events spaced at least 100ms apart. mHandler.clearScrollActionDelayed(); } else { setScrollActionImmediately(0); } if (mLastScrollSource != null) { mLastScrollSource.recycle(); } mLastScrollSource = source; mLastScrollFromIndex = record.getFromIndex(); mLastScrollToIndex = record.getToIndex(); }
From source file:com.digipom.manteresting.android.adapter.NailCursorAdapter.java
/** * BindView will also be called after newView. See {@link CursorAdapter} *///from www. j av a 2 s . co m @Override public void bindView(View view, Context context, Cursor cursor) { try { // 84, or 0.825, comes from the margins/paddings around the // image. This will need to be changed if the margins/paddings are // changed or multi-column mode is used. final int approxImageWidthInPixels = (int) (context.getResources().getDisplayMetrics().widthPixels * 0.825f); // Request a load of the bitmaps on either side, to avoid // problems when scrolling up and down. final int cursorPosition = cursor.getPosition(); if (cursorPosition > 0) { cursor.moveToPrevious(); if (cursor.getString(nailObjectColumnIndex) != null) { cacheDataAndGet(context, cursor, approxImageWidthInPixels); } cursor.moveToNext(); } if (cursorPosition < cursor.getCount() - 1) { cursor.moveToNext(); if (cursor.getString(nailObjectColumnIndex) != null) { cacheDataAndGet(context, cursor, approxImageWidthInPixels); } cursor.moveToPrevious(); } final ViewHolder viewHolder = (ViewHolder) view.getTag(); final CachedData cachedDataForThisNailItem = cacheDataAndGet(context, cursor, approxImageWidthInPixels); viewHolder.nailDescription.setText(cachedDataForThisNailItem.nailDescription); viewHolder.nailUserAndCategory.setText(cachedDataForThisNailItem.styledUserAndCategory); if (failedDownloads.contains(cachedDataForThisNailItem.originalImageUriString)) { // This image has failed. The user will have to select to // retry this image. INVISIBLE and not GONE so that the view // doesn't jump in sizes for couldNotLoadImageIndicator. viewHolder.imageLoadingIndicator.setVisibility(View.INVISIBLE); viewHolder.couldNotLoadImageIndicator.setVisibility(View.VISIBLE); viewHolder.loadedImage.setVisibility(View.GONE); } else { // Should default to WRAP_CONTENT viewHolder.loadedImage.getLayoutParams().height = LayoutParams.WRAP_CONTENT; Bitmap bitmap = null; if (serviceConnector.getService() != null) { bitmap = serviceConnector.getService().getOrLoadLifoAsync( cachedDataForThisNailItem.originalImageUriString, approxImageWidthInPixels, bitmapCompleteReceiver); } if (bitmap == null) { viewHolder.imageLoadingIndicator.setVisibility(View.VISIBLE); viewHolder.couldNotLoadImageIndicator.setVisibility(View.INVISIBLE); viewHolder.loadedImage.setVisibility(View.GONE); } else { viewHolder.imageLoadingIndicator.setVisibility(View.GONE); viewHolder.couldNotLoadImageIndicator.setVisibility(View.GONE); viewHolder.loadedImage.setVisibility(View.VISIBLE); viewHolder.loadedImage.setImageBitmap(bitmap); } } } catch (JSONException e) { if (LoggerConfig.canLog(Log.ERROR)) { Log.e(TAG, "Could not load JSON object from database.", e); } } catch (Exception e) { if (LoggerConfig.canLog(Log.ERROR)) { Log.e(TAG, "Error binding view.", e); } } }
From source file:com.digipom.manteresting.android.fragment.NailFragment.java
private int calculateInitialOffsetForNextFetch() { int offsetToReturn = -1; if (listView != null) { try {//from www. j a v a 2 s . c om final int listViewCount = listView.getCount(); if (listViewCount > 2) { // Get the first and last nail IDs, and subtract the 2 // to get the initial offset. final Cursor firstCursor = (Cursor) listView.getItemAtPosition(1); if (firstCursor != null && !firstCursor.isClosed()) { final int columnIndex = firstCursor.getColumnIndex(Nails.NAIL_ID); final int firstNailId = Integer.parseInt(firstCursor.getString(columnIndex)); final Cursor lastCursor = (Cursor) listView.getItemAtPosition(listViewCount - 2); if (lastCursor != null && !lastCursor.isClosed()) { final int lastNailId = Integer.parseInt(firstCursor.getString(columnIndex)); offsetForNextPage = firstNailId - lastNailId; return firstNailId - lastNailId; } } } } catch (Exception e) { if (LoggerConfig.canLog(Log.ERROR)) { Log.e(TAG, "getOffsetForNextFetch()", e); } } } return offsetToReturn; }
From source file:com.kth.common.utils.etc.LogUtil.java
/** * ERROR ?./*w w w .ja va 2 s .c o m*/ * * @param clazz ?? Class. * @param msg . */ public static void e(final Class<?> clazz, final String msg) { if (LogUtil.isErrorEnabled()) { Log.println(Log.ERROR, TAG, LogUtil.getClassLineNumber(clazz) + " - " + msg); // ?? ? ?. if (LogUtil.isFileLogEnabled()) { write(Log.ERROR, LogUtil.getClassLineNumber(clazz), msg); } } }
From source file:com.kth.common.utils.etc.LogUtil.java
/** * ERROR ?./*ww w .j av a2 s . co m*/ * * @param clazz ?? Class. * @param tr Throwable. */ public static void e(final Class<?> clazz, final Throwable tr) { if (LogUtil.isErrorEnabled()) { Log.println(Log.ERROR, TAG, LogUtil.getClassLineNumber(clazz) + " - " + Log.getStackTraceString(tr)); // ?? ? ?. if (LogUtil.isFileLogEnabled()) { write(Log.ERROR, LogUtil.getClassLineNumber(clazz), tr); } } }
From source file:com.android.screenspeak.eventprocessor.ProcessorPhoneticLetters.java
/** * Get the mapping from letter to phonetic letter for a given locale. * The map is loaded as needed./*www .j a va2s. co m*/ */ private Map<String, String> getPhoneticLetterMap(String locale) { Map<String, String> map = mPhoneticLetters.get(locale); if (map == null) { // If there is no entry for the local, the map will be left // empty. This prevents future load attempts for that locale. map = new HashMap<String, String>(); mPhoneticLetters.put(locale, map); InputStream stream = mService.getResources().openRawResource(R.raw.phonetic_letters); BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(stream, "UTF-8")); StringBuilder stringBuilder = new StringBuilder(); String input; while ((input = reader.readLine()) != null) { stringBuilder.append(input); } stream.close(); JSONObject locales = new JSONObject(stringBuilder.toString()); JSONObject phoneticLetters = locales.getJSONObject(locale); if (phoneticLetters != null) { Iterator<?> keys = phoneticLetters.keys(); while (keys.hasNext()) { String letter = (String) keys.next(); map.put(letter, phoneticLetters.getString(letter)); } } } catch (java.io.IOException e) { LogUtils.log(this, Log.ERROR, e.toString()); } catch (JSONException e) { LogUtils.log(this, Log.ERROR, e.toString()); } } return map; }
From source file:com.radicaldynamic.groupinform.services.InformOnlineService.java
private boolean checkin() { // Assume we are registered unless told otherwise boolean registered = true; List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("deviceId", Collect.getInstance().getInformOnlineState().getDeviceId())); params.add(/*from w w w . ja v a 2s. com*/ new BasicNameValuePair("deviceKey", Collect.getInstance().getInformOnlineState().getDeviceKey())); params.add(new BasicNameValuePair("fingerprint", Collect.getInstance().getInformOnlineState().getDeviceFingerprint())); try { params.add(new BasicNameValuePair("lastCheckinWith", this.getPackageManager().getPackageInfo(this.getPackageName(), 0).versionName)); } catch (NameNotFoundException e1) { params.add(new BasicNameValuePair("lastCheckinWith", "unknown")); } String checkinUrl = Collect.getInstance().getInformOnlineState().getServerUrl() + "/checkin"; String postResult = HttpUtils.postUrlData(checkinUrl, params); JSONObject checkin; try { checkin = (JSONObject) new JSONTokener(postResult).nextValue(); String result = checkin.optString(InformOnlineState.RESULT, InformOnlineState.FAILURE); if (result.equals(InformOnlineState.OK)) { if (Collect.Log.INFO) Log.i(Collect.LOGTAG, t + "successful checkin"); Collect.getInstance().getInformOnlineState().setExpired(false); // Update device role -- it might have changed Collect.getInstance().getInformOnlineState() .setDeviceRole(checkin.optString("role", AccountDevice.ROLE_UNASSIGNED)); } else if (result.equals(InformOnlineState.EXPIRED)) { if (Collect.Log.INFO) Log.i(Collect.LOGTAG, t + "associated order is expired; marking device as expired"); Collect.getInstance().getInformOnlineState().setExpired(true); } else if (result.equals(InformOnlineState.FAILURE)) { if (Collect.Log.WARN) Log.w(Collect.LOGTAG, t + "checkin unsuccessful"); registered = false; } else { // Something bad happened if (Collect.Log.ERROR) Log.e(Collect.LOGTAG, t + "system error while processing postResult"); } } catch (NullPointerException e) { // Communication error if (Collect.Log.ERROR) Log.e(Collect.LOGTAG, t + "no postResult to parse. Communication error with node.js server?"); e.printStackTrace(); } catch (JSONException e) { // Parse error (malformed result) if (Collect.Log.ERROR) Log.e(Collect.LOGTAG, t + "failed to parse postResult " + postResult); e.printStackTrace(); } // Clear the session for subsequent requests and reset stored state if (registered == false) Collect.getInstance().getInformOnlineState().resetDevice(); return registered; }
From source file:com.mattprecious.prioritysms.activity.ProfileListActivity.java
@Override public void onIabPurchaseFinished(IabResult result, Purchase info) { if (iabHelper == null) { return;/* ww w . j a v a 2 s.co m*/ } if (result.isFailure()) { if (result.getResponse() != IabHelper.IABHELPER_USER_CANCELLED) { Crashlytics.log(Log.ERROR, TAG, "Error purchasing: " + result); showCrouton(R.string.pro_purchase_failed, Style.ALERT); } return; } setPro(true); showCrouton(R.string.pro_purchase_success, Style.CONFIRM); }
From source file:com.kth.common.utils.etc.LogUtil.java
/** * ERROR ?./*from ww w.j a va2 s . c om*/ * * @param clazz ?? Class. * @param msg . * @param tr Throwable. */ public static void e(final Class<?> clazz, final String msg, final Throwable tr) { if (LogUtil.isErrorEnabled()) { Log.println(Log.ERROR, TAG, LogUtil.getClassLineNumber(clazz) + " - " + msg + '\n' + Log.getStackTraceString(tr)); // ?? ? ?. if (LogUtil.isFileLogEnabled()) { write(Log.ERROR, LogUtil.getClassLineNumber(clazz), msg, tr); } } }