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:com.lvlstudios.android.gtmessage.C2DMReceiver.java

@Override
public void onRegistered(Context context, String registration) {
    Log.i(TAG, "C2DMReceiver.onRegistered: " + registration);
    DeviceRegistrar.registerWithServer(context, registration);
}

From source file:com.jiayao.reviewfinder.GoogleSearchEngine.java

public Map<String, String> search(String query) throws IOException {
    Log.i(TAG, "searching " + query);
    try {// ww  w  . j ava  2s  .c  om
        JSONArray resultsJsonArray;
        resultsJsonArray = getJsonArray(Utils
                .downloadPageContent(new URL(GOOGLE_SEARCH_URL + siteRestriction + URLEncoder.encode(query))));
        Map<String, String> results = new HashMap<String, String>();
        for (int i = 0; i < resultsJsonArray.length(); i++) {
            JSONObject resultObj = resultsJsonArray.getJSONObject(i);
            String title = resultObj.getString(TITLE_NO_FORMATTING);
            String link = resultObj.getString("url");
            results.put(title, link);
        }
        return results;
    } catch (JSONException e) {
        throw new RuntimeException(e);
    }
}

From source file:com.yanzhenjie.andserver.sample.response.RequestLoginHandler.java

@Override
public void handle(HttpRequest request, HttpResponse response, HttpContext context)
        throws HttpException, IOException {
    Map<String, String> params = HttpRequestParser.parse(request);

    Log.i("AndServer", "Params: " + params.toString());

    String userName = params.get("username");
    String password = params.get("password");

    if ("123".equals(userName) && "123".equals(password)) {
        StringEntity stringEntity = new StringEntity("Login Succeed", "utf-8");
        response.setEntity(stringEntity);
    } else {// ww w.  ja v a  2s.com
        StringEntity stringEntity = new StringEntity("Login Failed", "utf-8");
        response.setEntity(stringEntity);
    }
}

From source file:com.bellman.bible.android.view.activity.search.SearchIndex.java

/**
 * Download the index from the sam place that Pocket Sword uses
 *
 * @param v/*  w w w .  j ava2  s . c om*/
 */
public void onDownload(View v) {
    Log.i(TAG, "CLICKED");
    boolean bOk = ControlFactory.getInstance().getSearchControl().downloadIndex(getDocumentToIndex());

    if (bOk) {
        monitorProgress();
    }
}

From source file:Main.java

private static void CopyFile(String srcPath, String dstPath) {
    FileChannel srcChannel = null;
    FileChannel dstChannel = null;
    try {/*from   w ww. jav  a  2 s .  c o  m*/
        // Open files
        srcChannel = (new FileInputStream(srcPath)).getChannel();
        dstChannel = (new FileOutputStream(dstPath)).getChannel();
        // Transfer the data
        dstChannel.transferFrom(srcChannel, 0, srcChannel.size());
        // Close the files
        if (srcChannel != null) {
            srcChannel.close();
        }
        if (dstChannel != null) {
            dstChannel.close();
        }
    } catch (FileNotFoundException ex) {
        Log.i("CopyFile", "File not found " + ex.getMessage());
        ex.printStackTrace();
    } catch (IOException ex) {
        Log.i("CopyFile", "Transfer data error " + ex.getMessage());
        ex.printStackTrace();
    }
}

From source file:com.netdoers.zname.errorreporting.ExceptionHandler.java

/**
 * Register handler for unhandled exceptions.
 * @param context//from w w w .java2  s . co m
 */
public static boolean register(Context context) {
    Log.i(TAG, "Registering default exceptions handler");
    // Get information about the Package
    PackageManager pm = context.getPackageManager();
    try {
        PackageInfo pi;
        // Version
        pi = pm.getPackageInfo(context.getPackageName(), 0);
        G.APP_VERSION = pi.versionName;
        // Version Code name
        G.APP_VERSION_CODE = String.valueOf(pi.versionCode);//ADDED VERSION CODE
        // Package name
        G.APP_PACKAGE = pi.packageName;
        // Files dir for storing the stack traces
        G.FILES_PATH = context.getFilesDir().getAbsolutePath();
        // Device model
        G.PHONE_MODEL = android.os.Build.MODEL;
        // Device Size
        G.PHONE_SIZE = Zname.getPreferences().getDeviceSize();
        // Android version
        G.ANDROID_VERSION = android.os.Build.VERSION.RELEASE;
    } catch (NameNotFoundException e) {
        e.printStackTrace();
    }

    Log.i(TAG, "TRACE_VERSION: " + G.TraceVersion);
    Log.d(TAG, "APP_VERSION: " + G.APP_VERSION);
    Log.d(TAG, "APP_VERSION_CODE: " + G.APP_VERSION_CODE);//ADDED VERSION CODE
    Log.d(TAG, "APP_PACKAGE: " + G.APP_PACKAGE);
    Log.d(TAG, "FILES_PATH: " + G.FILES_PATH);
    Log.d(TAG, "URL: " + G.URL);

    boolean stackTracesFound = false;
    // We'll return true if any stack traces were found
    if (searchForStackTraces().length > 0) {
        stackTracesFound = true;
    }

    new Thread() {
        @Override
        public void run() {
            // First of all transmit any stack traces that may be lying around
            submitStackTraces();
            UncaughtExceptionHandler currentHandler = Thread.getDefaultUncaughtExceptionHandler();
            if (currentHandler != null) {
                Log.d(TAG, "current handler class=" + currentHandler.getClass().getName());
            }
            // don't register again if already registered
            if (!(currentHandler instanceof DefaultExceptionHandler)) {
                // Register default exceptions handler
                Thread.setDefaultUncaughtExceptionHandler(new DefaultExceptionHandler(currentHandler));
            }
        }
    }.start();

    return stackTracesFound;
}

From source file:com.netdoers.com.stacktrace.ExceptionHandler.java

/**
 * Register handler for unhandled exceptions.
 * @param context/*from   w ww.j ava 2  s.  c  o m*/
 */
public static boolean register(Context context) {
    Log.i(TAG, "Registering default exceptions handler");
    // Get information about the Package
    PackageManager pm = context.getPackageManager();
    try {
        PackageInfo pi;
        // Version
        pi = pm.getPackageInfo(context.getPackageName(), 0);
        G.APP_VERSION = pi.versionName;
        // Version Code name
        G.APP_VERSION_CODE = String.valueOf(pi.versionCode);//ADDED VERSION CODE
        // Package name
        G.APP_PACKAGE = pi.packageName;
        // Files dir for storing the stack traces
        G.FILES_PATH = context.getFilesDir().getAbsolutePath();
        // Device model
        G.PHONE_MODEL = android.os.Build.MODEL;
        // Device Size
        G.PHONE_SIZE = SmartConsultant.getPreferences().getDeviceSize();
        // Android version
        G.ANDROID_VERSION = android.os.Build.VERSION.RELEASE;
    } catch (NameNotFoundException e) {
        e.printStackTrace();
    }

    Log.i(TAG, "TRACE_VERSION: " + G.TraceVersion);
    Log.d(TAG, "APP_VERSION: " + G.APP_VERSION);
    Log.d(TAG, "APP_VERSION_CODE: " + G.APP_VERSION_CODE);//ADDED VERSION CODE
    Log.d(TAG, "APP_PACKAGE: " + G.APP_PACKAGE);
    Log.d(TAG, "FILES_PATH: " + G.FILES_PATH);
    Log.d(TAG, "URL: " + G.URL);

    boolean stackTracesFound = false;
    // We'll return true if any stack traces were found
    if (searchForStackTraces().length > 0) {
        stackTracesFound = true;
    }

    new Thread() {
        @Override
        public void run() {
            // First of all transmit any stack traces that may be lying around
            submitStackTraces();
            UncaughtExceptionHandler currentHandler = Thread.getDefaultUncaughtExceptionHandler();
            if (currentHandler != null) {
                Log.d(TAG, "current handler class=" + currentHandler.getClass().getName());
            }
            // don't register again if already registered
            if (!(currentHandler instanceof DefaultExceptionHandler)) {
                // Register default exceptions handler
                Thread.setDefaultUncaughtExceptionHandler(new DefaultExceptionHandler(currentHandler));
            }
        }
    }.start();

    return stackTracesFound;
}

From source file:com.application.error.ExceptionHandler.java

/**
 * Register handler for unhandled exceptions.
 * @param context//w  w w  .j  a  v a  2 s . c  o m
 */
public static boolean register(Context context) {
    Log.i(TAG, "Registering default exceptions handler");
    // Get information about the Package
    PackageManager pm = context.getPackageManager();
    try {
        PackageInfo pi;
        // Version
        pi = pm.getPackageInfo(context.getPackageName(), 0);
        G.APP_VERSION = pi.versionName;
        // Version Code name
        G.APP_VERSION_CODE = String.valueOf(pi.versionCode);//ADDED VERSION CODE
        // Package name
        G.APP_PACKAGE = pi.packageName;
        // Files dir for storing the stack traces
        G.FILES_PATH = context.getFilesDir().getAbsolutePath();
        // Device model
        G.PHONE_MODEL = android.os.Build.MODEL;
        // Device Size
        try {
            G.PHONE_SIZE = String.valueOf(Utilities.checkDisplaySize());
        } catch (Exception e) {
            G.PHONE_SIZE = "DEVICE SIZE NOT FOUND";
        }
        // Android version
        G.ANDROID_VERSION = android.os.Build.VERSION.RELEASE;
    } catch (NameNotFoundException e) {
        e.printStackTrace();
    }

    Log.i(TAG, "TRACE_VERSION: " + G.TraceVersion);
    Log.d(TAG, "APP_VERSION: " + G.APP_VERSION);
    Log.d(TAG, "APP_VERSION_CODE: " + G.APP_VERSION_CODE);//ADDED VERSION CODE
    Log.d(TAG, "APP_PACKAGE: " + G.APP_PACKAGE);
    Log.d(TAG, "FILES_PATH: " + G.FILES_PATH);
    Log.d(TAG, "URL: " + G.URL);

    boolean stackTracesFound = false;
    // We'll return true if any stack traces were found
    if (searchForStackTraces().length > 0) {
        stackTracesFound = true;
    }

    new Thread() {
        @Override
        public void run() {
            // First of all transmit any stack traces that may be lying around
            submitStackTraces();
            UncaughtExceptionHandler currentHandler = Thread.getDefaultUncaughtExceptionHandler();
            if (currentHandler != null) {
                Log.d(TAG, "current handler class=" + currentHandler.getClass().getName());
            }
            // don't register again if already registered
            if (!(currentHandler instanceof DefaultExceptionHandler)) {
                // Register default exceptions handler
                Thread.setDefaultUncaughtExceptionHandler(new DefaultExceptionHandler(currentHandler));
            }
        }
    }.start();

    return stackTracesFound;
}

From source file:at.bitfire.davdroid.log.LogcatHandler.java

@Override
public void publish(LogRecord r) {
    String text = getFormatter().format(r);
    int level = r.getLevel().intValue();

    int end = text.length();
    for (int pos = 0; pos < end; pos += MAX_LINE_LENGTH) {
        String line = text.substring(pos, NumberUtils.min(pos + MAX_LINE_LENGTH, end));

        if (level >= Level.SEVERE.intValue())
            Log.e(r.getLoggerName(), line);
        else if (level >= Level.WARNING.intValue())
            Log.w(r.getLoggerName(), line);
        else if (level >= Level.CONFIG.intValue())
            Log.i(r.getLoggerName(), line);
        else if (level >= Level.FINER.intValue())
            Log.d(r.getLoggerName(), line);
        else/*  ww w. ja  va2  s. co m*/
            Log.v(r.getLoggerName(), line);
    }
}

From source file:com.vic.rxnetsdk.RxSubscriber.java

@Override
public void onStart() {
    super.onStart();
    Log.i(TAG, "onCompleted()");
}