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:com.sourceallies.android.zonebeacon.data.DataSource.java

/**
 * Opens the database.// w w w. j a  va  2s .  c  o m
 */
public synchronized void open() {
    Log.v(TAG, "current open counter for opening: " + openCounter);
    if (openCounter.incrementAndGet() == 1) {
        Log.v(TAG, "getting writable database");
        database = dbHelper.getWritableDatabase();
    }
}

From source file:com.lugia.timetable.SubjectList.java

public void displaySubjectListContent() {
    Log.d(TAG, String.format("%d subject in total.\n", size()));

    for (Subject subject : this) {
        Log.v(TAG, String.format("Subject Code: %s", subject.getSubjectCode()));
        Log.v(TAG, String.format("Subject Description: %s", subject.getSubjectDescription()));
        Log.v(TAG, String.format("Lecture Section: %s", subject.getLectureSection()));
        Log.v(TAG, String.format("Tutorial Section: %s", subject.getTutorialSection()));
        Log.v(TAG, String.format("Credits Hours: %d", subject.getCreditHours()));

        ArrayList<Schedule> timeList = subject.getSchedules();

        Log.v(TAG, "Time:");

        for (Schedule time : timeList) {
            Log.v(TAG, String.format("%s %d %d %d %s", time.getSection(), time.getDay(), time.getTime(),
                    time.getLength(), time.getRoom()));
        }//from www .ja  va 2  s .c  om
    }
}

From source file:com.lge.osclibrary.OSCCommandsExecute.java

@Override
protected Object doInBackground(Void... voids) {
    //Set body for /osc/commands/execute API
    JSONObject data = new JSONObject();
    try {//from  w  w w. j  a v a  2 s  .  c  o  m
        data.put(OSCParameterNameMapper.NAME, mCommand);
        if (mParameters != null) {
            data.put(OSCParameterNameMapper.PARAMETERS, mParameters);
        }
    } catch (JSONException e) {
        Log.v(TAG, "Error: Json error for put data in function");
        e.printStackTrace();
    }
    setHttpRequestData(data.toString());
    return super.doInBackground(voids);
}

From source file:io.anyline.cordova.AnylineOcrActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    String ocrConfigString = getIntent().getExtras().getString(AnylinePlugin.EXTRA_OCR_CONFIG_JSON, "");

    anylineOcrScanView = new AnylineOcrScanView(this, null);
    try {/*from w  ww. j  a  va  2  s  . c  o  m*/
        JSONObject json = new JSONObject(configJson);
        anylineOcrScanView.setConfig(new AnylineViewConfig(this, json));

        if (json.has("reportingEnabled")) {
            anylineOcrScanView.setReportingEnabled(json.optBoolean("reportingEnabled", true));
        }

        json = new JSONObject(ocrConfigString);
        AnylineOcrConfig ocrConfig = new AnylineOcrConfig(json);
        if (ocrConfig.getCustomCmdFile() != null) {
            //custom cmd file in cordova is relative to www, so add www
            ocrConfig.setCustomCmdFile("www/" + ocrConfig.getCustomCmdFile());
        }

        JSONArray tesseractArray = json.optJSONArray("traineddataFiles");
        if (tesseractArray != null) {
            String[] languages = new String[tesseractArray.length()];
            for (int i = 0; i < languages.length; i++) {
                long start = System.currentTimeMillis();
                File dirToCopyTo = new File(this.getFilesDir(), "anyline/module_anyline_ocr/tessdata/");
                String traineddataFilePath = tesseractArray.getString(i);

                int lastFileSeparatorIndex = traineddataFilePath.lastIndexOf(File.separator);
                int lastDotIndex = traineddataFilePath.lastIndexOf(".");
                if (lastDotIndex > lastFileSeparatorIndex) {
                    //start after the "/" or with 0 if no fileseperator was found
                    languages[i] = traineddataFilePath.substring(lastFileSeparatorIndex + 1, lastDotIndex);
                } else {
                    //maybe it should just fail here, case propably not useful
                    languages[i] = traineddataFilePath.substring(lastFileSeparatorIndex + 1);
                }
                AssetUtil.copyAssetFileWithoutPath(this, "www/" + traineddataFilePath, dirToCopyTo, false);
                Log.v(TAG, "Copy traineddata duration: " + (System.currentTimeMillis() - start));
            }
            ocrConfig.setTesseractLanguages(languages);
        }

        drawTextOutline = json.optBoolean("drawTextOutline", true);

        anylineOcrScanView.setAnylineOcrConfig(ocrConfig);

    } catch (Exception e) {
        // JSONException or IllegalArgumentException is possible for errors in json
        // IOException is possible for errors during asset copying
        finishWithError(Resources.getString(this, "error_invalid_json_data") + "\n" + e.getLocalizedMessage());
        return;
    }

    setContentView(anylineOcrScanView);

    initAnyline();
}

From source file:com.example.android.popularmovies.FetchMovieTask.java

private void getMovieDataFromJson(String movieJsonStr, String sortType) throws JSONException {

    //final String LOG_TAG = getMovieDataFromJson.class.getSimpleName();

    final String LOG_TAG = "getMovieDataFromJson";

    // These are the names of the JSON objects that need to be extracted.
    final String MDB_RESULTS = "results";
    final String MDB_POPULARITY = "popularity";
    final String MDB_ORIGINAL_TITLE = "original_title";
    final String MDB_POSTER_PATH_THUMBNAIL = "poster_path";
    final String MDB_PLOT_SYNOPSIS = "overview";
    final String MDB_USER_RATING = "vote_average";
    final String MDB_RELEASE_DATE = "release_date";
    final String MDB_ID = "id";

    try {//from  w  w  w  .  j  ava 2  s. co  m
        JSONObject movieJson = new JSONObject(movieJsonStr);
        JSONArray movieArray = movieJson.getJSONArray(MDB_RESULTS);

        // Insert the new  movie information into the database
        Vector<ContentValues> cVVector = new Vector<ContentValues>(movieArray.length());

        for (int i = 0; i < movieArray.length(); i++) {
            // Get the JSON object representing the movie
            JSONObject singleMovie = movieArray.getJSONObject(i);

            ContentValues movieValues = new ContentValues();

            String yy = mContext.getString(R.string.pref_sort_favourite);

            if (sortType.equals(mContext.getString(R.string.pref_sort_popular))) {
                Log.v(LOG_TAG, "Sort: Order Popular");

                movieValues.put(MovieListEntry.COLUMN_MOVIE_ID, singleMovie.getString(MDB_ID));
                movieValues.put(MovieListEntry.COLUMN_POPULARITY, singleMovie.getInt(MDB_POPULARITY));
                movieValues.put(MovieListEntry.COLUMN_ORIGINAL_TITLE,
                        singleMovie.getString(MDB_ORIGINAL_TITLE));
                movieValues.put(MovieListEntry.COLUMN_PLOT_SYNOPSIS, singleMovie.getString(MDB_PLOT_SYNOPSIS));
                movieValues.put(MovieListEntry.COLUMN_USER_RATING, singleMovie.getDouble(MDB_USER_RATING));
                movieValues.put(MovieListEntry.COLUMN_RELEASE_DATE, singleMovie.getString(MDB_RELEASE_DATE));
                movieValues.put(MovieListEntry.COLUMN_POSTER_PATH_THUMBNAIL,
                        singleMovie.getString(MDB_POSTER_PATH_THUMBNAIL));

            } else if (sortType.equals(mContext.getString(R.string.pref_sort_highestrated))) {
                Log.v(LOG_TAG, "Sort: Order Highest Rated");
                movieValues.put(HighestRatedMovies.COLUMN_MOVIE_ID, singleMovie.getString(MDB_ID));
                movieValues.put(HighestRatedMovies.COLUMN_POPULARITY, singleMovie.getInt(MDB_POPULARITY));
                movieValues.put(HighestRatedMovies.COLUMN_ORIGINAL_TITLE,
                        singleMovie.getString(MDB_ORIGINAL_TITLE));
                movieValues.put(HighestRatedMovies.COLUMN_PLOT_SYNOPSIS,
                        singleMovie.getString(MDB_PLOT_SYNOPSIS));
                movieValues.put(HighestRatedMovies.COLUMN_USER_RATING, singleMovie.getDouble(MDB_USER_RATING));
                movieValues.put(HighestRatedMovies.COLUMN_RELEASE_DATE,
                        singleMovie.getString(MDB_RELEASE_DATE));
                movieValues.put(HighestRatedMovies.COLUMN_POSTER_PATH_THUMBNAIL,
                        singleMovie.getString(MDB_POSTER_PATH_THUMBNAIL));

            } else if (sortType.equals(mContext.getString(R.string.pref_sort_favourite))) {
                Log.v(LOG_TAG, "Sort: Order Favorite");
                movieValues.put(MovieListEntry.COLUMN_MOVIE_ID, singleMovie.getString(MDB_ID));
                movieValues.put(MovieListEntry.COLUMN_POPULARITY, singleMovie.getInt(MDB_POPULARITY));
                movieValues.put(MovieListEntry.COLUMN_ORIGINAL_TITLE,
                        singleMovie.getString(MDB_ORIGINAL_TITLE));
                movieValues.put(MovieListEntry.COLUMN_PLOT_SYNOPSIS, singleMovie.getString(MDB_PLOT_SYNOPSIS));
                movieValues.put(MovieListEntry.COLUMN_USER_RATING, singleMovie.getDouble(MDB_USER_RATING));
                movieValues.put(MovieListEntry.COLUMN_RELEASE_DATE, singleMovie.getString(MDB_RELEASE_DATE));
                movieValues.put(MovieListEntry.COLUMN_POSTER_PATH_THUMBNAIL,
                        singleMovie.getString(MDB_POSTER_PATH_THUMBNAIL));

                //Default oto Highest Rated Movie view if sort order preference is favorite and no movie is marked as favorite
                // Display Message to user

            } else {
                Log.d(LOG_TAG, "Sort Order Not Found:" + sortType);
            }

            cVVector.add(movieValues);
        }
        int inserted = 0;

        // add to database
        if (cVVector.size() > 0) {
            ContentValues[] cvArray = new ContentValues[cVVector.size()];
            cVVector.toArray(cvArray);
            if (sortType.equals(mContext.getString(R.string.pref_sort_popular))) {
                inserted = mContext.getContentResolver().bulkInsert(MovieListEntry.CONTENT_URI, cvArray);
            } else if (sortType.equals(mContext.getString(R.string.pref_sort_highestrated))) {
                inserted = mContext.getContentResolver().bulkInsert(HighestRatedMovies.CONTENT_URI, cvArray);
            }
        }

        // Log.d(LOG_TAG, "FetchMovieTask Complete. " + cVVector.size() + " Inserted");
        Log.d(LOG_TAG, "FetchMovieTask Complete. " + inserted + " Inserted");

    } catch (JSONException e) {
        Log.e(LOG_TAG, e.getMessage(), e);
        e.printStackTrace();
    }

}

From source file:pt.up.mobile.authenticator.Authenticator.java

@Override
public Bundle getAuthToken(AccountAuthenticatorResponse response, Account account, String authTokenType,
        Bundle loginOptions) throws NetworkErrorException {
    Log.v(TAG, "getAuthToken()");

    // If the caller requested an authToken type we don't support, then
    // return an error
    if (!authTokenType.equals(Constants.AUTHTOKEN_TYPE)) {
        final Bundle result = new Bundle();
        result.putString(AccountManager.KEY_ERROR_MESSAGE, "invalid authTokenType");
        return result;
    }// w ww .  j a va2 s . c o  m
    try {
        final AccountManager am = AccountManager.get(mContext);
        final String peek = am.peekAuthToken(account, authTokenType);
        if (peek != null) {
            final Bundle result = new Bundle();
            result.putString(AccountManager.KEY_ACCOUNT_NAME, account.name);
            result.putString(AccountManager.KEY_ACCOUNT_TYPE, Constants.ACCOUNT_TYPE);
            result.putString(AccountManager.KEY_AUTHTOKEN, peek);
            return result;
        }
        // Extract the username and password from the Account Manager, and
        // ask
        // the server for an appropriate AuthToken.
        final String password = am.getPassword(account);
        if (password != null) {
            String[] reply;

            reply = SifeupAPI.authenticate(account.name, password, mContext);
            final String authToken = reply[1];
            if (!TextUtils.isEmpty(authToken)) {
                final Bundle result = new Bundle();
                result.putString(AccountManager.KEY_ACCOUNT_NAME, account.name);
                result.putString(AccountManager.KEY_ACCOUNT_TYPE, Constants.ACCOUNT_TYPE);
                result.putString(AccountManager.KEY_AUTHTOKEN, authToken);
                return result;
            }
        }

    } catch (AuthenticationException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
        throw new NetworkErrorException();
    }
    // If we get here, then we couldn't access the user's password - so we
    // need to re-prompt them for their credentials. We do that by creating
    // an intent to display our AuthenticatorActivity panel.
    final Intent intent = new Intent(mContext, AuthenticatorActivity.class);
    intent.putExtra(AuthenticatorActivity.PARAM_CONFIRM_CREDENTIALS, true);
    intent.putExtra(AuthenticatorActivity.PARAM_USERNAME, account.name);
    intent.putExtra(AuthenticatorActivity.PARAM_AUTHTOKEN_TYPE, authTokenType);
    intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response);
    final Bundle bundle = new Bundle();
    bundle.putParcelable(AccountManager.KEY_INTENT, intent);
    return bundle;
}

From source file:de.niklasmerz.cordova.fingerprint.Fingerprint.java

/**
 * Sets the context of the Command. This can then be used to do things like
 * get file paths associated with the Activity.
 *
 * @param cordova The context of the main Activity.
 * @param webView The CordovaWebView Cordova is running in.
 */// w ww.jav  a 2s.c o  m

public void initialize(CordovaInterface cordova, CordovaWebView webView) {
    super.initialize(cordova, webView);
    Log.v(TAG, "Init Fingerprint");
    packageName = cordova.getActivity().getApplicationContext().getPackageName();
    mPluginResult = new PluginResult(PluginResult.Status.NO_RESULT);

    if (android.os.Build.VERSION.SDK_INT < 23) {
        return;
    }

    mKeyguardManager = cordova.getActivity().getSystemService(KeyguardManager.class);
    mFingerPrintManager = cordova.getActivity().getApplicationContext()
            .getSystemService(FingerprintManager.class);

    try {
        mKeyGenerator = KeyGenerator.getInstance(KeyProperties.KEY_ALGORITHM_AES, ANDROID_KEY_STORE);
        mKeyStore = KeyStore.getInstance(ANDROID_KEY_STORE);

    } catch (NoSuchAlgorithmException e) {
        throw new RuntimeException("Failed to get an instance of KeyGenerator", e);
    } catch (NoSuchProviderException e) {
        throw new RuntimeException("Failed to get an instance of KeyGenerator", e);
    } catch (KeyStoreException e) {
        throw new RuntimeException("Failed to get an instance of KeyStore", e);
    }

    try {
        mCipher = Cipher.getInstance(KeyProperties.KEY_ALGORITHM_AES + "/" + KeyProperties.BLOCK_MODE_CBC + "/"
                + KeyProperties.ENCRYPTION_PADDING_PKCS7);
    } catch (NoSuchAlgorithmException e) {
        throw new RuntimeException("Failed to get an instance of Cipher", e);
    } catch (NoSuchPaddingException e) {
        throw new RuntimeException("Failed to get an instance of Cipher", e);
    }
}

From source file:com.cyanogenmod.settings.device.LtoDownloadService.java

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    if (mTask != null && mTask.getStatus() != AsyncTask.Status.FINISHED) {
        if (ALOGV)
            Log.v(TAG, "LTO download is still active, not starting new download");
        return START_REDELIVER_INTENT;
    }// ww  w.  j a  v a  2  s .c  om

    boolean forceDownload = intent.getBooleanExtra(EXTRA_FORCE_DOWNLOAD, false);
    if (!shouldDownload(forceDownload)) {
        Log.d(TAG, "Service started, but shouldn't download ... stopping");
        stopSelf();
        return START_NOT_STICKY;
    }

    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
    String type = prefs.getString(KEY_FILE_TYPE, FILE_TYPE_DEFAULT);
    String uri = String.format(LTO_SOURCE_URI_PATTERN, type);

    mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

    mTask = new LtoDownloadTask(uri, LTO_DESTINATION_FILE);
    mTask.execute();

    return START_REDELIVER_INTENT;
}

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

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

From source file:org.vuphone.assassins.android.http.HTTPPoster.java

public static void doGameAreaPost(double lat, double lon, float rad) {
    final HttpPost post = new HttpPost(VUphone.SERVER + PATH);
    post.addHeader("Content-Type", "application/x-www-form-urlencoded");

    StringBuffer params = new StringBuffer();
    params.append("type=gameAreaPost&lat=" + lat + "&lon=" + lon + "&radius=" + rad);

    Log.v(VUphone.tag, pre + "Created parameter string: " + params);
    post.setEntity(new ByteArrayEntity(params.toString().getBytes()));

    // Do it/*from   www.j av  a2s  .  co  m*/
    Log.i(VUphone.tag, pre + "Executing post to " + VUphone.SERVER + PATH);

    HttpResponse resp = null;
    try {
        resp = c.execute(post);
        ByteArrayOutputStream bao = new ByteArrayOutputStream();
        resp.getEntity().writeTo(bao);
        Log.d(VUphone.tag, pre + "Response from server: " + new String(bao.toByteArray()));
    } catch (ClientProtocolException e) {
        Log.e(VUphone.tag, pre + "ClientProtocolException executing post: " + e.getMessage());
    } catch (IOException e) {
        Log.e(VUphone.tag, pre + "IOException writing to ByteArrayOutputStream: " + e.getMessage());
    } catch (Exception e) {
        Log.e(VUphone.tag, pre + "Other Exception of type:" + e.getClass());
        Log.e(VUphone.tag, pre + "The message is: " + e.getMessage());
    }
}