Example usage for android.util Log v

List of usage examples for android.util Log v

Introduction

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

Prototype

public static int v(String tag, String msg) 

Source Link

Document

Send a #VERBOSE log message.

Usage

From source file:fr.cph.chicago.connection.GStreetViewConnect.java

/**
 * Connect to the API and get the MAP//from  w  w w .j av  a 2  s . c  o  m
 *
 * @param address the address to connect to
 * @return a drawable map
 */
@NonNull
private Optional<Drawable> connectUrl(@NonNull final String address) {
    Log.v(TAG, "Address: " + address);
    InputStream is = null;
    try {
        is = (InputStream) new URL(address).getContent();
        return Optional.of(Drawable.createFromStream(is, "src name"));
    } catch (final Exception e) {
        Log.e(TAG, e.getMessage(), e);
        // TODO add a temporary image here
        return Optional.empty();
    } finally {
        IOUtils.closeQuietly(is);
    }
}

From source file:com.pdi.hybridge.HybridgeWebChromeClient.java

@SuppressLint("DefaultLocale")
@SuppressWarnings({ "unchecked", "rawtypes" })
private void executeJSONTask(String action, JSONObject json, JsPromptResult result,
        HybridgeBroadcaster hybridge, Activity activity) {
    final Class clazz = mActions.get(action);
    if (clazz != null && hybridge != null) {
        AsyncTask task = null;//from   ww  w  . ja  v a 2 s. c o  m
        try {
            task = (AsyncTask<JSONObject, Void, JSONObject>) clazz
                    .getDeclaredConstructor(new Class[] { android.app.Activity.class }).newInstance(activity);
        } catch (final InstantiationException e) {
            e.printStackTrace();
        } catch (final IllegalAccessException e) {
            e.printStackTrace();
        } catch (final IllegalArgumentException e) {
            e.printStackTrace();
        } catch (final InvocationTargetException e) {
            e.printStackTrace();
        } catch (final NoSuchMethodException e) {
            e.printStackTrace();
        }
        Log.v(mTag, "Execute action " + action);
        task.execute(json, result, hybridge);
    } else {
        result.confirm(json.toString());
        Log.d(mTag, "Hybridge action not implemented: " + action);
    }
}

From source file:com.android.yijiang.kzx.http.RangeFileAsyncHttpResponseHandler.java

@Override
public void sendResponseMessage(HttpResponse response) throws IOException {
    if (!Thread.currentThread().isInterrupted()) {
        StatusLine status = response.getStatusLine();
        if (status.getStatusCode() == HttpStatus.SC_REQUESTED_RANGE_NOT_SATISFIABLE) {
            //already finished
            if (!Thread.currentThread().isInterrupted())
                sendSuccessMessage(status.getStatusCode(), response.getAllHeaders(), null);
        } else if (status.getStatusCode() >= 300) {
            if (!Thread.currentThread().isInterrupted())
                sendFailureMessage(status.getStatusCode(), response.getAllHeaders(), null,
                        new HttpResponseException(status.getStatusCode(), status.getReasonPhrase()));
        } else {//w w w.j a v a  2s . com
            if (!Thread.currentThread().isInterrupted()) {
                Header header = response.getFirstHeader(AsyncHttpClient.HEADER_CONTENT_RANGE);
                if (header == null) {
                    append = false;
                    current = 0;
                } else
                    Log.v(LOG_TAG, AsyncHttpClient.HEADER_CONTENT_RANGE + ": " + header.getValue());
                sendSuccessMessage(status.getStatusCode(), response.getAllHeaders(),
                        getResponseData(response.getEntity()));
            }
        }
    }
}

From source file:com.github.hobbe.android.openkarotz.fragment.RadioFragment.java

@Override
public void onAttach(Activity activity) {
    Log.v(LOG_TAG, "onAttach");
    super.onAttach(activity);
}

From source file:com.ultramegatech.ey.UpdateService.java

@Override
protected void onHandleIntent(Intent intent) {
    if (!HttpHelper.isConnected(this)) {
        return;//from   w  w w.j a  va2  s  . c o  m
    }

    final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);

    final long lastCheck = preferences.getLong(KEY_LAST_CHECK, 0);
    final long now = System.currentTimeMillis();
    if (now - lastCheck < CHECK_INTERVAL) {
        return;
    }

    Log.v(TAG, "Checking for updates");

    final int version = preferences.getInt(KEY_VERSION, 0);
    final int newVersion = HttpHelper.getVersion();
    if (newVersion > version) {
        Log.v(TAG, "Downloading updates...");

        final ContentValues[] valuesArray = fetchElementData(newVersion);
        if (valuesArray == null) {
            return;
        }

        final ContentResolver cr = getContentResolver();
        Uri uri;
        int changed;
        for (int i = 0; i < valuesArray.length; i++) {
            uri = ContentUris.withAppendedId(Elements.CONTENT_URI_NUMBER,
                    valuesArray[i].getAsLong(Elements.NUMBER));
            changed = cr.update(uri, valuesArray[i], null, null);

            if (changed == 0) {
                cr.insert(Elements.CONTENT_URI, valuesArray[i]);
            }
        }

        preferences.edit().putInt(KEY_VERSION, newVersion).commit();

        Log.v(TAG, "Update completed successfully");
    }

    preferences.edit().putLong(KEY_LAST_CHECK, System.currentTimeMillis()).commit();
}

From source file:com.finlay.geomonsters.MyIOCallback.java

@Override
public void onMessage(JSONObject arg0, IOAcknowledge arg1) {
    Log.v(TAG, "Server JSON Message: " + arg0.toString());

}

From source file:de.electricdynamite.pasty.GCMIntentService.java

@SuppressLint("NewApi")
@Override//from  w ww. j a  v a2s . c o m
protected void onMessage(Context context, Intent intent) {
    if (prefs == null)
        this.prefs = new PastyPreferencesProvider(context);
    final Bundle extras = intent.getExtras();
    if (extras == null) {
        Log.i(TAG, "onMessage(): Empty intent received");
        return;
    }
    final String mItemId = extras.getString("itemId");
    final String mItemStr = extras.getString("item");
    final int mEventId = Integer.parseInt(extras.getString("eventId"));
    if (mItemId == null || mItemStr == null || mItemId == "" || mItemStr == "") {
        Log.i(TAG, "onMessage(): Invalid intent received");
        return;
    }
    if (LOCAL_LOG)
        Log.v(TAG, "onMessage(): Received message for event: " + mEventId);
    switch (mEventId) {
    case EVENT_ITEM_ADDED:
        final String lastItemId = prefs.getLastItem();
        if (mItemId.equals(lastItemId))
            return;
        if (client == null) {
            client = new PastyClient(prefs.getRESTBaseURL(), true);
            client.setUsername(prefs.getUsername());
            client.setPassword(prefs.getPassword());
        }

        final ClipboardItem mItem = new ClipboardItem(mItemId, mItemStr);
        final Boolean mPush = prefs.getPush();
        final Boolean mCopyToClipboard = prefs.getPushCopyToClipboard();
        final Boolean mNotify = prefs.getPushNotify();
        if (mPush == true) {
            if (mCopyToClipboard == true) {
                if (mItem.getText() != "") {
                    Intent resultIntent = new Intent(this, CopyService.class);
                    resultIntent.putExtra("de.electricdynamite.pasty.itemId", mItem.getId());
                    resultIntent.putExtra("de.electricdynamite.pasty.item", mItem.getText());
                    resultIntent.putExtra("de.electricdynamite.pasty.notify", mNotify);
                    startService(resultIntent);
                    resultIntent = null;
                }
            } else {
                if (mNotify == true) {
                    String contentText = String.format(getString(R.string.notification_event_add_text),
                            mItem.getText());
                    NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this)
                            .setSmallIcon(R.drawable.ic_stat_pasty)
                            .setContentTitle(getString(R.string.notification_event_add_title))
                            .setContentText(contentText).setAutoCancel(Boolean.TRUE);
                    // Creates an explicit intent for an Activity in your app
                    Intent resultIntent = new Intent(this, CopyService.class);
                    resultIntent.putExtra("de.electricdynamite.pasty.itemId", mItem.getId());
                    resultIntent.putExtra("de.electricdynamite.pasty.item", mItem.getText());
                    resultIntent.putExtra("de.electricdynamite.pasty.notify", mNotify);
                    PendingIntent resultPendingIntent = PendingIntent.getService(context, 0, resultIntent,
                            PendingIntent.FLAG_UPDATE_CURRENT);
                    mBuilder.setContentIntent(resultPendingIntent);
                    NotificationManager mNotificationManager = (NotificationManager) getSystemService(
                            Context.NOTIFICATION_SERVICE);
                    // mId allows you to update the notification later on.
                    mNotificationManager.notify(PastySharedStatics.NOTIFICATION_ID, mBuilder.build());
                }
            }
            JSONArray clipboard = null;
            try {
                clipboard = client.getClipboard();
                cacheClipboard(clipboard);
            } catch (PastyException e) {
                if (LOCAL_LOG)
                    Log.v(TAG, "Could not get clipboard: " + e.getMessage());
            }

        }
        break;
    default:
        Log.i(TAG, "onMessage(): Unsupported event: " + mEventId);
        break;
    }
    /* TODO Make ClipboardFragment react to changes from GCMIntentService */
}

From source file:com.example.pierre.applicompanies.library_http.RangeFileAsyncHttpResponseHandler.java

@Override
public void sendResponseMessage(HttpResponse response) throws IOException {
    if (!Thread.currentThread().isInterrupted()) {
        StatusLine status = response.getStatusLine();
        if (status.getStatusCode() == HttpStatus.SC_REQUESTED_RANGE_NOT_SATISFIABLE) {
            //already finished
            if (!Thread.currentThread().isInterrupted())
                sendSuccessMessage(status.getStatusCode(), response.getAllHeaders(), null);
        } else if (status.getStatusCode() >= 300) {
            if (!Thread.currentThread().isInterrupted())
                sendFailureMessage(status.getStatusCode(), response.getAllHeaders(), null,
                        new HttpResponseException(status.getStatusCode(), status.getReasonPhrase()));
        } else {//from  w ww  .  ja va2 s.c om
            if (!Thread.currentThread().isInterrupted()) {
                Header header = response.getFirstHeader(AsyncHttpClient.HEADER_CONTENT_RANGE);
                if (header == null) {
                    append = false;
                    current = 0;
                } else {
                    Log.v(LOG_TAG, AsyncHttpClient.HEADER_CONTENT_RANGE + ": " + header.getValue());
                }
                sendSuccessMessage(status.getStatusCode(), response.getAllHeaders(),
                        getResponseData(response.getEntity()));
            }
        }
    }
}

From source file:com.klinker.android.dream.DreamSceneService.java

/**
 * Start a thread that fetches a JSONArray of all wallpapers, then set the first one
 *///from ww  w. java 2 s  .  co m
private void initBackgrounds() {
    new Thread(new Runnable() {
        @Override
        public void run() {
            try {
                String elements = NetworkUtils.getJsonString(JSON_URL);
                backgrounds = new JSONArray(elements);

                Log.v(TAG, "found JSONArray: " + elements);

                handler.post(new Runnable() {
                    @Override
                    public void run() {
                        switchBackground();
                    }
                });
            } catch (JSONException e) {
                Log.wtf(TAG, "something wrong with backgrounds json :(", e);
            }
        }
    }).start();
}

From source file:eu.e43.impeller.account.LoginActivity.java

@Override
public void onCreate(Bundle icicle) {
    Log.v(TAG, "onCreate(" + icicle + ")");
    super.onCreate(icicle);
    setContentView(R.layout.activity_login);

    m_accountManager = AccountManager.get(this);
    final Intent intent = getIntent();

    String id = intent.getStringExtra("id");

    m_idView = (TextView) findViewById(R.id.id);
    m_loginButton = (Button) findViewById(R.id.sign_in_button);
    m_loginFormView = findViewById(R.id.login_form);
    m_loginStatusView = findViewById(R.id.login_status);
    m_webView = (WebView) findViewById(R.id.web_view);
    m_idView.setText(id);/*from  w  w  w . j a v a  2s.c om*/

    m_loginButton.setOnClickListener(this);
    m_webView.setWebViewClient(new WebViewListener());
}