Java Code Examples for android.util.Log#e()

The following examples show how to use android.util.Log#e() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Override
public Map<Uri, StructStat> doInBackground(Void... args) {
  Map<Uri, StructStat> stats = new HashMap<>(mMetadataMap.size());
  for (DocumentMetadata metadata : mMetadataMap.values()) {
    try {
      metadata.loadStat(mClient);
      if (isCancelled()) {
        return stats;
      }
    } catch(Exception e) {
      // Failed to load a stat for a child... Just eat this exception, the only consequence it may
      // have is constantly retrying to fetch the stat.
      Log.e(TAG, "Failed to load stat for " + metadata.getUri());
    }
  }
  return stats;
}
 
Example 2
@Override
public void onReceive(Context arg0, Intent intent) {
    Runnable r = new Runnable() {
        public void run() {
            try {
                if (currentDir == null) {
                    listRoots();
                } else {
                    listFiles(currentDir);
                }
            } catch (Exception e) {
                Log.e("tmessages", e.toString());
            }
        }
    };
    if (Intent.ACTION_MEDIA_UNMOUNTED.equals(intent.getAction())) {
        listView.postDelayed(r, 1000);
    } else {
        r.run();
    }
}
 
Example 3
Source Project: AndroidProjects   File: ComplexActivity.java    License: MIT License 6 votes vote down vote up
@Override
public void handleMessage(Message msg) {
    super.handleMessage(msg);
    ComplexActivity activity = activityWeakReference.get();
    if (activity != null) {
        switch (msg.what) {
            case 0:
                activity.main_image_view.setImageResource(R.mipmap.ic_launcher);
                break;
            case 100:
                count++;
                Log.e("Edwin", "count = " + count);
                break;
        }
    }

}
 
Example 4
@Override
public void onItemDismiss(int position, int dir) {
    Log.d (TAG, String.format("swipped %s pos to %s (%s)",
        position, dir == START ? "left" : dir == END ? "right" : "??", dir));

    final long itemId = listUtil.getItem(position).id;
    switch (dir) {
        case START: // left swipe
            editItem(itemId);
            break;
        case END: // right swipe
            deleteItem(itemId, position);
            break;
        default:
            Log.e(TAG, "unknown move: " + dir);
    }
}
 
Example 5
public static void loadExtension(Context context, String apkFile, String packageName) {
    Log.i(TAG, "Trying to load new class from apk.");
    final File dexInternalStoragePath = new File(context.getDir("extensions", Context.MODE_PRIVATE),
            apkFile + ".apk");
    final File optimizedDexOutputPath = context.getDir("outdex", Context.MODE_PRIVATE);
    Log.i(TAG, "dexInternalStoragePath: " + dexInternalStoragePath.getAbsolutePath());
    if (dexInternalStoragePath.exists()) {
        Log.i(TAG, "New apk found! " + apkFile);
        DexClassLoader dexLoader = new DexClassLoader(dexInternalStoragePath.getAbsolutePath(),
                optimizedDexOutputPath.getAbsolutePath(),
                null,
                ClassLoader.getSystemClassLoader().getParent());
        try {
            Class klazz = dexLoader.loadClass("ai.mycroft.extension." + packageName);
            Constructor constructor = klazz.getConstructor(String.class);
            Method method = klazz.getDeclaredMethod("getInfo");
            Object newObject = constructor.newInstance("New object info");
            Log.i(TAG, "New object has class: " + newObject.getClass().getName());
            Log.i(TAG, "Invoking getInfo on new object: " + method.invoke(newObject));
        } catch (Exception e) {
            Log.e(TAG, "Exception:", e);
        }
    } else {
        Log.i(TAG, "Sorry new apk doesn't exist.");
    }
}
 
Example 6
Source Project: Ticket-Analysis   File: AxisBase.java    License: MIT License 5 votes vote down vote up
/**
 * Adds a new LimitLine to this axis.
 *
 * @param l
 */
public void addLimitLine(LimitLine l) {
    mLimitLines.add(l);

    if (mLimitLines.size() > 6) {
        Log.e("MPAndroiChart",
                "Warning! You have more than 6 LimitLines on your axis, do you really want " +
                        "that?");
    }
}
 
Example 7
/**
 * Stops the background thread and its {@link Handler}.
 */
private void stopBackgroundThread() {
    backgroundThread.quitSafely();
    try {
        backgroundThread.join();
        backgroundThread = null;
        backgroundHandler = null;
    } catch (final InterruptedException e) {
        Log.e(TAG, "Exception!" + e);
    }
}
 
Example 8
@Override
public void onClick(View v) {
    //tryVibrate();
    Log.e("DATEPICKERDIALOG", "just to checking if its working or not" + v.getId());
    if (v.getId() == R.id.mdtp_date_picker_year) {
        Log.e("DATEPICKERDIALOG", "just to checking if its working or not: YEAR_VIEW");
        setCurrentView(YEAR_VIEW);
    } else if (v.getId() == R.id.mdtp_date_picker_month_and_day) {
        Log.e("DATEPICKERDIALOG", "just to checking if its working or not: datePickerMonthAndDay");
        setCurrentView(MONTH_AND_DAY_VIEW);
    }
}
 
Example 9
public Target<Drawable> loadWithShadowCircleTransform(String url, ImageView imageView,
    @ColorInt int shadowColor) {
  Context context = weakContext.get();
  if (context != null) {
    return Glide.with(context)
        .load(AptoideUtils.IconSizeU.generateSizeStoreString(url, resources, windowManager))
        .apply(getRequestOptions().transform(
            new ShadowCircleTransformation(context, imageView, shadowColor)))
        .transition(DrawableTransitionOptions.withCrossFade())
        .into(imageView);
  } else {
    Log.e(TAG, "::loadWithShadowCircleTransform() Context is null");
  }
  return null;
}
 
Example 10
Source Project: VideoRecord   File: UtilityAdapter.java    License: MIT License 5 votes vote down vote up
/** 底层回调 */
public static int ndkNotify(int key, int value) {
	if (mOnNativeListener != null) {
		mOnNativeListener.ndkNotify(key, value);
	} else {
		Log.e("ndkNotify", "ndkNotify key:" + key + ", value: " + value);
	}
	return 0;
}
 
Example 11
Source Project: RecordVideo   File: CameraHelper.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 根据相机id获取相机对象
 * @param cameraId
 * @return
 */
public static Camera getCameraInstance(int cameraId){
    Camera c = null;
    try {
        c = Camera.open(cameraId); // attempt to get a Camera instance
    }
    catch (Exception e){
        Log.e(TAG, "open camera failed: " + e.getMessage());
        // Camera is not available (in use or does not exist)
    }
    return c; // returns null if camera is unavailable
}
 
Example 12
Source Project: AndHook   File: HookHelper.java    License: MIT License 5 votes vote down vote up
public static Class<?> findClass(final String classname,
                                 final ClassLoader loader) {
    try {
        return loader.loadClass(classname);
    } catch (final Exception e) {
        Log.e(AndHook.LOG_TAG, "failed to find class " + classname
                + " on ClassLoader " + loader, e);
    }
    return null;
}
 
Example 13
public synchronized boolean addNetdEventCallback(int callerType, INetdEventCallback callback) {
    if (!isValidCallerType(callerType)) {
        Log.e(TAG, "Invalid caller type: " + callerType);
        return false;
    }
    mNetdEventCallbackList[callerType] = callback;
    return true;
}
 
Example 14
Source Project: FimiX8-RE   File: CrashHandler.java    License: MIT License 5 votes vote down vote up
public void uncaughtException(Thread thread, Throwable ex) {
    if (handleException(ex) || this.mDefaultHandler == null) {
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            Log.e(TAG, "error : ", e);
        }
        Process.killProcess(Process.myPid());
        System.exit(1);
        return;
    }
    this.mDefaultHandler.uncaughtException(thread, ex);
}
 
Example 15
Source Project: NewXmPluginSDK   File: AutoTextView.java    License: Apache License 2.0 5 votes vote down vote up
public AutoTextView(Context context, AttributeSet attrs) {
    super(context, attrs);
    mContext = context;
    mHandler = new Handler(mContext.getMainLooper());
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.AutoTextView);
    mTextSize = a.getInt(R.styleable.AutoTextView_autoTextSize, 13);
    Log.e(TAG, "mTextSize: " + mTextSize);
    mTextColor = a.getColor(R.styleable.AutoTextView_autoTextColor, 0xFF999999);
    a.recycle();
    setFactory(this);
}
 
Example 16
Source Project: Yahala-Messenger   File: PeerConnectionClient.java    License: MIT License 5 votes vote down vote up
private void reportError(final String errorMessage) {
    Log.e(TAG, "Peerconnection error: " + errorMessage);
    executor.execute(new Runnable() {
        @Override
        public void run() {
            if (!isError) {
                events.onPeerConnectionError(errorMessage);
                isError = true;
            }
        }
    });
}
 
Example 17
@Override
    public boolean onItemMove(int fromPosition, int toPosition) {
        if (getListItem() == null) return false;
        Log.e("fromPosition: "  + fromPosition, "toPosition: " + toPosition);
//        Collections.swap(getListItem(), fromPosition, toPosition);
        moveList(getListItem(), fromPosition, toPosition);
//        if (toPosition == 0 || toPosition == 1){
//            notifyDataSetChanged();
//        }
//        else {
            notifyItemMoved(fromPosition, toPosition);
//        }
        return true;
    }
 
Example 18
Source Project: AndroidProjects   File: MainActivity.java    License: MIT License 4 votes vote down vote up
@Override
protected void onRestart() {
    Log.e("Edwin", TAG + " —> onRestart");
    super.onRestart();
}
 
Example 19
Source Project: AndroidDemo   File: CameraImageActivity.java    License: MIT License 4 votes vote down vote up
@Override
public void onError(@NonNull CameraDevice camera, int error) {
    camera.close();
    cameraDevice = null;
    Log.e(TAG, "ERROR = " + error);
}
 
Example 20
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_error);

    Intent intent = getIntent();

    androidx.appcompat.widget.Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    Utility.setActionBarColor(this);
    Utility.setToolbar(this, toolbar, getResources().getString(R.string.error_report_title));
    toolbar.setTitleTextColor(getColor(R.color.black));

    androidx.appcompat.app.ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setTitle(R.string.error_report_title);
        actionBar.setDisplayShowTitleEnabled(true);
    }

    Button reportButton = findViewById(R.id.errorReportButton);
    userCommentBox = findViewById(R.id.errorCommentBox);
    TextView errorView = findViewById(R.id.errorView);
    TextView infoView = findViewById(R.id.errorInfosView);
    TextView errorMessageView = findViewById(R.id.errorMessageView);

    ActivityCommunicator ac = ActivityCommunicator.getCommunicator();
    returnActivity = ac.returnActivity;
    errorInfo = intent.getParcelableExtra(ERROR_INFO);
    errorList = intent.getStringArrayExtra(ERROR_LIST);

    // important add guru meditation
    addGuruMeditaion();
    currentTimeStamp = getCurrentTimeStamp();

    reportButton.setOnClickListener((View v) -> {
        Context context = this;
        new AlertDialog.Builder(context)
                .setIcon(android.R.drawable.ic_dialog_alert)
                .setTitle(R.string.privacy_policy_title)
                .setMessage(R.string.start_accept_privacy_policy)
                .setCancelable(false)
                .setNeutralButton(R.string.read_privacy_policy, (dialog, which) -> {
                    Intent webIntent = new Intent(Intent.ACTION_VIEW,
                            Uri.parse(context.getString(R.string.privacy_policy_url))
                    );
                    context.startActivity(webIntent);
                })
                .setPositiveButton(R.string.accept, (dialog, which) -> {
                    Intent i = new Intent(Intent.ACTION_SENDTO);
                    i.setType("text/html");
                    i.setData(Uri.parse("mailto:" + ERROR_EMAIL_ADDRESS))
                            .putExtra(Intent.EXTRA_SUBJECT, ERROR_EMAIL_SUBJECT)
                            .putExtra(Intent.EXTRA_TEXT,
                                    Html.fromHtml(buildHtml()));
                    startActivity(Intent.createChooser(i, "Send Email"));
                })
                .setNegativeButton(R.string.decline, (dialog, which) -> {
                    // do nothing
                })
                .show();

    });

    // normal bugreport
    buildInfo(errorInfo);
    if (errorInfo.message != 0) {
        errorMessageView.setText(errorInfo.message);
    } else {
        errorMessageView.setVisibility(View.GONE);
        findViewById(R.id.messageWhatHappenedView).setVisibility(View.GONE);
    }

    errorView.setText(formErrorText(errorList));

    //print stack trace once again for debugging:
    for (String e : errorList) {
        Log.e("Debugging Error :", e);
    }
}