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 int getStatusBarHeight(Context context) {
    Class<?> c = null;//from  ww  w .  j  a v  a 2s  .c  o  m
    Object obj = null;
    Field field = null;
    int x = 0, sbar = 0;
    try {
        c = Class.forName("com.android.internal.R$dimen");
        obj = c.newInstance();
        field = c.getField("status_bar_height");
        x = Integer.parseInt(field.get(obj).toString());
        sbar = context.getResources().getDimensionPixelSize(x);
    } catch (Exception e1) {
        Log.e("getStatusBarHight()", "get status bar height fail");
        e1.printStackTrace();
    }
    int statusBarHeight = sbar;
    Log.i("onPreDraw", "statusBarHeight: " + statusBarHeight);
    return statusBarHeight;
}

From source file:Main.java

public static String postReqAsJson(String uri, String requestJson) throws ClientProtocolException, IOException {
    Log.i(TAG, "Send data to :" + uri + " ========== and the data str:" + requestJson);
    HttpPost post = new HttpPost(uri);
    List<NameValuePair> parameters = new ArrayList<NameValuePair>();
    parameters.add(new BasicNameValuePair("attendanceClientJSON", requestJson));
    post.setEntity(new UrlEncodedFormEntity(parameters, "UTF-8"));
    HttpClient client = new DefaultHttpClient();
    HttpResponse response = client.execute(post);
    if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
        String retStr = EntityUtils.toString(response.getEntity());
        Log.i(TAG, "=================response str:" + retStr);
        return retStr;
    }/*from   w  w  w. j  a v a 2  s . c  o  m*/

    return response.getStatusLine().getStatusCode() + "ERROR";
}

From source file:Main.java

public static void setContext(Context c) {
    Log.i("NDKHelper", "setContext:" + c);
    context = c;
}

From source file:Main.java

public static void Log(String tag, String test) {
    Log.i(tag, test);
}

From source file:Main.java

public static void i(String tag, String message) {
    if (!TextUtils.isEmpty(message)) {
        Log.i(tag, message);
    }
}

From source file:Main.java

public static void writePreference(Context context, int slot, String title, String message, Long alertTime,
        int repeat) {
    SharedPreferences.Editor editor = getNotificationSettings(context, slot).edit();
    if (editor == null) {
        Log.i(TAG, "Failed to write notification to preferences");
        return;//from  w w  w. ja  v  a2 s.c  o  m
    }
    editor.putInt(SLOT_TAG, slot);
    editor.putString(TITLE_TEXT_TAG, title);
    editor.putString(MESSAGE_BODY_TEXT_TAG, message);
    editor.putLong(UTC_SCHEDULED_TIME, alertTime);
    editor.putInt(REPEAT_TIME, repeat);
    boolean committed = editor.commit();

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

From source file:Main.java

public static void jlog(Object o) {
    Log.i(TAG, o.toString());
}

From source file:Main.java

public static void getListViewSize2(ListView myListView) {
    ListAdapter myListAdapter = myListView.getAdapter();
    if (myListAdapter == null) {
        //do nothing return null
        return;/*from  w ww  . j  a  v a2 s . c  o  m*/
    }
    //set listAdapter in loop for getting final size
    int totalHeight = 70;
    for (int size = 0; size <= myListAdapter.getCount() + 1; size++) {

        totalHeight += 70;
    }
    totalHeight += 140;

    ViewGroup.LayoutParams params = myListView.getLayoutParams();
    params.height = totalHeight + (myListView.getDividerHeight() * (myListAdapter.getCount() + 2));
    myListView.setLayoutParams(params);
    Log.i("height of listItem:", String.valueOf(totalHeight));
}

From source file:Main.java

public static void showMessageDialogWithNewIntent(final Activity curentActivity, Context context,
        String message, final Class newActivity, final String extras) {
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setMessage(message).setCancelable(false).setPositiveButton("Ok",
            new DialogInterface.OnClickListener() {

                public void onClick(DialogInterface dialog, int id) {

                    Intent i = new Intent(curentActivity, newActivity);
                    if (extras != null) {
                        Log.i("LOGINSIGNUP", "=extras!=null in showMessageDialog");
                        i.putExtra("OAuthError", true);
                    }/*from   w w w  .  j a  v  a2 s  .  c  om*/
                    Log.i("LOGINSIGNUP", "==after if in showMessageDialog");

                    curentActivity.startActivity(i);
                    //                  curentActivity.finish();
                }
            });
    AlertDialog alert = builder.create();
    alert.show();
}

From source file:Main.java

/**
 * Notifies UI to display a message. This method is defined in the common
 * helper because it's used both by the UI and the background service.
 *
 * @param context The application context.
 * @param message The message to be displayed.
 *//* w w  w. j a  v a 2 s  .c  o  m*/
public static void displayMessage(Context context, String message) {
    Log.i(TAG, "displayMessage(): " + message);
    Intent intent = new Intent(DISPLAY_MESSAGE_ACTION);
    intent.putExtra(EXTRA_MESSAGE, message);
    context.sendBroadcast(intent);
}