Example usage for android.util Log i

List of usage examples for android.util Log i

Introduction

In this page you can find the example usage for android.util Log i.

Prototype

public static int i(String tag, String msg) 

Source Link

Document

Send an #INFO log message.

Usage

From source file:Main.java

public static String searchForPattern(String message, String pattern) {

    Pattern first = Pattern.compile(pattern);
    Matcher match = first.matcher(message);
    //Log.i("parseMessageForMeetingID",Integer.toString(match.groupCount()));

    if (match.find()) {
        String str = match.group(0);
        Log.i("searchForPattern", str);
        return str;
    }/*from w w  w . j ava 2  s.  co  m*/
    Log.i("searchForPattern", "no match found");
    return null;
}

From source file:Main.java

@TargetApi(4)
public static boolean isTabletDevice(android.content.Context activityContext) {
    if (!androidAPIover(4)) //VERSION
        return false; //If there is a tablet running 1.5.....GOD HELP YOU

    try {/* w  ww .  ja va2  s.c om*/

        // Verifies if the Generalized Size of the device is XLARGE to be
        // considered a Tablet
        Configuration config = activityContext.getResources().getConfiguration();
        Log.i("screenlayout",
                Integer.parseInt(
                        Configuration.class.getDeclaredField("SCREENLAYOUT_SIZE_LARGE").get(config).toString())
                        + "!!!");
        boolean xlarge =
                //activityContext.getResources().getConfiguration().screenLayout &
                Boolean.parseBoolean(config.getClass().getField("screenLayout").get(config).toString())
                        & getStaticInt(config, "SCREENLAYOUT_SIZE_MASK") >= //Changed this from == to >= because my tablet was returning 8 instead of 4.
                        Integer.parseInt(Configuration.class.getDeclaredField("SCREENLAYOUT_SIZE_LARGE")
                                .get(config).toString());
        getStaticInt(config, "SCREENLAYOUT_SIZE_MASK");

        // If XLarge, checks if the Generalized Density is at least MDPI (160dpi)
        if (xlarge) {
            android.util.DisplayMetrics metrics = new android.util.DisplayMetrics();
            Activity activity = (Activity) activityContext;
            activity.getWindowManager().getDefaultDisplay().getMetrics(metrics);

            //This next block lets us get constants that are not available in lower APIs.
            // If they aren't available, it's safe to assume that the device is not a tablet.
            // If you have a tablet or TV running Android 1.5, what the fuck is wrong with you.
            int xhigh = -1, tv = -1;
            try {
                Field f = android.util.DisplayMetrics.class.getDeclaredField("DENSITY_XHIGH");
                xhigh = (Integer) f.get(null);
                f = android.util.DisplayMetrics.class.getDeclaredField("DENSITY_TV");
                xhigh = (Integer) f.get(null);
            } catch (Exception e) {
            }

            // MDPI=160, DEFAULT=160, DENSITY_HIGH=240, DENSITY_MEDIUM=160, DENSITY_TV=213, DENSITY_XHIGH=320
            int densityDpi = Integer
                    .parseInt(metrics.getClass().getDeclaredField("densityDpi").get(metrics).toString());
            if (densityDpi == 240 || //DENSITY_HIGH
                    densityDpi == 160 || //DENSITY_MEDIUM
                    //densityDpi == android.util.DisplayMetrics.DENSITY_DEFAULT ||
                    //densityDpi == android.util.DisplayMetrics.DENSITY_HIGH ||
                    //densityDpi == android.util.DisplayMetrics.DENSITY_MEDIUM ||
                    densityDpi == tv || densityDpi == xhigh) {
                return true;
            }
        }
    } catch (Exception e) {
    }
    return false;
}

From source file:Main.java

public static void setBestPreviewFPS(Camera.Parameters parameters, int minFPS, int maxFPS) {
    List<int[]> supportedPreviewFpsRanges = parameters.getSupportedPreviewFpsRange();
    Log.i(TAG, "Supported FPS ranges: " + toString(supportedPreviewFpsRanges));
    if (supportedPreviewFpsRanges != null && !supportedPreviewFpsRanges.isEmpty()) {
        int[] suitableFPSRange = null;
        for (int[] fpsRange : supportedPreviewFpsRanges) {
            int thisMin = fpsRange[Camera.Parameters.PREVIEW_FPS_MIN_INDEX];
            int thisMax = fpsRange[Camera.Parameters.PREVIEW_FPS_MAX_INDEX];
            if (thisMin >= minFPS * 1000 && thisMax <= maxFPS * 1000) {
                suitableFPSRange = fpsRange;
                break;
            }/*from w w w  . j  a v  a2  s .  c  o  m*/
        }
        if (suitableFPSRange == null) {
            Log.i(TAG, "No suitable FPS range?");
        } else {
            int[] currentFpsRange = new int[2];
            parameters.getPreviewFpsRange(currentFpsRange);
            if (Arrays.equals(currentFpsRange, suitableFPSRange)) {
                Log.i(TAG, "FPS range already set to " + Arrays.toString(suitableFPSRange));
            } else {
                Log.i(TAG, "Setting FPS range to " + Arrays.toString(suitableFPSRange));
                parameters.setPreviewFpsRange(suitableFPSRange[Camera.Parameters.PREVIEW_FPS_MIN_INDEX],
                        suitableFPSRange[Camera.Parameters.PREVIEW_FPS_MAX_INDEX]);
            }
        }
    }
}

From source file:Main.java

public static Bitmap bitmapFromUri(Context context, Uri photoUri) throws FileNotFoundException, IOException {
    InputStream is = context.getContentResolver().openInputStream(photoUri);
    BitmapFactory.Options dbo = new BitmapFactory.Options();
    dbo.inJustDecodeBounds = true;//from   w w w.j a  v  a  2s.  co m
    BitmapFactory.decodeStream(is, null, dbo);
    is.close();

    int rotatedWidth, rotatedHeight;

    int orientation = 0;

    if (photoUri.toString().contains("content:/")) {
        orientation = getOrientation(context, photoUri);
        Log.i("Photo Editor", "Orientation: " + orientation);
    } else {
        int orientationFormExif = getOrientationFromExif(photoUri, context);
        orientation = decodeExifOrientation(orientationFormExif);
        Log.i("Photo Editor", "Orientation form Exif: " + orientation);
    }

    if (orientation == 90 || orientation == 270) {
        rotatedWidth = dbo.outHeight;
        rotatedHeight = dbo.outWidth;
    } else {
        rotatedWidth = dbo.outWidth;
        rotatedHeight = dbo.outHeight;
    }

    Bitmap srcBitmap = readScaledBitmapFromUri(photoUri, context, rotatedWidth, rotatedHeight);

    srcBitmap = setProperOrientation(orientation, srcBitmap);
    return srcBitmap;
}

From source file:com.turbulenz.turbulenz.googlepayment.java

static private void _log(String msg) {
    Log.i("tzbilling(google)", msg);
}

From source file:Main.java

@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1)
public static void setFocusArea(Camera.Parameters parameters) {
    if (parameters.getMaxNumFocusAreas() > 0) {
        Log.i(TAG, "Old focus areas: " + toString(parameters.getFocusAreas()));
        List<Camera.Area> middleArea = buildMiddleArea(AREA_PER_1000);
        Log.i(TAG, "Setting focus area to : " + toString(middleArea));
        parameters.setFocusAreas(middleArea);
    } else {/*from w  w w  . j ava2s  .  co  m*/
        Log.i(TAG, "Device does not support focus areas");
    }
}

From source file:Main.java

@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1)
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 . c  o  m
        Log.i(TAG, "Device does not support metering areas");
    }
}

From source file:Main.java

public static long totalMemorySize() {
    String memInfoPath = "/proc/meminfo";
    String str2;/*from w ww.j a  v a2s .c o m*/
    String[] arrayOfString;
    long initial_memory = 0;
    try {
        FileReader localFileReader = new FileReader(memInfoPath);
        BufferedReader localBufferedReader = new BufferedReader(localFileReader, 8192);
        str2 = localBufferedReader.readLine();
        arrayOfString = str2.split("\\s+");
        for (String num : arrayOfString) {
            Log.i(str2, num + "\t");
        }
        //total Memory
        initial_memory = Integer.valueOf(arrayOfString[1]) * 1024;
        localBufferedReader.close();
        return initial_memory;
    } catch (IOException e) {
        return -1;
    }
}

From source file:Main.java

/**
 * Write the String into the given File//from  w  w  w  .  j  a v a  2 s.co m
 * @param baseString
 * @param mainStyleFile
 */
public static void writeStyleFile(String baseString, File mainStyleFile) {
    FileWriter fw = null;
    try {
        fw = new FileWriter(mainStyleFile);
        fw.write(baseString);
        Log.i("STYLE", "Style File updated:" + mainStyleFile.getPath());
    } catch (FileNotFoundException e) {
        Log.e("STYLE", "unable to write open file:" + mainStyleFile.getPath());
    } catch (IOException e) {
        Log.e("STYLE", "error writing the file: " + mainStyleFile.getPath());
    } finally {
        try {
            if (fw != null) {
                fw.close();
            }
        } catch (IOException e) {
            // ignored
        }
    }
}

From source file:com.google.android.apps.santatracker.util.SantaLog.java

public static void i(String tag, String msg) {
    if (LOG_ENABLED) {
        Log.i(tag, msg);
    }
}