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

The following examples show how to use android.util.Log#e() . 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
Source File: MainActivity.java    From MycroftCore-Android with Apache License 2.0 7 votes vote down vote up
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 2
Source File: LoadStatTask.java    From samba-documents-provider with GNU General Public License v3.0 6 votes vote down vote up
@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 3
Source File: DirectoryFragment.java    From SSForms with GNU General Public License v3.0 6 votes vote down vote up
@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 4
Source File: SmsTemplateListAsyncAdapter.java    From financisto with GNU General Public License v2.0 6 votes vote down vote up
@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
Source File: ComplexActivity.java    From AndroidProjects with 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 6
Source File: HookHelper.java    From AndHook with 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 7
Source File: TinderRVAdapter.java    From AvatarTinderView with Apache License 2.0 5 votes vote down vote up
@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 8
Source File: PeerConnectionClient.java    From Yahala-Messenger with 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 9
Source File: AutoTextView.java    From NewXmPluginSDK with 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 10
Source File: CrashHandler.java    From FimiX8-RE with 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 11
Source File: NetdEventListenerService.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
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 12
Source File: CameraHelper.java    From RecordVideo with 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 13
Source File: UtilityAdapter.java    From VideoRecord with 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 14
Source File: ImageLoader.java    From aptoide-client-v8 with GNU General Public License v3.0 5 votes vote down vote up
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 15
Source File: DatePickerDialog.java    From date_picker_converter with Apache License 2.0 5 votes vote down vote up
@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 16
Source File: CameraConnectionFragment.java    From fritz-examples with MIT License 5 votes vote down vote up
/**
 * 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 17
Source File: AxisBase.java    From Ticket-Analysis with 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 18
Source File: MainActivity.java    From AndroidProjects with MIT License 4 votes vote down vote up
@Override
protected void onRestart() {
    Log.e("Edwin", TAG + " —> onRestart");
    super.onRestart();
}
 
Example 19
Source File: CameraImageActivity.java    From AndroidDemo with 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
Source File: ErrorActivity.java    From Instagram-Profile-Downloader with MIT License 4 votes vote down vote up
@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);
    }
}