Example usage for android.util Log ERROR

List of usage examples for android.util Log ERROR

Introduction

In this page you can find the example usage for android.util Log ERROR.

Prototype

int ERROR

To view the source code for android.util Log ERROR.

Click Source Link

Document

Priority constant for the println method; use Log.e.

Usage

From source file:com.google.android.marvin.mytalkback.TalkBackService.java

/**
 * Resumes TalkBack and Explore by Touch.
 *//* ww  w .j  ava 2s  . co  m*/
private void resumeTalkBack() {
    if (isServiceActive()) {
        LogUtils.log(this, Log.ERROR, "Attempted to resume TalkBack when not suspended.");
        return;
    }

    unregisterReceiver(mSuspendedReceiver);
    resumeInfrastructure();
}

From source file:com.radicaldynamic.groupinform.services.DatabaseService.java

private void openLocalDb(String db) throws DbUnavailableException {
    final String tt = t + "openLocalDb(): ";

    try {//  w ww .j  a va 2  s  .  co  m
        /*
         * We used to create the database if it did not exist HOWEVER this had unintended side effects.
         * 
         * Since local databases are typically initialized on-demand the first time the user selects
         * them for operations, databases that were selected for replication but not yet "switched to" 
         * would be created as empty databases if the user backed out of the folder selection screen 
         * without specifically choosing a database.
         * 
         * Because the database then existed, attempts to "switch to" the database via the folder
         * selection screen (and have it initialized on-demand as expected) would fail.  At least,
         * until the system got around to creating and replicating it automatically.
         */
        if (mLocalDbInstance.getAllDatabases().indexOf("db_" + db) == -1) {
            if (Collect.Log.WARN)
                Log.w(Collect.LOGTAG, tt + "database does not exist; failing attempt to open");
            throw new DbUnavailableException();
        }

        if (Collect.Log.DEBUG)
            Log.d(Collect.LOGTAG, tt + "opening database " + db);
        mLocalDbConnector = new InformCouchDbConnector("db_" + db, mLocalDbInstance);
    } catch (Exception e) {
        if (Collect.Log.ERROR)
            Log.e(Collect.LOGTAG, tt + "while opening DB " + db + ": " + e.toString());
        e.printStackTrace();
        throw new DbUnavailableException();
    }
}

From source file:com.google.android.marvin.screenspeak.ScreenSpeakService.java

/**
 * Resumes ScreenSpeak and Explore by Touch.
 *///  ww  w . j  av a2 s  .com
public void resumeScreenSpeak() {
    if (isServiceActive()) {
        if (LogUtils.LOG_LEVEL <= Log.ERROR) {
            Log.e(LOGTAG, "Attempted to resume ScreenSpeak when not suspended.");
        }
        return;
    }

    SharedPreferencesUtils.storeBooleanAsync(mPrefs, getString(R.string.pref_suspended), false);

    unregisterReceiver(mSuspendedReceiver);
    resumeInfrastructure();

    mSpeechController.speak(getString(R.string.screenspeak_resumed),
            SpeechController.QUEUE_MODE_UNINTERRUPTIBLE, 0, null);
}

From source file:com.irccloud.android.activity.PastebinsActivity.java

public void onIRCEvent(int what, Object o) {
    IRCCloudJSONObject obj;//from  www  . j  av a2s  . c  om
    switch (what) {
    case NetworkConnection.EVENT_SUCCESS:
        obj = (IRCCloudJSONObject) o;
        if (obj.getInt("_reqid") == reqid) {
            Log.d("IRCCloud", "Pastebin deleted successfully");
            reqid = -1;
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    adapter.pastebins.remove(pasteToDelete);
                    adapter.notifyDataSetChanged();
                    checkEmpty();
                    pasteToDelete = null;
                }
            });
        }
        break;
    case NetworkConnection.EVENT_FAILURE_MSG:
        obj = (IRCCloudJSONObject) o;
        if (reqid != -1 && obj.getInt("_reqid") == reqid) {
            Crashlytics.log(Log.ERROR, "IRCCloud", "Delete failed: " + obj.toString());
            reqid = -1;
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    AlertDialog.Builder builder = new AlertDialog.Builder(PastebinsActivity.this);
                    builder.setTitle("Error");
                    builder.setMessage("Unable to delete this pastebin.  Please try again shortly.");
                    builder.setPositiveButton("Close", null);
                    builder.show();
                }
            });
        }
        break;
    default:
        break;
    }
}

From source file:com.vidinoti.pixlive.PixLive.java

private void createARView(final int x, final int y, final int width, final int height, final int ctrlID,
        final boolean insertBelow, final CallbackContext callbackContext) {
    cordova.getActivity().runOnUiThread(new Runnable() {
        public void run() {

            if (imageSender == null) {
                try {
                    imageSender = new DeviceCameraImageSender();
                } catch (IOException e) {
                    VDARSDKController.log(Log.ERROR, TAG, Log.getStackTraceString(e));
                }/*from  w w  w  .j a  v a  2 s  .  c  o  m*/

                VDARSDKController.getInstance().setImageSender(imageSender);
            }

            VDARAnnotationView annotationView = new VDARAnnotationView(cordova.getActivity());

            DisplayMetrics displaymetrics = new DisplayMetrics();

            cordova.getActivity().getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);

            annotationView.setVisibility(View.VISIBLE);

            FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
                    (int) Math.round(width * displaymetrics.scaledDensity),
                    (int) Math.round(height * displaymetrics.scaledDensity));
            params.leftMargin = (int) Math.round(x * displaymetrics.scaledDensity);
            params.topMargin = (int) Math.round(y * displaymetrics.scaledDensity);

            annotationView.setLayoutParams(params);

            touchView.addView(annotationView, 0);

            arViews.put(ctrlID, annotationView);

            VDARSDKController.getInstance().setActivity(cordova.getActivity());

            annotationView.onResume();

        }
    });
}

From source file:com.radicaldynamic.groupinform.services.DatabaseService.java

private void openRemoteDb(String db) throws DbUnavailableException {
    final String tt = t + "openRemoteDb(): ";

    try {/*from w w  w  .j a v  a2s .  co m*/
        if (Collect.Log.DEBUG)
            Log.d(Collect.LOGTAG, tt + "opening database " + db);
        mRemoteDbConnector = new InformCouchDbConnector("db_" + db, mRemoteDbInstance);

        /* 
         * This should trigger any 401:Unauthorized errors when connecting to a remote DB
         * (better to know about them now then to experience a crash later because we didn't trap something)
         */
        mRemoteDbConnector.getDbInfo();
    } catch (Exception e) {
        if (Collect.Log.ERROR)
            Log.e(Collect.LOGTAG, tt + "while opening DB " + db + ": " + e.toString());
        e.printStackTrace();
        throw new DbUnavailableException();
    }
}

From source file:com.google.android.marvin.mytalkback.CursorController.java

private boolean navigateWrapAround(int direction) {
    final AccessibilityNodeInfo root = mService.getRootInActiveWindow();
    if (root == null) {
        return false;
    }//from w w  w  . j av  a 2 s . c o m

    AccessibilityNodeInfoCompat compatRoot = null;
    AccessibilityNodeInfoCompat tempNode = null;
    AccessibilityNodeInfoCompat wrapNode = null;

    try {
        compatRoot = new AccessibilityNodeInfoCompat(root);

        switch (direction) {
        case NodeFocusFinder.SEARCH_FORWARD:
            wrapNode = navigateSelfOrFrom(compatRoot, direction);
            break;
        case NodeFocusFinder.SEARCH_BACKWARD:
            tempNode = getLastNodeFrom(compatRoot);
            wrapNode = navigateSelfOrFrom(tempNode, direction);
            break;
        }

        if (wrapNode == null) {
            LogUtils.log(this, Log.ERROR, "Failed to wrap navigation");
            return false;
        }

        return setCursor(wrapNode);
    } finally {
        AccessibilityNodeInfoUtils.recycleNodes(compatRoot, tempNode, wrapNode);
    }
}

From source file:com.android.talkback.SpeechController.java

private void speak(FeedbackItem item, int queueMode, UtteranceCompleteRunnable completedAction) {

    // If this FeedbackItem is flagged as NO_SPEECH, ignore speech and
    // immediately process earcons and haptics without disrupting the speech
    // queue.//  w  w w  .  j  av  a  2s  .  com
    // TODO: Consider refactoring non-speech feedback out of
    // this class entirely.
    if (item.hasFlag(FeedbackItem.FLAG_NO_SPEECH)) {
        for (FeedbackFragment fragment : item.getFragments()) {
            playEarconsFromFragment(fragment);
            playHapticsFromFragment(fragment);
        }

        return;
    }

    if (item.hasFlag(FeedbackItem.FLAG_SKIP_DUPLICATE) && hasItemOnQueueOrSpeaking(item)) {
        return;
    }

    item.setUninterruptible(queueMode == QUEUE_MODE_UNINTERRUPTIBLE);
    item.setCompletedAction(completedAction);

    boolean currentFeedbackInterrupted = false;
    if (shouldClearQueue(item, queueMode)) {
        FeedbackItemFilter filter = getFeedbackItemFilter(item, queueMode);
        // Call onUtteranceComplete on each queue item to be cleared.
        ListIterator<FeedbackItem> iterator = mFeedbackQueue.listIterator(0);
        while (iterator.hasNext()) {
            FeedbackItem currentItem = iterator.next();
            if (filter.accept(currentItem)) {
                iterator.remove();
                notifyItemInterrupted(currentItem);
            }
        }

        if (mCurrentFeedbackItem != null && filter.accept(mCurrentFeedbackItem)) {
            notifyItemInterrupted(mCurrentFeedbackItem);
            currentFeedbackInterrupted = true;
        }
    }

    mFeedbackQueue.add(item);
    if (mSpeechListener != null) {
        mSpeechListener.onUtteranceQueued(item);
    }

    // If TTS isn't ready, this should be the only item in the queue.
    if (!mFailoverTts.isReady()) {
        LogUtils.log(this, Log.ERROR, "Attempted to speak before TTS was initialized.");
        return;
    }

    if ((mCurrentFeedbackItem == null) || currentFeedbackInterrupted) {
        mCurrentFragmentIterator = null;
        speakNextItem();
    } else {
        LogUtils.log(this, Log.VERBOSE, "Queued speech item, waiting for \"%s\"",
                mCurrentFeedbackItem.getUtteranceId());
    }
}

From source file:com.google.android.marvin.mytalkback.CursorController.java

private AccessibilityNodeInfoCompat navigateFrom(AccessibilityNodeInfoCompat node, int direction) {
    if (node == null) {
        return null;
    }/*from  w  ww .  j a  v a  2  s  . c  om*/

    AccessibilityNodeInfoCompat next = null;

    try {
        // Be cautious and always clear the list of seen nodes.
        AccessibilityNodeInfoUtils.recycleNodes(mNavigateSeenNodes);

        next = NodeFocusFinder.focusSearch(node, direction);

        while ((next != null) && !AccessibilityNodeInfoUtils.shouldFocusNode(mService, next)) {
            if (mNavigateSeenNodes.contains(next)) {
                LogUtils.log(this, Log.ERROR, "Found duplicate during traversal: %s", next.getInfo());
                // TODO(alanv): Should we return null here or just stop traversing?
                break;
            }

            LogUtils.log(this, Log.VERBOSE, "Search strategy rejected node: %s", next.getInfo());

            mNavigateSeenNodes.add(next);

            next = NodeFocusFinder.focusSearch(next, direction);
        }

        return next;
    } finally {
        AccessibilityNodeInfoUtils.recycleNodes(mNavigateSeenNodes);
    }
}

From source file:com.radicaldynamic.groupinform.services.DatabaseService.java

private void performHousekeeping() {
    final String tt = t + "performHousekeeping(): ";

    try {/*w  w w  .j a va 2s  .co m*/
        List<String> allDatabases = mLocalDbInstance.getAllDatabases();
        Iterator<String> dbs = allDatabases.iterator();

        while (dbs.hasNext()) {
            String db = dbs.next();

            // Skip special databases
            if (!db.startsWith("_")) {
                // Our metadata knows nothing about the db_ prefix
                db = db.substring(3);

                AccountFolder folder = Collect.getInstance().getInformOnlineState().getAccountFolders().get(db);

                if (folder == null) {
                    // Remove databases that exist locally but for which we have no metadata
                    if (Collect.Log.DEBUG)
                        Log.d(Collect.LOGTAG, tt + "no metatdata for " + db + " (removing)");
                    mLocalDbInstance.deleteDatabase("db_" + db);
                } else if (isDbLocal(db) && folder.isReplicated() == false) {
                    // Purge any databases that are local but not on the replication list                        
                    try {
                        ReplicationStatus status = replicate(db, REPLICATE_PUSH);

                        if (status != null && status.isOk()) {
                            if (Collect.Log.DEBUG)
                                Log.d(Collect.LOGTAG, tt + "final replication push successful, removing " + db);
                            mLocalDbInstance.deleteDatabase("db_" + db);
                        }
                    } catch (Exception e) {
                        if (Collect.Log.ERROR)
                            Log.e(Collect.LOGTAG,
                                    tt + "final replication push of " + db + " failed at " + e.toString());
                        e.printStackTrace();
                    }
                }
            }
        }
    } catch (DbAccessException e) {
        if (Collect.Log.WARN)
            Log.w(Collect.LOGTAG, tt + "database not available " + e.toString());
    } catch (Exception e) {
        if (Collect.Log.ERROR)
            Log.e(Collect.LOGTAG, tt + "unhandled exception " + e.toString());
        e.printStackTrace();
    }
}