Example usage for android.util Log w

List of usage examples for android.util Log w

Introduction

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

Prototype

public static int w(String tag, Throwable tr) 

Source Link

Usage

From source file:com.menumomma.chrome2phone.DeviceRegistrar.java

public static void registerWithServer(final Context context, final String deviceRegistrationID) {
    new Thread(new Runnable() {
        public void run() {
            Intent updateUIIntent = new Intent("com.google.ctp.UPDATE_UI");
            try {
                HttpResponse res = makeRequest(context, deviceRegistrationID, REGISTER_PATH);
                if (res.getStatusLine().getStatusCode() == 200) {
                    SharedPreferences settings = Prefs.get(context);
                    SharedPreferences.Editor editor = settings.edit();
                    editor.putString("deviceRegistrationID", deviceRegistrationID);
                    editor.commit();/*from  w w w  .  ja  v a 2 s .c o  m*/
                    updateUIIntent.putExtra(STATUS_EXTRA, REGISTERED_STATUS);
                } else if (res.getStatusLine().getStatusCode() == 400) {
                    updateUIIntent.putExtra(STATUS_EXTRA, AUTH_ERROR_STATUS);
                } else {
                    Log.w(TAG, "Registration error " + String.valueOf(res.getStatusLine().getStatusCode()));
                    updateUIIntent.putExtra(STATUS_EXTRA, ERROR_STATUS);
                }
                context.sendBroadcast(updateUIIntent);
            } catch (AppEngineClient.PendingAuthException pae) {
                // Get setup activity to ask permission from user.
                Intent intent = new Intent(SetupActivity.AUTH_PERMISSION_ACTION);
                intent.putExtra("AccountManagerBundle", pae.getAccountManagerBundle());
                context.sendBroadcast(intent);
            } catch (Exception e) {
                Log.w(TAG, "Registration error " + e.getMessage());
                updateUIIntent.putExtra(STATUS_EXTRA, ERROR_STATUS);
                context.sendBroadcast(updateUIIntent);
            }
        }
    }).start();
}

From source file:org.thoughtcrime.securesms.mms.MmsDownloadHelper.java

public static byte[] retrieveMms(Context context, String url) throws IOException {
    try {//from   w w  w . j  a  v a  2 s.  co  m
        MmsConnectionParameters connectionParameters = getMmsConnectionParameters(context);

        checkRouteToHost(context, connectionParameters, url);
        return makeRequest(connectionParameters, url);
    } catch (MmsException me) {
        Log.w("MmsDownloader", me);
        throw new IOException("Problem configuring MmsConnectionParameters.");
    }
}

From source file:org.thoughtcrime.securesms.mms.MmsConnection.java

public static Apn getApn(Context context, String apnName) throws ApnUnavailableException {
    Log.w(TAG, "Getting MMSC params for apn " + apnName);
    return getLocalApn(context);
}

From source file:at.bitfire.ical4android.DateUtils.java

public static String findAndroidTimezoneID(String tzID) {
    String deviceTZ = null;//from  w  w  w  . j av  a  2  s. c  o m
    String availableTZs[] = SimpleTimeZone.getAvailableIDs();

    // first, try to find an exact match (case insensitive)
    for (String availableTZ : availableTZs)
        if (availableTZ.equalsIgnoreCase(tzID)) {
            deviceTZ = availableTZ;
            break;
        }

    // if that doesn't work, try to find something else that matches
    if (deviceTZ == null) {
        for (String availableTZ : availableTZs)
            if (StringUtils.indexOfIgnoreCase(tzID, availableTZ) != -1) {
                deviceTZ = availableTZ;
                Log.w(TAG, "Couldn't find system time zone \"" + tzID + "\", assuming " + deviceTZ);
                break;
            }
    }

    // if that doesn't work, use UTC as fallback
    if (deviceTZ == null) {
        final String defaultTZ = TimeZone.getDefault().getID();
        Log.w(TAG, "Couldn't find system time zone \"" + tzID + "\", using system default (" + defaultTZ
                + ") as fallback");
        deviceTZ = defaultTZ;
    }

    return deviceTZ;
}

From source file:org.thoughtcrime.securesms.mms.MmsSendHelper.java

public static byte[] sendMms(Context context, byte[] mms) throws IOException {
    Log.w("MmsSender", "Sending MMS of length: " + mms.length);
    try {/*ww w .ja va2s.  co  m*/
        MmsConnectionParameters parameters = getMmsConnectionParameters(context);
        checkRouteToHost(context, parameters, parameters.getMmsc());
        return makePost(parameters, mms);
    } catch (MmsException me) {
        Log.w("MmsSender", me);
        throw new IOException("Failed to get MMSC information...");
    }
}

From source file:cd.education.data.collector.android.utilities.ZipUtils.java

private static File doExtractInTheSameFolder(File zipFile, ZipInputStream zipInputStream, ZipEntry zipEntry)
        throws IOException {
    File targetFile;//w ww . j  av a2 s .  c om
    String fileName = zipEntry.getName();

    Log.w(t, "Found zipEntry with name: " + fileName);

    if (fileName.contains("/") || fileName.contains("\\")) {
        // that means that this is a directory of a file inside a directory, so ignore it
        Log.w(t, "Ignored: " + fileName);
        return null;
    }

    // extract the new file
    targetFile = new File(zipFile.getParentFile(), fileName);
    FileOutputStream fileOutputStream = null;
    try {
        fileOutputStream = new FileOutputStream(targetFile);
        IOUtils.copy(zipInputStream, fileOutputStream);
    } finally {
        IOUtils.closeQuietly(fileOutputStream);
    }

    Log.w(t, "Extracted file \"" + fileName + "\" out of " + zipFile.getName());
    return targetFile;
}

From source file:com.infosupport.service.LPRServiceCaller.java

public static void postData(String urlString, File file) {
    try {//from w ww  .  ja va2 s .com
        PostMethod postMessage = new PostMethod(urlString);
        Part[] parts = { new FilePart("lpimage", file), new StringPart("country", "eu"),
                new StringPart("nonce", "123456789") };
        postMessage.setRequestEntity(new MultipartRequestEntity(parts, postMessage.getParams()));
        HttpClient client = new HttpClient();
        client.executeMethod(postMessage);
    } catch (IOException e) {
        Log.w(TAG, "IOException, waarschijnlijk geen internet connectie aanwezig...");
    }
}

From source file:Main.java

@SuppressWarnings("unchecked")
private static void putArray(String key, ArrayList arrayList, Bundle bundle) {
    if (arrayList.size() == 0) {
        bundle.putBooleanArray(key, new boolean[] {});
    } else {//from  w w  w  .  java 2 s  .  co  m
        verifyArrayListIsSingleType(arrayList);
        if (arrayList.get(0) instanceof String) {
            bundle.putStringArray(key, toStringArray((ArrayList<String>) arrayList));
        } else if (arrayList.get(0) instanceof Integer) {
            bundle.putIntArray(key, toIntArray((ArrayList<Integer>) arrayList));
        } else if (arrayList.get(0) instanceof Float) {
            bundle.putFloatArray(key, toFloatArray((ArrayList<Float>) arrayList));
        } else if (arrayList.get(0) instanceof Double) {
            bundle.putDoubleArray(key, toDoubleArray((ArrayList<Double>) arrayList));
        } else if (arrayList.get(0) instanceof Boolean) {
            bundle.putBooleanArray(key, toBooleanArray((ArrayList<Boolean>) arrayList));
        } else if (arrayList.get(0) instanceof HashMap) {
            bundle.putParcelableArray(key, toBundleArray((ArrayList<HashMap>) arrayList));
        } else if (arrayList.get(0) instanceof ArrayList) {
            Log.w("RNNavigation",
                    "Arrays of arrays passed in props are converted to dictionaries with indexes as keys");
            Bundle innerArray = new Bundle();
            for (int i = 0; i < arrayList.size(); i++) {
                putArray(String.valueOf(i), (ArrayList) arrayList.get(i), innerArray);
            }
            bundle.putParcelable(key, innerArray);
        }
    }
}

From source file:com.login.android.cardapio.garcom.util.DrawableManager.java

public Drawable fetchDrawable(String urlString) {
    if (drawableMap.containsKey(urlString)) {
        return drawableMap.get(urlString);
    }//from   w  w w . j a va2s . c om
    try {

        InputStream is = fetch(urlString);

        Drawable drawable = Drawable.createFromStream(is, "src");

        if (drawable != null) {
            drawableMap.put(urlString, drawable);
        } else {
            Log.w(this.getClass().getSimpleName(), "could not get thumbnail");
        }

        return drawable;
    } catch (MalformedURLException e) {
        Log.e(this.getClass().getSimpleName(), "fetchDrawable failed", e);
        return null;
    } catch (IOException e) {
        Log.e(this.getClass().getSimpleName(), "fetchDrawable failed", e);
        return null;
    } catch (OutOfMemoryError Err) {
        Log.e(this.getClass().getSimpleName(), "fetchDrawable failed", Err);
        System.gc();
        return null;
    }
}

From source file:com.squeezeday.marknadskoll.HttpHelper.java

private static String doRequest(HttpUriRequest request, String url, HttpContext context, boolean readResponse)
        throws IOException, HttpException {
    HttpClient httpClient = getClient();

    Log.w("http", url);

    ResponseHandler<String> responseHandler = new BasicResponseHandler();
    String response = httpClient.execute(request, responseHandler, context);

    return response;
}