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.keithandthegirl.ui.activity.FeedbackDialogFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Log.v(TAG, "onCreateDialog : enter");

    View v = getActivity().getLayoutInflater().inflate(R.layout.fragment_feedback, null);

    editName = (EditText) v.findViewById(R.id.feedback_name);
    editLocation = (EditText) v.findViewById(R.id.feedback_location);
    editComment = (EditText) v.findViewById(R.id.feedback_comment);

    SharedPreferences sharedPreferences = getActivity().getPreferences(Context.MODE_PRIVATE);
    String name = sharedPreferences.getString(NAME_KEY, "");
    String location = sharedPreferences.getString(LOCATION_KEY, "");

    editName.setText(name);//w ww.j a  va2 s  . com
    editLocation.setText(location);

    Log.v(TAG, "onCreateDialog : exit");
    return new AlertDialog.Builder(getActivity()).setView(v).setIcon(android.R.drawable.ic_dialog_info)
            .setTitle(getResources().getString(R.string.feedback_title))
            .setPositiveButton(R.string.feedback_positive_button, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int whichButton) {

                    String name = editName.getText().toString();
                    if (null != name && !"".equals(name)) {
                        name = name.trim();

                        if (name.length() > 50) {
                            name = name.substring(0, 50);
                        }
                    }

                    String location = editLocation.getText().toString();
                    if (null != location && !"".equals(location)) {
                        location = location.trim();

                        if (location.length() > 50) {
                            location = location.substring(0, 50);
                        }
                    }

                    String comment = editComment.getText().toString();
                    if (null != comment && !"".equals(comment)) {
                        comment = comment.trim();

                        if (comment.length() > 512) {
                            comment = comment.substring(0, 512);
                        }
                    }

                    savePreferences(NAME_KEY, name);
                    savePreferences(LOCATION_KEY, location);

                    if (null != comment && !"".equals(comment)) {
                        new PostCommentTask().execute(name, location, comment);
                    }

                    editComment.setText("");

                }
            }).setNegativeButton(R.string.feedback_negative_button, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int whichButton) {
                    getDialog().dismiss();
                }
            }).setCancelable(true).show();
}

From source file:org.mythtv.service.content.v25.FileListHelperV25.java

public List<String> process(final Context context, final LocationProfile locationProfile,
        String storageGroupName) {
    Log.v(TAG, "process : enter");

    if (!NetworkHelper.getInstance().isMasterBackendConnected(context, locationProfile)) {
        Log.w(TAG, "process : Master Backend '" + locationProfile.getHostname() + "' is unreachable");

        return null;
    }/*from w  w  w  .ja  v  a 2s.  c  o  m*/

    mMythServicesTemplate = (MythServicesTemplate) MythAccessFactory.getServiceTemplateApiByVersion(mApiVersion,
            locationProfile.getUrl());
    if (null == mMythServicesTemplate) {
        Log.w(TAG, "process : Master Backend '" + locationProfile.getHostname() + "' is unreachable");

        return null;
    }

    List<String> files = null;

    try {

        files = downloadFiles(storageGroupName);

    } catch (Exception e) {
        Log.e(TAG, "process : error", e);

        files = null;
    }

    Log.v(TAG, "process : exit");
    return files;
}

From source file:org.openschedule.api.impl.OpenScheduleTemplate.java

private void registerOpenScheduleJsonModule() {
    Log.v(TAG, "registerOpenScheduleJsonModule : enter");

    List<HttpMessageConverter<?>> converters = getRestTemplate().getMessageConverters();
    for (HttpMessageConverter<?> converter : converters) {
        if (converter instanceof MappingJacksonHttpMessageConverter) {
            MappingJacksonHttpMessageConverter jsonConverter = (MappingJacksonHttpMessageConverter) converter;
            ObjectMapper objectMapper = new ObjectMapper();
            objectMapper.registerModule(new OpenScheduleModule());
            jsonConverter.setObjectMapper(objectMapper);
        }/*from ww  w.j  av  a2  s.  co  m*/
    }

    Log.v(TAG, "registerOpenScheduleJsonModule : exit");
}

From source file:br.com.cams7.siscom.member.MemberList.java

/**
 * Called when the activity is first created. Responsible for initializing
 * the UI.//from w w w. ja v a 2  s .co m
 */
@Override
public void onCreate(Bundle savedInstanceState) {
    Log.v(TAG, "Activity State: onCreate()");
    super.onCreate(savedInstanceState);
    setContentView(R.layout.member_list);

    // Obtain handles to UI objects
    bAddMember = (Button) findViewById(R.id.bAddMember);
    lvMembers = (ListView) findViewById(R.id.lvMembers);
    cbShowInvisible = (CheckBox) findViewById(R.id.cbShowInvisible);

    tvIsConnected = (TextView) findViewById(R.id.tvIsConnected);
    tvResponse = (TextView) findViewById(R.id.tvResponse);

    // Initialize class properties
    showInvisible = false;
    cbShowInvisible.setChecked(showInvisible);

    // Register handler for UI elements
    bAddMember.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            Log.d(TAG, "bAddMember clicked");
            launchMemberEdit();
        }
    });
    cbShowInvisible.setOnCheckedChangeListener(new OnCheckedChangeListener() {
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            Log.d(TAG, "cbShowInvisible changed: " + isChecked);
            showInvisible = isChecked;
            populateMembers();
        }
    });

    // check if you are connected or not
    if (RestUtil.isConnected(this)) {
        tvIsConnected.setBackgroundColor(0xFF00CC00);
        tvIsConnected.setText(R.string.msg_connected);
    } else {
        tvIsConnected.setText(R.string.msg_not_connected);
    }

    // call AsynTask to perform network operation on separate thread
    new HttpAsyncTask().execute(URL);
}

From source file:com.auth0.util.Telemetry.java

public String asBase64() {
    Map<String, Object> info = new HashMap<>();
    info.put("name", getName("Lock.Android"));
    info.put("version", getVersion(BuildConfig.VERSION_NAME));
    if (isNonEmpty(this.libraryVersion)) {
        info.put("lib_version", this.libraryVersion);
    }/*ww  w  . j a  va 2 s.c om*/
    if (this.extra != null) {
        info.putAll(this.extra);
    }
    String clientInfo = null;
    try {
        String json = new ObjectMapper().writeValueAsString(info);
        Log.v(TAG, "Telemetry JSON is " + json);
        clientInfo = Base64.encodeToString(json.getBytes(Charset.defaultCharset()),
                Base64.URL_SAFE | Base64.NO_WRAP);
    } catch (JsonProcessingException e) {
        Log.w(TAG, "Failed to build client info", e);
    }
    return clientInfo;
}

From source file:com.phonemetra.turbo.lockclock.weather.OpenWeatherMapProvider.java

@Override
public List<LocationResult> getLocations(String input) {
    String url = String.format(URL_LOCATION, Uri.encode(input), getLanguageCode());
    String response = HttpRetriever.retrieve(url);
    if (response == null) {
        return null;
    }/*from ww  w  . j a va  2 s.  co m*/

    if (Log.isLoggable(TAG, Log.VERBOSE)) {
        Log.v(TAG, "URL = " + url + " returning a response of " + response);
    }

    try {
        JSONArray jsonResults = new JSONObject(response).getJSONArray("list");
        ArrayList<LocationResult> results = new ArrayList<LocationResult>();
        int count = jsonResults.length();

        for (int i = 0; i < count; i++) {
            JSONObject result = jsonResults.getJSONObject(i);
            LocationResult location = new LocationResult();

            location.id = result.getString("id");
            location.city = result.getString("name");
            location.countryId = result.getJSONObject("sys").getString("country");
            results.add(location);
        }

        return results;
    } catch (JSONException e) {
        Log.w(TAG, "Received malformed location data (input=" + input + ")", e);
    }

    return null;
}

From source file:org.mythtv.service.myth.v25.SettingHelperV25.java

public String process(final Context context, final LocationProfile locationProfile, final String settingName,
        final String settingDefault) {
    Log.v(TAG, "process : enter");

    if (!NetworkHelper.getInstance().isMasterBackendConnected(context, locationProfile)) {
        Log.w(TAG, "process : Master Backend '" + locationProfile.getHostname() + "' is unreachable");

        return null;
    }//from   w  ww  .jav a  2s .c o  m

    mMythServicesTemplate = (MythServicesTemplate) MythAccessFactory.getServiceTemplateApiByVersion(mApiVersion,
            locationProfile.getUrl());
    if (null == mMythServicesTemplate) {
        Log.w(TAG, "process : Master Backend '" + locationProfile.getHostname() + "' is unreachable");

        return null;
    }

    String setting = null;

    try {

        setting = downloadSetting(locationProfile, settingName, settingDefault);

    } catch (Exception e) {
        Log.e(TAG, "process : error", e);

        setting = null;
    }

    Log.v(TAG, "process : exit");
    return setting;
}

From source file:fm.krui.kruifm.TrackUpdateHandler.java

@Override
protected Integer doInBackground(Void... arg0) {

    // Get song info and album art URL
    try {/*from  w  ww .ja  va2s .  c om*/
        trackInfo = getSongInfo();
        Log.v(TAG, "---");
        Log.v(TAG, "Returned track name = " + trackInfo[0]);
        Log.v(TAG, "Returned track artist = " + trackInfo[1]);
        Log.v(TAG, "Returned track album = " + trackInfo[2]);
        Log.v(TAG, "---");
    } catch (RuntimeException e) {
        Log.e(TAG, "RuntimeException thrown when getting song info!");
        e.printStackTrace();
    }

    // Check if the returned info is a new track or the same as the previous track
    if ((!trackInfo[0].equals(currentTrackInfo[0])) || (!trackInfo[1].equals(currentTrackInfo[1]))
            || (!trackInfo[2].equals(currentTrackInfo[2]))) {
        Log.v(TAG, "Song information has changed. UI will be updated.");

        // UI UPDATE HERE
        listener.broadcastMessage(StreamService.BROADCAST_COMMAND_UPDATE_PENDING);

        // If either the song, artist, or album name is different than the current song playing, we have downloaded a new track and we need to update the UI.
        // If album art update is requested, get the location of the album art and download it.
        if (updateAlbumArt) {
            artUrl = getAlbumArtURL(trackInfo[1], trackInfo[2]);
            Log.v(TAG, "Returned album art = " + artUrl);
            Log.v(TAG, "Grabbing album art from " + artUrl);
            albumArt = downloadAlbumArt(artUrl);
        } else {
            Log.v(TAG, "User has elected to not download album art. Skipping...");
        }

    } else {
        // If the information is the same, don't waste resources updating information with itself.
        Log.v(TAG, "Song information is equivalent to the song currently playing. No UI update necessary.");
        return NO_UPDATE;
    }

    return UPDATE_REQUESTED;
}

From source file:com.tigerbase.sunshine.FetchWeatherTask.java

/**
 * Helper method to handle insertion of a new location in the weather database.
 *
 * @param locationSetting The location string used to request updates from the server.
 * @param cityName A human-readable city name, e.g "Mountain View"
 * @param lat the latitude of the city/*from  w w w.jav  a2  s  .  co m*/
 * @param lon the longitude of the city
 * @return the row ID of the added location.
 */
long addLocation(String locationSetting, String cityName, double lat, double lon) {
    // Students: First, check if the location with this city name exists in the db
    // If it exists, return the current ID
    // Otherwise, insert it using the content resolver and the base URI
    Log.v(LOG_TAG, "addLocation");
    Cursor locationCursor = mContext.getContentResolver().query(WeatherContract.LocationEntry.CONTENT_URI,
            new String[] { WeatherContract.LocationEntry._ID },
            WeatherContract.LocationEntry.COLUMN_LOCATION_SETTING + " = ?", new String[] { locationSetting },
            null);
    long locationId = 0;
    if (locationCursor.moveToFirst()) {
        Log.v(LOG_TAG, "addLocation: Found location");
        int idColumnIndex = locationCursor.getColumnIndex(WeatherContract.LocationEntry._ID);
        locationId = locationCursor.getLong(idColumnIndex);
    }
    locationCursor.close();
    if (locationId > 0) {
        Log.v(LOG_TAG, "addLocation: Return Location " + locationId);
        return locationId;
    }

    ContentValues newLocationValues = new ContentValues();
    newLocationValues.put(WeatherContract.LocationEntry.COLUMN_LOCATION_SETTING, locationSetting);
    newLocationValues.put(WeatherContract.LocationEntry.COLUMN_CITY_NAME, cityName);
    newLocationValues.put(WeatherContract.LocationEntry.COLUMN_COORD_LAT, lat);
    newLocationValues.put(WeatherContract.LocationEntry.COLUMN_COORD_LONG, lon);

    Uri newLocationUri = mContext.getContentResolver().insert(WeatherContract.LocationEntry.CONTENT_URI,
            newLocationValues);

    locationId = ContentUris.parseId(newLocationUri);

    Log.v(LOG_TAG, "addLocation: Created location " + locationId);
    return locationId;
}

From source file:com.facebook.samples.sessionlogin.LoginUsingActivityActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity);/*from  www  . j a  va 2s  .  c  om*/
    Log.v("msg", "hello");
    try {
        PackageInfo info = getPackageManager().getPackageInfo("com.facebook.samples.sessionlogin",
                PackageManager.GET_SIGNATURES);
        for (Signature signature : info.signatures) {
            MessageDigest md = MessageDigest.getInstance("SHA");
            md.update(signature.toByteArray());
            Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
        }
    } catch (NameNotFoundException e) {

    } catch (NoSuchAlgorithmException e) {

    }

    buttonLoginLogout = (Button) findViewById(R.id.buttonLoginLogout);
    textInstructionsOrLink = (TextView) findViewById(R.id.instructionsOrLink);

    Settings.addLoggingBehavior(LoggingBehavior.INCLUDE_ACCESS_TOKENS);

    Session session = Session.getActiveSession();
    if (session == null) {
        if (savedInstanceState != null) {
            session = Session.restoreSession(this, null, statusCallback, savedInstanceState);
        }
        if (session == null) {
            session = new Session(this);
        }
        Session.setActiveSession(session);
        if (session.getState().equals(SessionState.CREATED_TOKEN_LOADED)) {
            session.openForRead(new Session.OpenRequest(this).setCallback(statusCallback));
        }
    }
    Session.NewPermissionsRequest newPermissionsRequest = new Session.NewPermissionsRequest(this,
            Arrays.asList("friends_birthday"));
    session.requestNewReadPermissions(newPermissionsRequest);
    updateView();
}