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

@SuppressLint("NewApi")
public static void setVideoStabilization(Camera.Parameters parameters) {

    if (parameters.isVideoSnapshotSupported()) {

        if (parameters.getVideoStabilization()) {
            Log.i(TAG, "Video stabilization already enabled");
        } else {//from w  w w.j av  a  2 s .c o m
            Log.i(TAG, "Enabling video stabilization...");
            parameters.setVideoStabilization(true);
        }
    } else {
        Log.i(TAG, "This device does not support video stabilization");
    }
}

From source file:Main.java

/**
 * A convenience method that generates a XOR key pair for a given key. It was used to generate
 * the key for {@link MainActivity#useXorStringHiding(String)} method.
 *
 * @param key The source key to use in generating the XOR key halves
 * @return a two-value string array containing both parts of the XOR key
 *///from  w  w w  .jav a2  s  .co  m
public static String[] generateKeyXorParts(String key) {
    String[] keyParts = new String[2];

    byte[] xorRandom = new byte[key.length()];
    byte[] xorMatch = new byte[key.length()];
    byte[] keyBytes = key.getBytes();
    for (int i = 0; i < key.length(); i++) {
        xorRandom[i] = (byte) (256 * Math.random());
        xorMatch[i] = (byte) (xorRandom[i] ^ keyBytes[i]);
    }
    keyParts[0] = Base64.encodeToString(xorRandom, 0);
    keyParts[1] = Base64.encodeToString(xorMatch, 0);
    Log.i(TAG, "XOR Key Part 0: " + keyParts[0]);
    Log.i(TAG, "XOR Key Part 1: " + keyParts[1]);

    return keyParts;
}

From source file:Main.java

public static String getLeAddress() {
    Log.i(TAG, "getLeAddress : " + mLeAddress);
    return mLeAddress;
}

From source file:Main.java

public static void setLeAddress(String address) {
    Log.i(TAG, "setLeAddress : " + address.toString());
    mLeAddress = address;
}

From source file:Main.java

public static void getListViewSize(ListView myListView) {
    ListAdapter myListAdapter = myListView.getAdapter();
    if (myListAdapter == null) {
        //do nothing return null
        return;/*  w ww .j  a  va2 s . com*/
    }
    //set listAdapter in loop for getting final size
    int totalHeight = 0;
    for (int size = 0; size < myListAdapter.getCount(); size++) {
        View listItem = myListAdapter.getView(size, null, myListView);
        listItem.measure(0, 0);
        totalHeight += listItem.getMeasuredHeight();
    }
    //setting listview item in adapter
    ViewGroup.LayoutParams params = myListView.getLayoutParams();
    params.height = totalHeight + (myListView.getDividerHeight() * (myListAdapter.getCount() - 1));
    myListView.setLayoutParams(params);
    // print height of adapter on log
    Log.i("height of listItem:", String.valueOf(totalHeight));
}

From source file:Main.java

public static void setBarcodeSceneMode(Camera.Parameters parameters) {
    if (Camera.Parameters.SCENE_MODE_BARCODE.equals(parameters.getSceneMode())) {
        Log.i(TAG, "Barcode scene mode already set");
        return;//  www  . j a v  a2  s .  c o  m
    }
    String sceneMode = findSettableValue("scene mode", parameters.getSupportedSceneModes(),
            Camera.Parameters.SCENE_MODE_BARCODE);
    if (sceneMode != null) {
        parameters.setSceneMode(sceneMode);
    }
}

From source file:Main.java

public static void writePreference(Context context, int slot, Long alertTime, String titleText,
        String subtitleText, String messageBodyText, String tickerText, boolean incrementBadgeCount) {
    SharedPreferences.Editor editor = getNotificationSettings(context, slot).edit();
    if (editor == null) {
        Log.i(TAG, "Failed to write notification to preferences");
        return;// w w w . j a  va  2 s . co  m
    }
    editor.putInt(SLOT_TAG, slot);
    editor.putLong(UTC_SCHEDULED_TIME, alertTime);
    editor.putString(TITLE_TEXT_TAG, titleText);
    editor.putString(SUBTITLE_TEXT_TAG, subtitleText);
    editor.putString(MESSAGE_BODY_TEXT_TAG, messageBodyText);
    editor.putString(TICKER_TEXT_TAG, tickerText);
    editor.putBoolean(INCREMENT_BADGE_COUNT_TAG, incrementBadgeCount);
    boolean committed = editor.commit();

    if (!committed) {
        Log.i(TAG, "Failed to write notification to preferences");
    }
}

From source file:Main.java

public 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;
            }//from  w w w . j  ava 2s. co  m
        }
    }
    Log.i(TAG, "No supported values match");
    return null;
}

From source file:Main.java

private static String readTextFile(InputStream inputStream) {
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    byte buf[] = new byte[1024];
    int len;//from   w ww .j  a  v a 2 s  .co m
    try {
        while ((len = inputStream.read(buf)) != -1) {
            outputStream.write(buf, 0, len);
        }
        outputStream.close();
        inputStream.close();
    } catch (IOException e) {
        Log.i("IO error", e.getMessage());
        return "Sorry, help file not found.";
    }
    return outputStream.toString();
}

From source file:Main.java

@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1)
public static void setVideoStabilization(Camera.Parameters parameters) {
    if (parameters.isVideoStabilizationSupported()) {
        if (parameters.getVideoStabilization()) {
            Log.i(TAG, "Video stabilization already enabled");
        } else {/*ww w . j  a  v a2s.  c  om*/
            Log.i(TAG, "Enabling video stabilization...");
            parameters.setVideoStabilization(true);
        }
    } else {
        Log.i(TAG, "This device does not support video stabilization");
    }
}