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.intel.iotkitlib.LibModules.AuthorizationManagement.AuthorizationToken.java

public static void resetSharedPreferences(int responseCode) throws JSONException {
    if (responseCode != 204) {
        Log.d(TAG, "Invalid response for delete user, not able to delete userID");
        return;//from  ww w .  ja v a 2  s  .c o  m
    }
    //validating shared prefs-editor
    if (Utilities.editor == null) {
        Log.w(TAG, "invalid shared preferences-editor object");
    }
    Utilities.editor.clear().commit();
}

From source file:net.evendanan.android.thumbremote.network.ReusableHttpClientBlocking.java

/**
 * Perform the blocking fetch./* ww  w  . j a v  a2 s.  c  o m*/
 * @throws IOException 
 * @throws URISyntaxException 
 */
public synchronized Response fetch(String url) throws IOException, URISyntaxException {
    if (url == null)
        return new Response(false, 404, null);

    URI uri = new URI(url);
    mRequest.setURI(uri);
    Log.d(TAG, "Fetching " + url);

    HttpResponse httpResponse = mHttpClient.execute(mRequest);
    int responseCode = httpResponse.getStatusLine().getStatusCode();
    String response = "";
    HttpEntity entity = httpResponse.getEntity();

    if (entity != null) {

        InputStream instream = entity.getContent();
        response = convertStreamToString(instream);
    }

    boolean success = responseCode >= 200 && responseCode < 300;
    if (!success) {
        Log.w(TAG, "Got error response code " + responseCode);
        return new Response(false, responseCode, httpResponse.getStatusLine().getReasonPhrase());
    }

    return new Response(true, responseCode, response);
}

From source file:br.com.calangodev.aacdecoder.AacDecoder.java

private void startMediaPlayer(String url) {
    stop();/*from ww  w .ja v a  2 s  .  co m*/
    try {
        multiPlayer = new MultiPlayer();
        multiPlayer.playAsync(url);
    } catch (Throwable t) {
        Log.w(TAG, "Cannot play url - " + t);
    }
}

From source file:com.sepgil.ral.DrupalOperationTask.java

@Override
protected void onPostExecute(HttpResponse response) {
    // If there was no response, something may be wrong, since RestWS always returns something.
    if (response == null) {
        Log.w("DrupalCom", "Didn't get any response.");
        onHttpError(null);/*from  ww w.j a v  a 2 s  .c o m*/
        return;
    }

    int state = response.getStatusLine().getStatusCode();

    switch (state) {
    case HttpStatus.SC_CREATED:
    case HttpStatus.SC_OK:
        parseResponse(response.getEntity());
        return;
    default:
        onHttpError(response.getStatusLine());
        Log.w("DrupalCom", "Status code not ok: " + response.getStatusLine().getReasonPhrase());
        return;
    }
}

From source file:com.emuneee.speeedreader.test.ArticleUtilsTestCase.java

/**
 * Test the ability to get a reading list from Google Reader
 */// www .  ja  va 2 s .c  o m
public void testParseArticles() {
    HttpURLConnection urlConnection;
    String response;
    Collection readingList;
    int n = 50;

    try {
        urlConnection = HttpUtils.getUrlConnection(
                "http://www.google.com/reader/api/0/stream/contents/user/-/state/com.google/reading-list?n="
                        + n,
                mToken);
        assertNotNull(urlConnection);
        response = HttpUtils.processHttpRequest(urlConnection);
        Log.v(TAG, response);
        assertNotNull(response);
        assertEquals(true, response.length() > 0);
        readingList = ArticleUtils.parseArticles(response);
        assertNotNull(readingList);
        assertNotNull(readingList.getArticles());
        assertEquals(n, readingList.getArticles().size());
    } catch (IOException e) {
        Log.w(TAG, e.getMessage());
        assertTrue(false);
    } catch (JSONException e) {
        Log.w(TAG, e.getMessage());
        assertTrue(false);
    }
}

From source file:com.google.android.apps.santatracker.doodles.tilt.LevelManager.java

/**
 * Saves a level to persistent storage.//from   w  ww  . j a va 2 s .c  o m
 *
 * @param level The level to save.
 * @param filename The name of the level's file on disk. This file will be stored inside of a
 *                 preset directory, defined by the LevelManager implementation.
 */
public void saveLevel(T level, String filename) {
    File levelsDir = getLevelsDir();
    if (!levelsDir.exists() && !levelsDir.mkdirs()) {
        // If we are unable to find or make the desired output directory, log a warning and fail.
        Log.w(TAG, "Unable to reach dir: " + levelsDir.getAbsolutePath());
        return;
    }
    try {
        FileOutputStream outputStream = new FileOutputStream(new File(levelsDir, filename));
        saveLevel(level, outputStream);
    } catch (FileNotFoundException e) {
        Log.w(TAG, "Unable to save file: " + filename);
    }
}

From source file:org.videolan.vlc.VLCApplication.java

/**
 * Called when the overall system is running low on memory
 *//*from  ww w .  ja v a 2  s .c  om*/
@Override
public void onLowMemory() {
    super.onLowMemory();
    Log.w(TAG, "System is running low on memory");

    BitmapCache.getInstance().clear();
}

From source file:de.appplant.cordova.emailcomposer.EmailComposerImpl.java

/**
 * Cleans the attachment folder./* www.jav a 2  s. c  o  m*/
 *
 * @param ctx
 * The application context.
 */
@SuppressWarnings("ResultOfMethodCallIgnored")
public void cleanupAttachmentFolder(Context ctx) {
    try {
        File dir = new File(ctx.getExternalCacheDir() + ATTACHMENT_FOLDER);

        if (!dir.isDirectory())
            return;

        File[] files = dir.listFiles();

        for (File file : files) {
            file.delete();
        }
    } catch (Exception npe) {
        Log.w("EmailComposer", "Missing external cache dir");
    }
}

From source file:com.tingtingapps.securesms.crypto.PreKeyUtil.java

public static PreKeyRecord generateLastResortKey(Context context) {
    PreKeyStore preKeyStore = new TextSecurePreKeyStore(context);

    if (preKeyStore.containsPreKey(Medium.MAX_VALUE)) {
        try {/* w  ww  . j  a  va2s.co  m*/
            return preKeyStore.loadPreKey(Medium.MAX_VALUE);
        } catch (InvalidKeyIdException e) {
            Log.w("PreKeyUtil", e);
            preKeyStore.removePreKey(Medium.MAX_VALUE);
        }
    }

    ECKeyPair keyPair = Curve.generateKeyPair();
    PreKeyRecord record = new PreKeyRecord(Medium.MAX_VALUE, keyPair);

    preKeyStore.storePreKey(Medium.MAX_VALUE, record);

    return record;
}

From source file:com.rany.albeg.wein.rssr.RssReader.java

public void read(String rssFeedUrl) throws InvalidParameterException {

    if (rssFeedUrl == null || rssFeedUrl.trim().length() == 0)
        throw new InvalidParameterException("You are passing an empty URL String to read(String rssFeedUrl).");

    if (mReadyToRead)
        new ReadRssAsyncTask().execute(rssFeedUrl);
    else/* w  w  w. j  a  v a 2  s.c o m*/
        Log.w(TAG, "RSS read refused. read() did not finish yet.");
}