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 setRinger2Normal(Context context) { AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); audioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL); //setting the volume audioManager.setStreamVolume(AudioManager.STREAM_RING, currentVolume, 0); Log.i("HelperFunctions ", "Normal method called"); }
From source file:Main.java
public static Bitmap getFitableBitmapWithReflection(Context context, Bitmap bitmap) { if (bitmap == null) { return null; }//ww w . j a va 2 s . co m WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = manager.getDefaultDisplay(); int width = display.getWidth(); float scale = 1.0f; if (width > 400) { scale = 1.8f; } else if (width > 300) { scale = 1.2f; } else { scale = 1.0f; } Log.i(TAG, "" + scale); Bitmap scaleBitmap = zoomBitmap(bitmap, scale); return createReflectionImageWithOrigin(scaleBitmap); }
From source file:Main.java
public static NetworkInfo getActiveNetworkInfo(Context context) { ConnectivityManager connectivityManager = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo(); if (activeNetworkInfo != null) { Log.i(TAG, "N/W Type: " + activeNetworkInfo.getTypeName()); }//w w w . jav a 2s . c om return activeNetworkInfo; }
From source file:Main.java
public static String reverseGeocode(String url) { try {// w w w . j a va2 s .com HttpGet httpGet = new HttpGet(url); BasicHttpParams httpParams = new BasicHttpParams(); DefaultHttpClient defaultHttpClient = new DefaultHttpClient(httpParams); HttpResponse httpResponse = defaultHttpClient.execute(httpGet); int responseCode = httpResponse.getStatusLine().getStatusCode(); if (responseCode == HttpStatus.SC_OK) { String charSet = EntityUtils.getContentCharSet(httpResponse.getEntity()); if (null == charSet) { charSet = "UTF-8"; } String str = new String(EntityUtils.toByteArray(httpResponse.getEntity()), charSet); defaultHttpClient.getConnectionManager().shutdown(); Log.i("-----------", "str = " + str); return str; } } catch (Exception e) { e.printStackTrace(); } return null; }
From source file:Main.java
@SuppressLint("NewApi") public static void setMetering(Camera.Parameters parameters) { if (parameters.getMaxNumMeteringAreas() > 0) { Log.i(TAG, "Old metering areas: " + parameters.getMeteringAreas()); List<Camera.Area> middleArea = buildMiddleArea(AREA_PER_1000); Log.i(TAG, "Setting metering area to : " + toString(middleArea)); parameters.setMeteringAreas(middleArea); } else {/*from ww w . j a v a 2 s .co m*/ Log.i(TAG, "Device does not support metering areas"); } }
From source file:Main.java
/** Launch an email intent if the device is capable. * * @param activity The parent activity (for context) * @param addr The address to email (not the full URI) * @param text The email body//www.ja va2 s. com */ public static void launchEmailIntent(final Activity activity, String addr, String text) { Log.i(LOG_TAG, "Launch email intent from " + activity.getLocalClassName()); // create email intent Intent emailIntent = new Intent(Intent.ACTION_SEND); emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { addr }); emailIntent.setType("text/plain"); // make sure there is an activity which can handle the intent. PackageManager emailpackageManager = activity.getPackageManager(); List<ResolveInfo> emailresolveInfos = emailpackageManager.queryIntentActivities(emailIntent, 0); if (emailresolveInfos.size() > 0) { activity.startActivity(emailIntent); } }
From source file:Main.java
public static boolean saveBitmap(Bitmap bmp, String path) { File file = new File(path); if (!file.getParentFile().exists()) { file.getParentFile().mkdirs();//from ww w . java 2 s. co m } if (file.exists()) { file.delete(); } try { FileOutputStream out = new FileOutputStream(file); bmp.compress(Bitmap.CompressFormat.JPEG, 80, out); out.flush(); out.close(); Log.i("saveBitmap success:", path); return true; } catch (Exception e) { Log.e("saveBitmap:" + path, e.toString()); } return false; }
From source file:com.efinkg.alfred.SendInstantMessageSample.java
@Test public static void runDemo() { ApplicationContext context = new ClassPathXmlApplicationContext("SendInstantMessageSample-context.xml"); Log.i("Trying to send a message", "Finding myself."); MessageChannel toUserChannel = (MessageChannel) context.getBean("toUserChannel", MessageChannel.class); Log.i("Trying to send a message", "Finding you."); Message<String> message = new GenericMessage<String>("Hello from Spring Integration XMPP"); Log.i("Trying to send a message", "Sending my Message."); toUserChannel.send(message);// w ww .jav a2 s . c o m }
From source file:Main.java
/** Launch a SMS intent if the device is capable. * * @param activity The parent activity (for context) * @param number The number to sms (not the full URI) * @param text The sms body//from w ww .jav a 2s. c o m */ public static void launchSmsIntent(final Activity activity, String number, String text) { Log.i(LOG_TAG, "Launch SMS intent to " + number); // create sms intent Uri smsUri = Uri.parse("smsto:" + number); Intent smsIntent = new Intent(Intent.ACTION_SENDTO, smsUri); smsIntent.putExtra("sms_body", text); // make sure there is an activity which can handle the intent. PackageManager smspackageManager = activity.getPackageManager(); List<ResolveInfo> smsresolveInfos = smspackageManager.queryIntentActivities(smsIntent, 0); if (smsresolveInfos.size() > 0) { activity.startActivity(smsIntent); } }
From source file:Main.java
/** * Finds the best possible value out of the list of supported values * @param name name of the desired mode the values are searched for * @param supportedValues the supported values * @param desiredValues the desired values with descending priority * @return the best possible value/*w w w .j a v a 2 s . c o m*/ */ private static String findSettableValue(String name, Collection<String> supportedValues, String... desiredValues) { Log.i(TAG, "Requesting " + name + " value from among: " + Arrays.toString(desiredValues)); Log.i(TAG, "Supported " + name + " values: " + supportedValues); if (supportedValues != null) { for (String desiredValue : desiredValues) { if (supportedValues.contains(desiredValue)) { Log.i(TAG, "Can set " + name + " to: " + desiredValue); return desiredValue; } } } Log.i(TAG, "No supported values match"); return null; }