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:org.jorge.lolin1.ui.activities.WebViewerActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    getActionBar().setDisplayHomeAsUpEnabled(Boolean.TRUE);

    ArrayList<BaseEntry> elements = new ArrayList<>();

    switch (DrawerLayoutFragmentActivity.getLastSelectedNavDrawerIndex()) {
    case 0:/*  ww w. j  a  v  a  2  s.  co  m*/
        elements.addAll(SQLiteDAO.getSingleton().getNews());
        break;
    case 5:
        elements.addAll(SQLiteDAO.getSingleton().getSurrs());
        break;
    default:
        Crashlytics.log(Log.ERROR, "debug",
                "Should never happen - DrawerLayoutFragmentActivity.getLastSelectedNavDrawIndex() is "
                        + DrawerLayoutFragmentActivity.getLastSelectedNavDrawerIndex());
    }

    webViewerProgressFragment = new WebViewerProgressFragment();
    Bundle args = new Bundle();
    args.putString(WebViewerProgressFragment.KEY_URL,
            elements.isEmpty() ? null : elements.get(getIntent().getExtras().getInt("index", 0)).getLink());

    getFragmentManager().beginTransaction().add(android.R.id.content, webViewerProgressFragment)
            .addToBackStack("").commit();

    getFragmentManager().executePendingTransactions();
}

From source file:com.alyeska.shared.ane.iHAART.freInterface.AdherenceItem.java

public AdherenceItem(String adherenceJSON) {
    try {/*from   w ww.  j a  v a2 s .c o  m*/
        JSONObject adherenceObject = new JSONObject(adherenceJSON);
        _name = adherenceObject.getString("name");
        _nameTypeAttr = adherenceObject.getString("nameTypeAttr");
        _nameValueAttr = adherenceObject.getString("nameValueAttr");
        _reportedBy = adherenceObject.getString("reportedBy");
        _dateReported = Utilities.GetDateFromString(adherenceObject.getString("dateReported"));
        _recurrenceIndex = adherenceObject.getInt("recurrenceIndex");
        _adherence = adherenceObject.getString("adherence");

    } catch (Exception e) {
        Utilities.LogItem(Log.ERROR, LOCAL_TAG, "adherenceFromJSON failed with error: " + e.toString());
    }
}

From source file:com.android.talkbacktests.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);//from  w w w . j  a  va  2  s . co  m

    try {
        mController.init(this);
    } catch (Exception e) {
        Log.println(Log.ERROR, this.getLocalClassName(), "Failed to initialize tests.");
        finish();
        return;
    }

    getSupportFragmentManager().addOnBackStackChangedListener(this);

    final MainFragment mainFragment = new MainFragment();
    mainFragment.setOnSessionSelectedCallback(this);
    mainFragment.setTestController(mController);
    switchFragment(mainFragment, MAIN_FRAGMENT_NAME);
}

From source file:org.fs.todo.views.adapters.StateToDoAdapter.java

private void log(Throwable exp) {
    StringWriter strWriter = new StringWriter(128);
    PrintWriter ptrWriter = new PrintWriter(strWriter);
    exp.printStackTrace(ptrWriter);/*  ww w  .j  a  v a 2s . c o m*/
    log(Log.ERROR, strWriter.toString());
}

From source file:com.android.utils.traversal.WorkingTree.java

public void swapChild(WorkingTree swappedChild, WorkingTree newChild) {
    int position = mChildren.indexOf(swappedChild);
    if (position < 0) {
        LogUtils.log(Log.ERROR, "WorkingTree IllegalStateException: swap child not found");
        return;/*from  w w  w  .  j a va  2s .co  m*/
    }

    mChildren.set(position, newChild);
}

From source file:com.googlecode.eyesfree.brailleback.FocusFinder.java

public AccessibilityNodeInfoCompat linear(AccessibilityNodeInfoCompat source, int direction) {
    if (source == null) {
        return null;
    }//from w  w  w  . j  av  a2s  . c  o  m
    AccessibilityNodeInfoCompat next = NodeFocusFinder.focusSearch(source, direction);

    HashSet<AccessibilityNodeInfoCompat> seenNodes = mTmpNodeHash;
    seenNodes.clear();

    while ((next != null) && !AccessibilityNodeInfoUtils.shouldFocusNode(mContext, next)) {
        if (seenNodes.contains(next)) {
            LogUtils.log(this, Log.ERROR, "Found duplicate node during traversal: %s", next);
            break;
        }

        LogUtils.log(this, Log.VERBOSE, "Search strategy rejected node: %s", next.getInfo());
        seenNodes.add(next);
        next = NodeFocusFinder.focusSearch(next, direction);
    }

    // Clear the list of seen nodes.
    AccessibilityNodeInfoUtils.recycleNodes(seenNodes);

    if (next == null) {
        LogUtils.log(this, Log.VERBOSE, "Failed to find the next node");
    }
    return next;
}

From source file:com.example.android.common.logger.LogView.java

/**
 * Formats the log data and prints it out to the LogView.
 * @param priority Log level of the data being logged.  Verbose, Error, etc.
 * @param tag Tag for for the log data.  Can be used to organize log statements.
 * @param msg The actual message to be logged. The actual message to be logged.
 * @param tr If an exception was thrown, this can be sent along for the logging facilities
 *           to extract and print useful information.
 *//*from ww w  .j  ava  2s. c o  m*/
@Override
public void println(int priority, String tag, String msg, Throwable tr) {

    String priorityStr = null;

    // For the purposes of this View, we want to print the priority as readable text.
    switch (priority) {
    case android.util.Log.VERBOSE:
        priorityStr = "VERBOSE";
        break;
    case android.util.Log.DEBUG:
        priorityStr = "DEBUG";
        break;
    case android.util.Log.INFO:
        priorityStr = "INFO";
        break;
    case android.util.Log.WARN:
        priorityStr = "WARN";
        break;
    case android.util.Log.ERROR:
        priorityStr = "ERROR";
        break;
    case android.util.Log.ASSERT:
        priorityStr = "ASSERT";
        break;
    default:
        break;
    }

    // Handily, the Log class has a facility for converting a stack trace into a usable string.
    String exceptionStr = null;
    if (tr != null) {
        exceptionStr = android.util.Log.getStackTraceString(tr);
    }

    // Take the priority, tag, message, and exception, and concatenate as necessary
    // into one usable line of text.
    final StringBuilder outputBuilder = new StringBuilder();

    String delimiter = "\t";
    appendIfNotNull(outputBuilder, priorityStr, delimiter);
    appendIfNotNull(outputBuilder, tag, delimiter);
    appendIfNotNull(outputBuilder, msg, delimiter);
    appendIfNotNull(outputBuilder, exceptionStr, delimiter);

    // In case this was originally called from an AsyncTask or some other off-UI thread,
    // make sure the update occurs within the UI thread.
    ((Activity) getContext()).runOnUiThread((new Thread(new Runnable() {
        @Override
        public void run() {
            // Display the text we just generated within the LogView.
            appendToLog(outputBuilder.toString());
        }
    })));

    if (mNext != null) {
        mNext.println(priority, tag, msg, tr);
    }
}

From source file:com.google.android.gcm.demo.model.TaskCollection.java

private void loadTasks() {
    mTasks = new SimpleArrayMap<>();
    File file = new File(mContext.getFilesDir(), GCM_TASKS_FILE);
    if (!file.exists() || file.length() == 0) {
        return;/*from   w w w  .jav  a2 s. c o  m*/
    }
    int length = (int) file.length();
    byte[] bytes = new byte[length];
    FileInputStream in = null;
    try {
        in = new FileInputStream(file);
        int bytesRead = in.read(bytes);
        if (bytesRead == -1) {
            mLogger.log(Log.ERROR, "Failed to read tasks file.");
        } else {
            JSONArray tasksJson = new JSONArray(new String(bytes));
            for (int i = 0; i < tasksJson.length(); i++) {
                TaskTracker task = TaskTracker.fromJson(tasksJson.getJSONObject(i));
                mTasks.put(task.tag, task);
            }
        }
    } catch (IOException e) {
        mLogger.log(Log.ERROR, "Failed to read tasks file.", e);
    } catch (JSONException e) {
        mLogger.log(Log.ERROR, "Failed to deserialize tasks.", e);
    } finally {
        if (in != null) {
            try {
                in.close();
            } catch (IOException e) {
                // silently ignore
            }
        }
    }
}

From source file:nl.frankkie.bronylivewallpaper.CLog.java

public static void e(String tag, String msg) {
    if (shouldLog && errorLevel <= Log.ERROR) {
        Log.e(tag, msg);
    }
}

From source file:org.thoughtland.xlocation.UpdateService.java

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    // Check if work
    if (intent == null) {
        stopSelf();/*from www.  j a  va  2  s .  co m*/
        return 0;
    }

    // Flush
    if (cFlush.equals(intent.getAction())) {
        try {
            PrivacyService.getClient().flush();
        } catch (Throwable ex) {
            Util.bug(null, ex);
        }
        stopSelf();
        return 0;
    }

    // Update
    if (cUpdate.equals(intent.getAction())) {
        if (Util.hasProLicense(this) != null) {
            int userId = Util.getUserId(Process.myUid());
            boolean updates = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingUpdates, false);
            if (updates)
                new ActivityShare.UpdateTask(this).execute();
        }
        stopSelf();
        return 0;
    }

    // Check action
    Bundle extras = intent.getExtras();
    if (extras.containsKey(cAction)) {
        final int action = extras.getInt(cAction);
        Util.log(null, Log.WARN, "Service received action=" + action + " flags=" + flags);

        // Check service
        if (PrivacyService.getClient() == null) {
            Util.log(null, Log.ERROR, "Service not available");
            stopSelf();
            return 0;
        }

        // Start foreground service
        NotificationCompat.Builder builder = new NotificationCompat.Builder(UpdateService.this);
        builder.setSmallIcon(R.drawable.ic_launcher);
        builder.setContentTitle(getString(R.string.app_name));
        builder.setContentText(getString(R.string.msg_service));
        builder.setWhen(System.currentTimeMillis());
        builder.setAutoCancel(false);
        builder.setOngoing(true);
        Notification notification = builder.build();
        startForeground(Util.NOTIFY_SERVICE, notification);

        // Start worker
        mWorkerThread = new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    // Check action
                    if (action == cActionBoot) {
                        // Boot received
                        migrate(UpdateService.this);
                        upgrade(UpdateService.this);
                        randomize(UpdateService.this);

                    } else if (action == cActionUpdated) {
                        // Self updated
                        upgrade(UpdateService.this);

                    } else
                        Util.log(null, Log.ERROR, "Unknown action=" + action);

                    // Done
                    stopForeground(true);
                    stopSelf();
                } catch (Throwable ex) {
                    Util.bug(null, ex);
                    // Leave service running
                }
            }

        });
        mWorkerThread.start();
    } else
        Util.log(null, Log.ERROR, "Action missing");

    return START_STICKY;
}