List of usage examples for android.util Log d
public static int d(String tag, String msg)
From source file:Main.java
public static void scheduleRepeat(Context context, Intent intent, Long triggerAtMillis, Long intervalMillis) { PendingIntent p = PendingIntent.getBroadcast(context, 1, intent, PendingIntent.FLAG_UPDATE_CURRENT); AlarmManager alarm = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); alarm.setInexactRepeating(AlarmManager.RTC_WAKEUP, triggerAtMillis, intervalMillis, p); Log.d("petsitter-alarm", "Alarme agendado com sucesso com repeat."); }
From source file:Main.java
public static InputStream loadAsset(Context context, String path, String filename) { AssetManager assetManager = context.getResources().getAssets(); InputStream inputStream = null; try {/*from www .j a v a 2s.co m*/ String fullFilename = path + File.separator + filename; inputStream = assetManager.open(fullFilename); if (inputStream != null) Log.d("AssetsUtil", "Loaded " + fullFilename); } catch (IOException e) { e.printStackTrace(); } return inputStream; }
From source file:Main.java
public static int checkGlError(boolean throwException) { int error = glGetError(); if (error != GL_NO_ERROR) { Log.d(s_LOG_TAG, "GL error = 0x" + Integer.toHexString(error)); if (throwException) { throw new RuntimeException("GL ERROR = 0x" + Integer.toHexString(error)); }/*from w w w .j av a 2 s. co m*/ } return error; }
From source file:Main.java
public static void saveBitmap(Bitmap bitmap, String fileName) { long time = System.currentTimeMillis(); String filePath = Environment.getExternalStorageDirectory() + "/" + fileName; try {/*from w ww. j a v a 2 s. com*/ OutputStream stream = new FileOutputStream(filePath); bitmap.compress(Bitmap.CompressFormat.PNG, 80, stream); stream.close(); } catch (Exception e) { throw new RuntimeException(e); } Log.d("artbook", "save bitmap time: " + (System.currentTimeMillis() - time)); }
From source file:Main.java
/** * generate new image path file/*from w ww. j a v a 2s.c o m*/ * * @return */ public static File generateImagePath() { try { File storageDir = getAlbumDir(); String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.US).format(new Date()); return new File(storageDir, "IMG_" + timeStamp + ".jpeg"); } catch (Exception e) { Log.d("android_utilities", "the error is " + e); } return null; }
From source file:Main.java
public static void debug(String tag, String message) { if (isDebug) { try {//from w w w .ja v a2 s. c o m Log.d(debugTag + tag, message); } catch (Exception e) { System.out.println(tag + ">>>" + message); } } }
From source file:Main.java
public static void storeImage(Bitmap image, String name) { if (DEBUG) {//from ww w. j a v a 2s .c o m String TAG = "MobileODR"; File pictureFile = getOutputMediaFile(name); if (pictureFile == null) { Log.d(TAG, "Error creating media file, check storage permissions: ");// e.getMessage()); return; } try { FileOutputStream fos = new FileOutputStream(pictureFile); image.compress(Bitmap.CompressFormat.PNG, 90, fos); fos.close(); } catch (FileNotFoundException e) { Log.d(TAG, "File not found: " + e.getMessage()); } catch (IOException e) { Log.d(TAG, "Error accessing file: " + e.getMessage()); } } }
From source file:Main.java
public static void escribeLog(String Que, String txt) { Log.d(Que, txt); }
From source file:Main.java
public static void writeNewFile(String filePath, String fileContents) { File f = new File(filePath); if (f.exists()) { f.delete();//from ww w . j a v a2 s . co m } try { // Create file FileWriter fstream = new FileWriter(f); BufferedWriter out = new BufferedWriter(fstream); out.write(fileContents); //Close the output stream out.close(); } catch (Exception e) { Log.d(TAG, "Failed to create " + filePath + " File contents: " + fileContents); } }
From source file:Main.java
public static void writeNewFile(String filePath, String fileContents) { File f = new File(filePath); if (f.exists()) { f.delete();//from ww w. j a v a2 s.c o m } try { // Create file FileWriter fstream = new FileWriter(f); BufferedWriter out = new BufferedWriter(fstream); out.write(fileContents); //Close the output stream out.close(); } catch (Exception e) { Log.d(TAG, "Failed to create " + filePath + " File contents: " + fileContents); } }