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.tcs.base64.Base64ImagePlugin.java

private boolean saveImage(String b64String, String fileName, String dirName, Boolean overwrite,
        CallbackContext callbackContext) {
    boolean result = false;
    try {// w w w.  j a va  2  s .  c  o m

        //Directory and File
        File dir = new File(dirName);
        if (!dir.exists()) {
            dir.mkdirs();
        }
        File file = new File(dirName, fileName);

        //Avoid overwriting a file
        if (!overwrite && file.exists()) {
            Log.v(TAG, "File already exists");
            //                return new PluginResult(PluginResult.Status.OK, "File already exists!");
            callbackContext.error("File already exists!");
            return false;
        }

        //Decode Base64 back to Binary format
        byte[] decodedBytes = Base64.decodeBase64(b64String.getBytes());

        //Save Binary file to phone
        file.createNewFile();
        FileOutputStream fOut = new FileOutputStream(file);
        fOut.write(decodedBytes);
        fOut.close();
        Log.v(TAG, "Saved successfully");
        callbackContext.success("Saved successfully!");
        //            return new PluginResult(PluginResult.Status.OK, "Saved successfully!");
        result = true;

    } catch (FileNotFoundException e) {
        Log.v(TAG, "File not Found");
        //            return new PluginResult(PluginResult.Status.ERROR, "File not Found!");
        callbackContext.error("File not Found!");
        result = false;
    } catch (IOException e) {
        Log.v(TAG, e.getMessage());
        //            return new PluginResult(PluginResult.Status.ERROR, e.getMessage());
        callbackContext.error("Exception :" + e.getMessage());
        result = false;
    }
    return result;
}

From source file:com.vst.android.demo.mensajeria.GCMIntentService.java

@Override
protected void onMessage(Context context, Intent intent) {
    Log.v(GCMIntentService.class.getName(), "onMessage message");
    //        String message1 = intent.getStringExtra("message");
    //        System.out.println("  message1 :"+ message1);
    //        String message = getString(R.string.gcm_message);
    //        System.out.println("  message :"+ message);
    //        displayMessage(context, message1);
    //        // notifies user
    //        generateNotification(context, message1);
}

From source file:com.example.jumpnote.android.jsonrpc.JsonRpcJavaClient.java

public void callBatch(final List<JsonRpcClient.Call> calls, final JsonRpcClient.BatchCallback callback) {
    HttpPost httpPost = new HttpPost(mRpcUrl);
    JSONObject requestJson = new JSONObject();
    JSONArray callsJson = new JSONArray();
    try {/*from   w  w  w . j a  v a 2  s.  com*/
        for (int i = 0; i < calls.size(); i++) {
            JsonRpcClient.Call call = calls.get(i);

            JSONObject callJson = new JSONObject();

            callJson.put("method", call.getMethodName());

            if (call.getParams() != null) {
                JSONObject callParams = (JSONObject) call.getParams();
                @SuppressWarnings("unchecked")
                Iterator<String> keysIterator = callParams.keys();
                String key;
                while (keysIterator.hasNext()) {
                    key = keysIterator.next();
                    callJson.put(key, callParams.get(key));
                }
            }

            callsJson.put(i, callJson);
        }

        requestJson.put("calls", callsJson);
        httpPost.setEntity(new StringEntity(requestJson.toString(), "UTF-8"));
        if (Log.isLoggable(TAG, Log.VERBOSE)) {
            Log.v(TAG, "POST request: " + requestJson.toString());
        }
    } catch (JSONException e) {
        // throw e;
    } catch (UnsupportedEncodingException e) {
        // throw e;
    }

    try {
        HttpResponse httpResponse = mHttpClient.execute(httpPost);
        final int responseStatusCode = httpResponse.getStatusLine().getStatusCode();
        if (200 <= responseStatusCode && responseStatusCode < 300) {
            BufferedReader reader = new BufferedReader(
                    new InputStreamReader(httpResponse.getEntity().getContent(), "UTF-8"), 8 * 1024);

            StringBuilder sb = new StringBuilder();
            String line;
            while ((line = reader.readLine()) != null) {
                sb.append(line).append("\n");
            }
            if (Log.isLoggable(TAG, Log.VERBOSE)) {
                Log.v(TAG, "POST response: " + sb.toString());
            }
            JSONTokener tokener = new JSONTokener(sb.toString());
            JSONObject responseJson = new JSONObject(tokener);
            JSONArray resultsJson = responseJson.getJSONArray("results");
            Object[] resultData = new Object[calls.size()];

            for (int i = 0; i < calls.size(); i++) {
                JSONObject result = resultsJson.getJSONObject(i);
                if (result.has("error")) {
                    callback.onError(i, new JsonRpcException((int) result.getInt("error"),
                            calls.get(i).getMethodName(), result.getString("message"), null));
                    resultData[i] = null;
                } else {
                    resultData[i] = result.get("data");
                }
            }

            callback.onData(resultData);
        } else {
            callback.onError(-1, new JsonRpcException(-1, "Received HTTP status code other than HTTP 2xx: "
                    + httpResponse.getStatusLine().getReasonPhrase()));
        }
    } catch (IOException e) {
        Log.e("JsonRpcJavaClient", e.getMessage());
        e.printStackTrace();
    } catch (JSONException e) {
        Log.e("JsonRpcJavaClient", "Error parsing server JSON response: " + e.getMessage());
        e.printStackTrace();
    }
}

From source file:org.mythtv.service.guide.v25.ProgramGuideHelperV25.java

public static Program findProgram(final Context context, final LocationProfile locationProfile,
        Integer channelId, DateTime startTime) {
    Log.v(TAG, "findProgram : enter");

    Program program = ProgramHelperV25.getInstance().findProgram(context, locationProfile,
            ProgramConstants.CONTENT_URI_GUIDE, ProgramConstants.TABLE_NAME_GUIDE, channelId, startTime);

    Log.v(TAG, "findProgram : enter");
    return program;
}

From source file:org.mythtv.service.guide.v26.ProgramGuideHelperV26.java

public static Program findProgram(final Context context, final LocationProfile locationProfile,
        Integer channelId, DateTime startTime) {
    Log.v(TAG, "findProgram : enter");

    Program program = ProgramHelperV26.getInstance().findProgram(context, locationProfile,
            ProgramConstants.CONTENT_URI_GUIDE, ProgramConstants.TABLE_NAME_GUIDE, channelId, startTime);

    Log.v(TAG, "findProgram : enter");
    return program;
}

From source file:org.mythtv.service.guide.v27.ProgramGuideHelperV27.java

public static Program findProgram(final Context context, final LocationProfile locationProfile,
        Integer channelId, DateTime startTime) {
    Log.v(TAG, "findProgram : enter");

    Program program = ProgramHelperV27.getInstance().findProgram(context, locationProfile,
            ProgramConstants.CONTENT_URI_GUIDE, ProgramConstants.TABLE_NAME_GUIDE, channelId, startTime);

    Log.v(TAG, "findProgram : enter");
    return program;
}

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

private String downloadSetting(final LocationProfile locationProfile, final String settingName,
        String settingDefault) throws MythServiceApiRuntimeException {
    Log.v(TAG, "downloadSetting : enter");

    String setting = null;//from w w  w .j  a  v  a  2s  .c o m

    ResponseEntity<org.mythtv.services.api.v025.beans.SettingList> responseEntity = mMythServicesTemplate
            .mythOperations()
            .getSetting(locationProfile.getHostname(), settingName, settingDefault, ETagInfo.createEmptyETag());

    if (responseEntity.getStatusCode().equals(HttpStatus.OK)) {

        org.mythtv.services.api.v025.beans.SettingList settingList = responseEntity.getBody();

        if (null != settingList) {

            if (null != settingList.getSettings() && !settingList.getSettings().isEmpty()) {

                if (settingList.getSettings().containsKey(settingName)) {
                    setting = settingList.getSettings().get(settingName);
                }

            }

        }

    }

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

From source file:org.mythtv.service.myth.v26.SettingHelperV26.java

private String downloadSetting(final LocationProfile locationProfile, final String settingName,
        String settingDefault) throws MythServiceApiRuntimeException {
    Log.v(TAG, "downloadSetting : enter");

    String setting = null;//from ww  w .ja va 2  s. com

    ResponseEntity<org.mythtv.services.api.v026.beans.SettingList> responseEntity = mMythServicesTemplate
            .mythOperations()
            .getSetting(locationProfile.getHostname(), settingName, settingDefault, ETagInfo.createEmptyETag());

    if (responseEntity.getStatusCode().equals(HttpStatus.OK)) {

        org.mythtv.services.api.v026.beans.SettingList settingList = responseEntity.getBody();

        if (null != settingList) {

            if (null != settingList.getSettings() && !settingList.getSettings().isEmpty()) {

                if (settingList.getSettings().containsKey(settingName)) {
                    setting = settingList.getSettings().get(settingName);
                }

            }

        }

    }

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

From source file:org.mythtv.service.myth.v27.SettingHelperV27.java

private String downloadSetting(final LocationProfile locationProfile, final String settingName,
        String settingDefault) throws MythServiceApiRuntimeException {
    Log.v(TAG, "downloadSetting : enter");

    String setting = null;// w ww.  j  a  v a  2  s .com

    ResponseEntity<org.mythtv.services.api.v027.beans.SettingList> responseEntity = mMythServicesTemplate
            .mythOperations()
            .getSetting(locationProfile.getHostname(), settingName, settingDefault, ETagInfo.createEmptyETag());

    if (responseEntity.getStatusCode().equals(HttpStatus.OK)) {

        org.mythtv.services.api.v027.beans.SettingList settingList = responseEntity.getBody();

        if (null != settingList) {

            if (null != settingList.getSettings() && !settingList.getSettings().isEmpty()) {

                if (settingList.getSettings().containsKey(settingName)) {
                    setting = settingList.getSettings().get(settingName);
                }

            }

        }

    }

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

From source file:com.hackensack.umc.activity.ViewProfileActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_view_profile);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    sharedPreferences = getSharedPreferences(Constant.SHAREPREF_TAG, MODE_PRIVATE);
    insuranceInfoTv = (TextView) findViewById(R.id.prof_insurance_tv);
    if (Util.isUserLogin(this) && Util.isPatientIdValid(this)) {

        try {//from  w ww .  j  ava 2 s  .c  om
            mPatient = new LoginUserData(new JSONObject(Util.getPatientJSON(this)));
            ((TextView) findViewById(R.id.profile_fname)).setText(mPatient.getFirstName());
            ((TextView) findViewById(R.id.prof_lname)).setText(mPatient.getLastName());
            ((TextView) findViewById(R.id.prof_license)).setText(
                    TextUtils.isEmpty(mPatient.getDrivingLicense()) ? "-" : mPatient.getDrivingLicense());
            DateFormat formatterDate = new SimpleDateFormat("MM-dd-yyyy");

            Date d = null;
            try {
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
                d = sdf.parse(mPatient.getBirthDate());
            } catch (Exception e) {
                Log.e("Date", " " + e);
            }

            //Bug is there : Null Pointer : Appointment Date
            ((TextView) findViewById(R.id.prof_date)).setText(formatterDate.format(d.getTime()));
            ((TextView) findViewById(R.id.prof_gender_tv)).setText(mPatient.getGender());
            //Code for getting and displaying phone numbers
            ArrayList<Telecom> telecom = mPatient.getTelephone();
            Log.v("Telecom", telecom.toString());
            String phonestr = null;
            for (int i = 0; i < telecom.size(); i++) {
                if (((Telecom) telecom.get(i)).getSystem().equalsIgnoreCase(Telecom.TELECOM_EMAIL)) {
                    ((TextView) findViewById(R.id.prof_email)).setText(((Telecom) telecom.get(i)).getValue());
                } else if (((Telecom) telecom.get(i)).getSystem().equalsIgnoreCase(Telecom.TELECOM_PHONE)) {
                    phonestr = telecom.get(i).getValue();
                    final Editable doctorPhoneNum = new SpannableStringBuilder(phonestr);
                    PhoneNumberUtils.formatNumber(doctorPhoneNum,
                            PhoneNumberUtils.getFormatTypeForLocale(Locale.US));
                    if (((Telecom) telecom.get(i)).getUse().equalsIgnoreCase(Telecom.TELECOM_MOBILE_PHONE)) {
                        findViewById(R.id.mobile_ll).setVisibility(View.VISIBLE);
                        ((TextView) findViewById(R.id.prof_mob_num)).setText(doctorPhoneNum);

                    } else if (((Telecom) telecom.get(i)).getUse()
                            .equalsIgnoreCase(Telecom.TELECOM_HOME_PHONE)) {
                        findViewById(R.id.home_ll).setVisibility(View.VISIBLE);
                        ((TextView) findViewById(R.id.prof_home_num)).setText(doctorPhoneNum);

                    } else if (((Telecom) telecom.get(i)).getUse()
                            .equalsIgnoreCase(Telecom.TELECOM_WORK_PHONE)) {
                        findViewById(R.id.work_ll).setVisibility(View.VISIBLE);
                        ((TextView) findViewById(R.id.prof_work_num)).setText(doctorPhoneNum);
                    }
                }
            }
            //Code to get and display address
            if (mPatient.getAddress() != null && mPatient.getAddress().size() > 0) {
                Address address = ((ArrayList<Address>) mPatient.getAddress()).get(0);
                ((TextView) findViewById(R.id.prof_addr_tv)).setText(address.getStreet1() + ","
                        + (TextUtils.isEmpty(address.getStreet2()) ? "" : address.getStreet2() + ",")
                        + address.getCity() + "," + address.getState() + "," + address.getZip() + ","
                        + address.getCountry());
            }

        } catch (Exception e) {
            Log.e("isUserLogin", "", e);

        }
        //Code to get and display insurance info

        new GetInsuranceInfo().execute(mPatient.getMRNId());
    }

    /* mProgressDialog = new ProgressDialog(this);
     mProgressDialog.setCancelable(false);*/
}