List of usage examples for android.util Log i
public static int i(String tag, String msg)
From source file:Main.java
public static void showToast(final Activity activity, final String msg) { Log.i(TAG, "Show Toast: " + msg); if (activity == null) { return;/*from ww w. j a v a 2s . c om*/ } activity.runOnUiThread(new Runnable() { @Override public void run() { try { Toast toast = Toast.makeText(activity, msg, Toast.LENGTH_LONG); toast.show(); } catch (Throwable e) { Log.e(TAG, "error: " + e, e); } } }); }
From source file:Main.java
/** * Writes GL version info to the log.// w w w . ja v a2s . c o m */ public static void logVersionInfo() { Log.i(TAG, "vendor : " + GLES20.glGetString(GLES20.GL_VENDOR)); Log.i(TAG, "renderer: " + GLES20.glGetString(GLES20.GL_RENDERER)); Log.i(TAG, "version : " + GLES20.glGetString(GLES20.GL_VERSION)); if (false) { int[] values = new int[1]; GLES30.glGetIntegerv(GLES30.GL_MAJOR_VERSION, values, 0); int majorVersion = values[0]; GLES30.glGetIntegerv(GLES30.GL_MINOR_VERSION, values, 0); int minorVersion = values[0]; if (GLES30.glGetError() == GLES30.GL_NO_ERROR) { Log.i(TAG, "iversion: " + majorVersion + "." + minorVersion); } } }
From source file:Main.java
public static void registerNewSourceSinkConnection(int counter, Bundle bundle) { Log.i("PEP", "in registerNewSourceSinkConnection(int counter, Bundle bundle)"); int taintInfoKeyCounter = 0; if (bundle != null) { for (String intentKey : bundle.keySet()) { if (intentKey.startsWith(keyBaseName)) { String possibleNumber = intentKey.substring(keyBaseName.length()); if (possibleNumber.length() > 0 && TextUtils.isDigitsOnly(possibleNumber)) { int currentCounter = Integer.parseInt(possibleNumber); if (taintInfoKeyCounter < currentCounter) taintInfoKeyCounter = currentCounter; }//from w w w. j a va 2 s .c o m } } if (taintInfoKeyCounter == 0) { Log.i("PEP", "bundle:" + bundle.toString()); if (bundle.containsKey(keyBaseName)) { String taintSourceCats = bundle.getString(keyBaseName); String[] allCats = taintSourceCats.split(","); sourceSinkConnection.put(counter, new HashSet<String>(Arrays.asList(allCats))); } } else { if (bundle.containsKey(keyBaseName + taintInfoKeyCounter)) { String taintSourceCats = bundle.getString(keyBaseName + taintInfoKeyCounter); String[] allCats = taintSourceCats.split(","); sourceSinkConnection.put(counter, new HashSet<String>(Arrays.asList(allCats))); } } } }
From source file:Main.java
public static boolean copyAsset(Context context, AssetManager am, boolean force) { File newDir = getSDDir(context); File sd = Environment.getExternalStorageDirectory(); if (sd != null && sd.exists() && sd.isDirectory() && newDir != null && newDir.exists() && newDir.isDirectory()) { File hpDir = new File(sd, ".hp48"); if (hpDir.exists()) { File allFiles[] = hpDir.listFiles(); if (allFiles != null && allFiles.length > 0) { Log.i("x48", "Moving x48 files from the old dir " + sd.getAbsolutePath() + " to the proper one :"); for (File file : allFiles) { File newFile = new File(newDir, file.getName()); Log.i("x48", "Moving " + file.getAbsolutePath() + " to " + newFile); file.renameTo(newFile); }/*from w ww . ja v a 2 s.co m*/ } Log.i("x48", "Deleting old directory"); hpDir.delete(); } } return copyAsset(am, newDir, force); }
From source file:Main.java
/** * @brief log utility/* www . j ava 2 s .c o m*/ */ static private void log(String format, Object arg1, Object arg2) { if (enableLog) Log.i(TAG, String.format(format, arg1, arg2)); }
From source file:Main.java
public static void logi(String msg) { if (!debug) { return;/* w ww. j av a 2s . c om*/ } Log.i("ldx", "" + msg); }
From source file:Main.java
public static double[] toDoubleArray(List<Double> ld) { double[] results = new double[ld.size()]; int i = 0;//from w w w. ja va2 s.co m for (Double d : ld) { results[i++] = (d != null ? d : 0); } Log.i("TAG", "double conversion results " + Arrays.toString(results)); return results; }
From source file:Main.java
public static void killProcess(String packageName) { String processId = ""; try {//from ww w . j ava 2s . c o m Runtime r = Runtime.getRuntime(); Process p = r.exec("ps"); BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream())); String inline; while ((inline = br.readLine()) != null) { if (packageName != null) { if (inline.contains(packageName)) { break; } } else { Log.e("PvTorrent_proc", "packageName is null"); } } br.close(); Log.i("PvTorrent_proc", "inline" + inline); if (inline != null) { StringTokenizer processInfoTokenizer = new StringTokenizer(inline); int count = 0; while (processInfoTokenizer.hasMoreTokens()) { count++; processId = processInfoTokenizer.nextToken(); if (count == 2) { break; } } Log.i("PvTorrent_proc", "kill process : " + processId); r.exec("kill -9 " + processId); } } catch (IOException ex) { Log.e("PvTorrent_proc", "kill" + ex.getStackTrace()); } }
From source file:Main.java
public static String[] toStringArray(List<String> ls) { String[] results = new String[ls.size()]; int i = 0;/* w w w . j a v a2 s.c o m*/ for (String s : ls) { results[i++] = (s != null ? s : ""); } Log.i("TAG", "string conversion results " + Arrays.toString(results)); return results; }
From source file:Main.java
public static void registerNewSourceSinkConnection(int counter, Bundle bundle) { Log.i("PEP", "in registerNewSourceSinkConnection(int counter, Bundle bundle)" + counter + " " + bundle.toString());/*from www .j ava 2 s .c om*/ int taintInfoKeyCounter = 0; if (bundle != null) { for (String intentKey : bundle.keySet()) { if (intentKey.startsWith(keyBaseName)) { String possibleNumber = intentKey.substring(keyBaseName.length()); if (possibleNumber.length() > 0 && TextUtils.isDigitsOnly(possibleNumber)) { int currentCounter = Integer.parseInt(possibleNumber); if (taintInfoKeyCounter < currentCounter) taintInfoKeyCounter = currentCounter; } } } if (taintInfoKeyCounter == 0) { Log.i("PEP", "bundle:" + bundle.toString()); if (bundle.containsKey(keyBaseName)) { String taintSourceCats = bundle.getString(keyBaseName); String[] allCats = taintSourceCats.split(","); sourceSinkConnection.put(counter, new HashSet<String>(Arrays.asList(allCats))); } } else { if (bundle.containsKey(keyBaseName + taintInfoKeyCounter)) { String taintSourceCats = bundle.getString(keyBaseName + taintInfoKeyCounter); String[] allCats = taintSourceCats.split(","); sourceSinkConnection.put(counter, new HashSet<String>(Arrays.asList(allCats))); } } } }