List of usage examples for android.util Log e
public static int e(String tag, String msg)
From source file:Main.java
/** * // w w w .ja v a2 s . c o m * @param args * @param val * @param rb */ public static void setSelectedRadioButton(String args, String[] val, RadioButton[] rb) { try { if (val.length == rb.length) { for (int i = 0; i < val.length; i++) { if (args.equalsIgnoreCase(val[i])) { rb[i].setChecked(true); } } } } catch (Exception e) { Log.e("ZambelzUtility", "setSelectedRadioButton : " + e.getMessage()); } }
From source file:Main.java
static public boolean setPin(Class btClass, BluetoothDevice btDevice, String str) throws Exception { try {//from ww w .j a v a 2s . c o m Method removeBondMethod = btClass.getDeclaredMethod("setPin", new Class[] { byte[].class }); Boolean returnValue = (Boolean) removeBondMethod.invoke(btDevice, new Object[] { str.getBytes() }); Log.v("tag", "++++++++++++" + returnValue); Log.e("returnValue", "" + returnValue); } catch (SecurityException e) { // throw new RuntimeException(e.getMessage()); e.printStackTrace(); } catch (IllegalArgumentException e) { // throw new RuntimeException(e.getMessage()); e.printStackTrace(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return true; }
From source file:Main.java
public static void setStringPreferences(Context context, String name, String value) { try {//w w w . j a v a 2 s . co m SharedPreferences.Editor editor = context .getSharedPreferences(SHARED_PREFERENCE_NAME, Context.MODE_PRIVATE).edit(); editor.putString(name, value); editor.commit(); } catch (Exception e) { Log.e("datautils", e.getMessage() + ""); remove(context, name); } }
From source file:Main.java
public static byte[] loadAsset(Context context, String asset) { byte[] buffer = null; try {/* w w w . j a v a2s . c o m*/ InputStream is = context.getAssets().open(asset); int size = is.available(); buffer = new byte[size]; is.read(buffer); is.close(); } catch (IOException e) { Log.e(TAG, "Failed to load asset " + asset + ": " + e); } return buffer; }
From source file:Main.java
public static long string2Millis(String str, String pattern) { SimpleDateFormat format = new SimpleDateFormat(pattern, Locale.getDefault()); long millis = 0; try {/* w w w.ja v a 2s .com*/ millis = format.parse(str).getTime(); } catch (ParseException e) { Log.e("TAG", e.getMessage()); } return millis; }
From source file:Main.java
public static void setBooleanPreferences(Context context, String name, boolean value) { try {//from w ww . ja v a 2 s .co m SharedPreferences.Editor editor = context .getSharedPreferences(SHARED_PREFERENCE_NAME, Context.MODE_PRIVATE).edit(); editor.putBoolean(name, value); editor.commit(); } catch (Exception e) { Log.e("datautils", e.getMessage()); remove(context, name); } }
From source file:Main.java
public static String getFacebookUserName(Context context) { if (facebookUserName != null) return facebookUserName; else {// w ww . ja va 2s .co m SharedPreferences prefs = context.getSharedPreferences("profilo", Context.MODE_PRIVATE); String name = prefs.getString("reg_username", ""); if (name.isEmpty()) { Log.e("HELPER_FACEBOOK", "username facebook not found."); return null; } else { facebookUserName = name; return facebookUserName; } } }
From source file:Main.java
public static boolean deleteSpicificFile(String filePath) { if (!isEmpty(filePath) && isSDCardAvailable()) { try {//from w ww . j a v a 2 s.c om File file = new File(filePath); if (file.exists() && file.isFile()) { return file.delete(); } } catch (Exception e) { if (e != null && isNotEmpty(e.getMessage())) { Log.e("@@@", e.getMessage()); } } } return false; }
From source file:Main.java
public static Bitmap decodeBitmapFromResource(Resources resource, int resId, int reqWidth, int reqHeight) { final BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true;//from www. java 2 s .c o m BitmapFactory.decodeResource(resource, resId, options); options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight); Log.e("BitmapUtils", "inSampleSize = " + options.inSampleSize); options.inJustDecodeBounds = false; return BitmapFactory.decodeResource(resource, resId, options); }
From source file:Main.java
public static Process deleteBuildProperty(Context c, String propName) { Process p = null;// ww w .j ava 2 s.com try { remountSystem(c); p = runSuCommandAsync(c, "busybox sed -i \"/" + propName + "=.*/d\" /system/build.prop ; "); p.waitFor(); } catch (Exception d) { Log.e("Helper", "d"); Log.e("Helper", "Failed to delete build.prop. errcode:" + d.toString()); } return p; }