Example usage for android.util Log getStackTraceString

List of usage examples for android.util Log getStackTraceString

Introduction

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

Prototype

public static String getStackTraceString(Throwable tr) 

Source Link

Document

Handy function to get a loggable stack trace from a Throwable

Usage

From source file:com.dm.wallpaper.board.activities.WallpaperBoardPreviewActivity.java

private void onWallpaperLoaded(@ColorInt int textColor) {
    mAttacher = new PhotoViewAttacher(mWallpaper);
    mAttacher.setScaleType(ImageView.ScaleType.CENTER_CROP);
    AnimationHelper.fade(mProgress).start();
    AnimationHelper.fade(mBottomProgress).start();
    mRunnable = null;//from ww w  .j a  v a2s . c  om
    mHandler = null;
    mIsResumed = false;

    mFab.setImageDrawable(DrawableHelper.getTintedDrawable(this, R.drawable.ic_fab_apply, textColor));
    AnimationHelper.show(mFab).interpolator(new LinearOutSlowInInterpolator()).start();

    try {
        TapIntroHelper.showWallpaperPreviewIntro(this, mColor);
    } catch (Exception e) {
        LogUtil.e(Log.getStackTraceString(e));
    }
}

From source file:org.alfresco.mobile.android.test.api.services.ActivityStreamServiceTest.java

/**
 * All Tests forActivityStreamService public methods which create an error.
 * //from ww  w  . j a  v  a 2s  .c om
 * @Requirement 3F1, 5F1, 5F2, 6F1, 6F2
 */
public void testActivityServiceMethodsError() {
    try {
        // ///////////////////////////////////////////////////////////////////////////
        // Method getActivityStream()
        // ///////////////////////////////////////////////////////////////////////////
        try {
            Assert.assertNotNull(activityStreamService.getActivityStream((String) null));
            Assert.fail();
        } catch (IllegalArgumentException e) {
            Assert.assertTrue(true);
        }

        if (!isOnPremise()) {
            try {
                activityStreamService.getSiteActivityStream("adm1n");
            } catch (AlfrescoServiceException e) {
                // Nothing special
            }
        } else {
            Assert.assertTrue(activityStreamService.getSiteActivityStream("adm1n").isEmpty());
        }

        // ///////////////////////////////////////////////////////////////////////////
        // Method getSiteActivityStream()
        // ///////////////////////////////////////////////////////////////////////////
        try {
            Assert.assertNotNull(activityStreamService.getSiteActivityStream((String) null));
            Assert.fail();
        } catch (IllegalArgumentException e) {
            Assert.assertTrue(true);
        }

        // Check Error activity
        if (!isOnPremise()) {
            try {
                activityStreamService.getSiteActivityStream("bestsite").isEmpty();
            } catch (AlfrescoServiceException e) {
                // Nothing special
            }
        } else {
            Assert.assertTrue(activityStreamService.getSiteActivityStream("bestsite").isEmpty());
        }

        AlfrescoSession session = createSession(CONSUMER, CONSUMER_PASSWORD, null);
        if (session != null) {
            if (!isOnPremise()) {
                try {
                    Assert.assertFalse(session.getServiceRegistry().getActivityStreamService()
                            .getSiteActivityStream("privatesite").isEmpty());
                } catch (AlfrescoServiceException e) {
                    // Nothing special
                }
            } else {
                // @since site service management it's not null.
                Assert.assertTrue(session.getServiceRegistry().getActivityStreamService()
                        .getSiteActivityStream("privatesite").isEmpty());
            }

            Assert.assertTrue(session.getServiceRegistry().getActivityStreamService()
                    .getSiteActivityStream("moderatedsite").isEmpty());
        }
        checkSession(session);
    } catch (Exception e) {
        Log.e(TAG, "Error during Activity Tests");
        Log.e("TAG", Log.getStackTraceString(e));
    }
}

From source file:android_network.hetnet.vpn_service.Util.java

public static String getFingerprint(Context context) {
    try {//from  ww  w  . j a  v a2  s.  c o m
        PackageManager pm = context.getPackageManager();
        String pkg = context.getPackageName();
        PackageInfo info = pm.getPackageInfo(pkg, PackageManager.GET_SIGNATURES);
        byte[] cert = info.signatures[0].toByteArray();
        MessageDigest digest = MessageDigest.getInstance("SHA1");
        byte[] bytes = digest.digest(cert);
        StringBuilder sb = new StringBuilder();
        for (byte b : bytes)
            sb.append(Integer.toString(b & 0xff, 16).toLowerCase());
        return sb.toString();
    } catch (Throwable ex) {
        Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
        return null;
    }
}

From source file:com.inrista.loggliest.Loggly.java

/**
 * Log a debug message and an exception.
 * @param key Loggly json field//w  w w . j  av  a 2  s  .c o m
 * @param msg The log message
 * @param tr The exception to log
 */
public static void d(String key, String msg, Throwable tr) {
    d(key, msg + '\n' + Log.getStackTraceString(tr));
}

From source file:io.teak.sdk.TeakNotification.java

/**
 * Cancel a push notification that was scheduled with {@link TeakNotification#scheduleNotification(String, String, long)}
 *
 * @param scheduleId/*from w w w  .  jav a  2s .  c o  m*/
 * @return
 */
@SuppressWarnings("unused")
public static FutureTask<String> cancelNotification(final String scheduleId) {
    if (!Teak.isEnabled()) {
        Log.e(LOG_TAG, "Teak is disabled, ignoring cancelNotification().");
        return null;
    }

    if (scheduleId == null || scheduleId.isEmpty()) {
        Log.e(LOG_TAG, "scheduleId cannot be null or empty");
        return null;
    }

    final ArrayBlockingQueue<String> q = new ArrayBlockingQueue<>(1);
    final FutureTask<String> ret = new FutureTask<>(new Callable<String>() {
        public String call() {
            try {
                return q.take();
            } catch (InterruptedException e) {
                Log.e(LOG_TAG, Log.getStackTraceString(e));
            }
            return null;
        }
    });

    Session.whenUserIdIsReadyRun(new Session.SessionRunnable() {
        @Override
        public void run(Session session) {
            HashMap<String, Object> payload = new HashMap<>();
            payload.put("id", scheduleId);

            new Request("/me/cancel_local_notify.json", payload, session) {
                @Override
                protected void done(int responseCode, String responseBody) {
                    try {
                        JSONObject response = new JSONObject(responseBody);
                        if (response.getString("status").equals("ok")) {
                            q.offer(response.getJSONObject("event").getString("id"));
                        } else {
                            q.offer("");
                        }
                    } catch (Exception ignored) {
                        q.offer("");
                    }
                    ret.run();
                }
            }.run();
        }
    });

    return ret;
}

From source file:org.catrobat.catroid.ui.dialogs.NewSpriteDialog.java

private boolean handleOkButton() {
    EditText editText = (EditText) dialogView.findViewById(R.id.dialog_new_object_name_edit_text);
    String newSpriteName;//from  w  w w . j av  a 2 s .c  o  m
    if (editText.length() == 0) {
        newSpriteName = editText.getHint().toString();
    } else {
        newSpriteName = editText.getText().toString().trim();
    }
    if (newSpriteName.contains(".")) {
        int fileExtensionPosition = newSpriteName.indexOf('.');
        newSpriteName = newSpriteName.substring(0, fileExtensionPosition);
    }

    ProjectManager projectManager = ProjectManager.getInstance();

    if (newSpriteName.equalsIgnoreCase("")) {
        Utils.showErrorDialog(getActivity(), R.string.no_name, R.string.no_spritename_entered);
        return false;
    }

    if (projectManager.spriteExists(newSpriteName)) {
        Utils.showErrorDialog(getActivity(), R.string.name_exists, R.string.spritename_already_exists);
        return false;
    }

    Sprite sprite = new Sprite(newSpriteName);
    projectManager.addSprite(sprite);

    LookData lookData;
    try {
        File newLookFile = StorageHandler.getInstance().copyImage(projectManager.getCurrentProject().getName(),
                lookUri.getPath(), null);
        if (lookUri.getPath().contains(Constants.TMP_LOOKS_PATH)) {
            File oldFile = new File(lookUri.getPath());
            oldFile.delete();
        }
        String imageFileName = newLookFile.getName();
        Utils.rewriteImageFileForStage(getActivity(), newLookFile);

        lookData = new LookData();
        lookData.setLookFilename(imageFileName);
        lookData.setLookName(newSpriteName);
    } catch (IOException ioException) {
        Utils.showErrorDialog(getActivity(), R.string.error_load_image);
        Log.e(TAG, Log.getStackTraceString(ioException));
        return false;
    } catch (NullPointerException e) {
        Utils.showErrorDialog(getActivity(), R.string.error_load_image);
        Log.e(TAG, "somebody might have selected an image and deleted it before it was added");
        Log.e(TAG, Log.getStackTraceString(e));
        return false;
    }

    sprite.getLookDataList().add(lookData);

    if (requestedAction == ActionAfterFinished.ACTION_UPDATE_SPINNER && spinnerAdapter != null) {
        Intent broadcastIntent;
        broadcastIntent = new Intent(ScriptActivity.ACTION_BRICK_LIST_CHANGED);
        getActivity().sendBroadcast(broadcastIntent);
        spinnerAdapter.refreshSpinnerAfterNewSprite(getActivity(), newSpriteName);
    } else {
        Intent broadcastIntent;
        broadcastIntent = new Intent(ScriptActivity.ACTION_SPRITES_LIST_CHANGED);
        getActivity().sendBroadcast(broadcastIntent);
    }

    if (requestedAction == ActionAfterFinished.ACTION_FORWARD_TO_NEW_OBJECT) {
        projectManager.setCurrentSprite(sprite);

        Intent intent = new Intent(getActivity(), ProgramMenuActivity.class);
        intent.putExtra(ProgramMenuActivity.FORWARD_TO_SCRIPT_ACTIVITY, ScriptActivity.FRAGMENT_SCRIPTS);
        startActivity(intent);
    }
    dismiss();
    return true;
}

From source file:com.huison.DriverAssistant_Web.util.LoginHelper.java

public static void register(final BaseActivity activity, final String username, final String phone,
        final String password, final String tjrphone, final String yzm) {
    UmengEventSender.sendEvent(activity, UmengEventTypes.register);
    final ProgressDialog pd = new ProgressDialog(activity);
    pd.setMessage("...");
    pd.setCanceledOnTouchOutside(false);
    pd.setCancelable(false);//ww  w.  j  av a 2 s .c  o m
    pd.show();
    /*
     * Map<String, String> map = new HashMap<String, String>();
     * map.put("sessionkey", BaseActivity.getSESSIONKEY());
     * map.put("userid", username); map.put("mob", phone);
     * map.put("passwork", password); map.put("version",
     * activity.getVersionName()); map.put("imei",
     * DeviceUniqueIdentifier.getIMEIorMEID(activity)); map.put("imsi",
     * DeviceUniqueIdentifier.getIMSI(activity)); map.put("mac",
     * DeviceUniqueIdentifier.getMacAddress(activity)); map.put("channel",
     * getChannel(activity)); map.put("referee", tjrphone); map.put("Lng", ;
     * map.put("Lat", HomeActivity.gps_jdHomeActivity.gps_wd));
     * map.put("Code", yzm);
     */
    AsyncHttpClient client = activity.getAsyncHttpClient();
    RequestParams params = new RequestParams();
    /*
     * params.put("action", REGISTER_ACTION); params.put("xml",
     * BaseActivity.getXML(map));
     */
    try {
        JSONObject p = new JSONObject();
        p.put("mobile", phone);
        p.put("password", password);
        p.put("method", "register");
        p.put("version", activity.getVersionName());
        p.put("devicetype", "android");
        p.put("channel", getChannel(activity));
        p.put("imei", DeviceUniqueIdentifier.getIMEIorMEID(activity));
        p.put("imsi", "android" + DeviceUniqueIdentifier.getIMSI(activity));
        p.put("lat", Env.latitude);
        p.put("lng", Env.longitude);
        p.put("mac", DeviceUniqueIdentifier.getMacAddress(activity));
        p.put("referee", tjrphone);
        p.put("username", username);
        p.put("code", yzm);
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date curDate = new Date(System.currentTimeMillis());// 
        String time = formatter.format(curDate);
        p.put("time", time);
        Log.v("JSON", p.toString());
        String data = Util.DesJiaMi(p.toString(), "czxms520");
        params.put("data", data);
    } catch (Exception e) {
        e.printStackTrace();
    }
    client.post(BaseActivity.REQUESTURL, params, new JsonHttpResponseHandler() {
        @Override
        public void onDispatchSuccess(int statusCode, Header[] headers, String result) {
            Log.v("", "1");
            pd.dismiss();
            try {
                result = Util.decrypt(result, "czxms520");
                Log.v("JSON", result);
                JSONObject jo = new JSONObject(result);
                String code = jo.getString("code");
                /*
                 * boolean registerFlag = getJSONValueAsString(jo, "code")
                 * .equals("0");
                 */
                String msg = getJSONValueAsString(jo, "message");
                if (code.equals("0")) {
                    String data = jo.getString("data");
                    jo = new JSONObject(data);
                    /*
                     * registerFlag = getJSONValueAsString(jo, "logincode")
                     * .equals("0");
                     */
                    // msg = getJSONValueAsString(jo, "loginmessage");
                    /*
                     * String passwordMD5 = getJSONValueAsString( jo,
                     * "pass");
                     */
                    /*
                     * //  String breakRuleRemind =
                     * getJSONValueAsString( jo, "wzxx"); //  String
                     * changeLicenseRemind = getJSONValueAsString( jo,
                     * "hzxx"); //  String examineRemind =
                     * getJSONValueAsString(jo, "nsxx");
                     */
                    // vip
                    /*
                     * boolean isVip = getJSONValueAsString(jo, "Vip")
                     * .equals("true"); //  String
                     * blackPointUpdateTime = getJSONValueAsString( jo,
                     * "wzhdtime"); //  String toolUpdateTime =
                     * getJSONValueAsString( jo, "sygjtime"); // 
                     * String favorUpdateTime = getJSONValueAsString( jo,
                     * "yhtime");
                     */
                    /*
                     * boolean isVip = getJSONValueAsString(jo, "Vip")
                     * .equals("true");
                     */
                    // 
                    String loginTime = getJSONValueAsString(jo, "LastLogin");
                    // 
                    String lastLoginTime = getJSONValueAsString(jo, "LastLogin");
                    // SESSIONKEY
                    /*
                     * String sessionKey = getJSONValueAsString( jo,
                     * "sessionkey");
                     */
                    String urlHead = getJSONValueAsString(jo, "PhotoUrl");
                    String photoUrl = getJSONValueAsString(jo, "PhotoUrl");
                    String phone = getJSONValueAsString(jo, "Mobile");
                    Boolean vip = false;
                    if (String.valueOf(jo.getInt("Vip")).equals("1")) {
                        vip = true;
                    } else {
                        vip = false;
                    }
                    Log.v("VIP", String.valueOf(vip));
                    activity.markLogin(phone, phone, password, true, "", loginTime, lastLoginTime, vip);
                    if (!photoUrl.equals("")) {
                        // 
                        String finalHeadUrl = URLDecoder.decode(photoUrl, "utf-8");
                        BaseActivity.setUserHeadUrl(finalHeadUrl);
                        BaseActivity.setUserHeadDrawable(null);
                    } else {
                        BaseActivity.setUserHeadUrl("");
                        BaseActivity.setUserHeadDrawable(null);
                    }
                    try {
                        pd.dismiss();
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                    sendMsg(ConfigActivity.thiz, 0);
                    activity.finish();
                } else {
                    activity.showMessageBox(msg);
                }
            } catch (JSONException e) {
                e.printStackTrace();
                // activity.markLogout();
                // sendMsg(activity,1);
                activity.showMessageBox(activity.getText(R.string.server404));
                Log.e("register error", Log.getStackTraceString(e));
            } catch (Exception e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
                activity.showMessageBox("");
            }
        }

        @Override
        public void onFailureAnyway(int statusCode, Header[] headers, Throwable throwable,
                BaseBinaryResponse jsonResponse) {
            Log.v("C", "1");
            pd.dismiss();
            activity.showMessageBox(activity.getText(R.string.server404));
        }

        @Override
        public void onSuccessAnyway(int statusCode, Header[] headers, BaseBinaryResponse jsonResponse) {
            pd.dismiss();
            Log.v("A", "1");
        }
    });
    Log.v("B", "1");
    TimeCounter.countTime(activity, pd);
}

From source file:com.maxwen.wallpaper.board.fragments.WallpapersFragment.java

private void getWallpapers(final boolean refreshing, final boolean showNew, final boolean forceRebuild) {
    final String wallpaperUrl = getActivity().getResources().getString(R.string.wallpaper_json);
    mGetWallpapers = new AsyncTask<Void, Void, Boolean>() {

        List<Object> wallpapersUnified;
        int newAddedCount;

        @Override//  www.  j  av a  2s. com
        protected void onPreExecute() {
            super.onPreExecute();
            mProgress.setVisibility(View.VISIBLE);
            wallpapersUnified = new ArrayList<>();

            DrawMeButton popupBubble = (DrawMeButton) getActivity().findViewById(R.id.popup_bubble);
            if (popupBubble.getVisibility() == View.VISIBLE)
                popupBubble.setVisibility(View.GONE);
        }

        @Override
        protected Boolean doInBackground(Void... voids) {
            while (!isCancelled()) {
                try {
                    Thread.sleep(1);
                    Database database = new Database(getActivity());
                    if (!refreshing && database.getWallpapersCount() != 0) {
                        if (mCategoryMode) {
                            wallpapersUnified = database.getFilteredCategoriesUnified();
                        } else {
                            wallpapersUnified = database.getFilteredWallpapersUnified();
                        }
                        return true;
                    }

                    URL url = new URL(wallpaperUrl);
                    HttpURLConnection connection = (HttpURLConnection) url.openConnection();
                    connection.setConnectTimeout(15000);

                    if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {
                        InputStream stream = connection.getInputStream();
                        WallpaperJson wallpapersJson = LoganSquare.parse(stream, WallpaperJson.class);

                        if (wallpapersJson == null)
                            return false;

                        if (forceRebuild) {
                            database.deleteCategories();
                            database.deleteWallpapers();
                        }

                        List<Wallpaper> wallpapers = database.getWallpapers();
                        List<Category> categories = database.getCategories();
                        {
                            List<Wallpaper> newWallpapers = new ArrayList<>();
                            for (WallpaperJson wallpaper : wallpapersJson.getWallpapers) {
                                newWallpapers.add(new Wallpaper(0, wallpaper.name, wallpaper.author,
                                        wallpaper.thumbUrl, wallpaper.url, wallpaper.category, false, 0));
                            }

                            List<Wallpaper> intersection = (List<Wallpaper>) ListUtils.intersect(newWallpapers,
                                    wallpapers);
                            List<Wallpaper> deleted = (List<Wallpaper>) ListUtils.difference(intersection,
                                    wallpapers);
                            List<Wallpaper> newlyAdded = (List<Wallpaper>) ListUtils.difference(intersection,
                                    newWallpapers);

                            if (newlyAdded.size() != 0) {
                                // only update last update timestamp if new ones will be added
                                Preferences.getPreferences(getActivity())
                                        .setLastUpdate(System.currentTimeMillis());
                                newAddedCount = newlyAdded.size();
                            }
                            database.deleteWallpapers(deleted);
                            database.addWallpapers(newlyAdded);
                        }

                        {
                            List<Category> newCategories = new ArrayList<>();
                            for (WallpaperJson category : wallpapersJson.getCategories) {
                                newCategories.add(new Category(0, category.name, category.thumbUrl, false));
                            }
                            List<Category> intersection = (List<Category>) ListUtils.intersect(newCategories,
                                    categories);
                            List<Category> deleted = (List<Category>) ListUtils.difference(intersection,
                                    categories);
                            List<Category> newlyAdded = (List<Category>) ListUtils.difference(intersection,
                                    newCategories);
                            database.addCategories(newlyAdded);
                            database.deleteCategories(deleted);
                        }

                        if (mCategoryMode) {
                            wallpapersUnified = database.getFilteredCategoriesUnified();
                        } else {
                            wallpapersUnified = database.getFilteredWallpapersUnified();
                        }
                        return true;
                    }
                    return false;
                } catch (Exception e) {
                    LogUtil.e(Log.getStackTraceString(e));
                    return false;
                }
            }
            return false;
        }

        @Override
        protected void onPostExecute(Boolean aBoolean) {
            super.onPostExecute(aBoolean);
            mProgress.setVisibility(View.GONE);
            if (aBoolean) {
                mAdapter = new WallpapersAdapterUnified(getActivity(), wallpapersUnified, false, mCategoryMode,
                        !mCategoryMode, true);
                mRecyclerView.setAdapter(mAdapter);
                onSpanCountChanged();
                mFastScroller.setRecyclerView(mRecyclerView);
                if (showNew) {
                    showNewWallpapersFragment();
                } else {
                    if (newAddedCount != 0) {
                        ((WallpaperBoardActivity) getActivity()).showNewWallpaperBubble(newAddedCount, false);
                    }
                }
            } else {
                Toast.makeText(getActivity(), R.string.connection_failed, Toast.LENGTH_LONG).show();
            }
            mGetWallpapers = null;
        }
    }.execute();
}

From source file:com.tesobe.hello_obp.lib.OBPRestClient.java

public static JSONObject getOAuthedJson(String urlString)
        throws ExpiredAccessTokenException, ObpApiCallFailedException {

    try {/* w  ww.j  a va 2s .c  o  m*/
        HttpClient httpclient = new DefaultHttpClient();
        HttpGet request = new HttpGet(urlString);
        consumer.sign(request);
        org.apache.http.HttpResponse response = httpclient.execute(request);
        HttpEntity entity = response.getEntity();

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

        switch (statusCode) {
        case 200:
        case 201:
            return parseJsonResponse(entity);
        case 401:
            try {
                JSONObject responseJson = parseJsonResponse(entity);
                if (responseJson.optString("error").contains(consumer.getToken())) {
                    // We have an expired access token (probably?)
                    throw new ExpiredAccessTokenException();
                } else {
                    // It wasn't (probably?) an expired token error
                    Log.w(LOG_TAG, responseJson.toString());
                    throw new ObpApiCallFailedException();
                }
            } catch (JSONException e) {
                // Api response wasn't json -> unexpected
                Log.w(LOG_TAG, Log.getStackTraceString(e));
                throw new ObpApiCallFailedException();
            }
        default:
            throw new ObpApiCallFailedException();
        }
    } catch (MalformedURLException e) {
        Log.w(LOG_TAG, Log.getStackTraceString(e));
        throw new ObpApiCallFailedException();
    } catch (OAuthMessageSignerException e) {
        Log.w(LOG_TAG, Log.getStackTraceString(e));
        throw new ObpApiCallFailedException();
    } catch (OAuthExpectationFailedException e) {
        Log.w(LOG_TAG, Log.getStackTraceString(e));
        throw new ObpApiCallFailedException();
    } catch (OAuthCommunicationException e) {
        Log.w(LOG_TAG, Log.getStackTraceString(e));
        throw new ObpApiCallFailedException();
    } catch (ClientProtocolException e) {
        Log.w(LOG_TAG, Log.getStackTraceString(e));
        throw new ObpApiCallFailedException();
    } catch (IOException e) {
        Log.w(LOG_TAG, Log.getStackTraceString(e));
        throw new ObpApiCallFailedException();
    } catch (JSONException e) {
        Log.w(LOG_TAG, Log.getStackTraceString(e));
        throw new ObpApiCallFailedException();
    } catch (ObpApiCallFailedException e) {
        Log.w(LOG_TAG, Log.getStackTraceString(e));
        throw new ObpApiCallFailedException();
    }

}

From source file:net.olejon.mdapp.CalculatorsActivity.java

private void calculateWaistMeasurement() {
    EditText waistMeasurementEditText = (EditText) findViewById(R.id.calculators_waist_measurement);

    String waistMeasurementEditTextValue = waistMeasurementEditText.getText().toString();

    if (waistMeasurementEditTextValue.equals("")) {
        mTools.showToast(getString(R.string.calculators_waist_measurement_invalid_value), 1);
    } else {//from w ww . j  a  v  a 2s.co m
        try {
            int waistMeasurement = Integer.parseInt(waistMeasurementEditTextValue);

            String interpretation = "<font color=\"#4caf50\"><b>"
                    + getString(R.string.calculators_waist_measurement_men) + ": "
                    + getString(R.string.calculators_waist_measurement_normal_weight)
                    + "</b></font><br><font color=\"#4caf50\"><b>"
                    + getString(R.string.calculators_waist_measurement_women) + ": "
                    + getString(R.string.calculators_waist_measurement_normal_weight) + "</b></font>";

            if (waistMeasurement > 80 && waistMeasurement <= 88) {
                interpretation = "<font color=\"#4caf50\"><b>"
                        + getString(R.string.calculators_waist_measurement_men) + ": "
                        + getString(R.string.calculators_waist_measurement_normal_weight)
                        + "</b></font><br><font color=\"#ff9800\"><b>"
                        + getString(R.string.calculators_waist_measurement_women) + ": "
                        + getString(R.string.calculators_waist_measurement_over_weight) + "</b></font>";
            } else if (waistMeasurement > 88 && waistMeasurement <= 94) {
                interpretation = "<font color=\"#4caf50\"><b>"
                        + getString(R.string.calculators_waist_measurement_men) + ": "
                        + getString(R.string.calculators_waist_measurement_normal_weight)
                        + "</b></font><br><font color=\"#f44336\"><b>"
                        + getString(R.string.calculators_waist_measurement_women) + ": "
                        + getString(R.string.calculators_waist_measurement_obesity_weight) + "</b></font>";
            } else if (waistMeasurement > 94 && waistMeasurement <= 102) {
                interpretation = "<font color=\"#ff9800\"><b>"
                        + getString(R.string.calculators_waist_measurement_men) + ": "
                        + getString(R.string.calculators_waist_measurement_over_weight)
                        + "</b></font><br><font color=\"#f44336\"><b>"
                        + getString(R.string.calculators_waist_measurement_women) + ": "
                        + getString(R.string.calculators_waist_measurement_obesity_weight) + "</b></font>";
            } else if (waistMeasurement > 102) {
                interpretation = "<font color=\"#f44336\"><b>"
                        + getString(R.string.calculators_waist_measurement_men) + ": "
                        + getString(R.string.calculators_waist_measurement_obesity_weight)
                        + "</b></font><br><font color=\"#f44336\"><b>"
                        + getString(R.string.calculators_waist_measurement_women) + ": "
                        + getString(R.string.calculators_waist_measurement_obesity_weight) + "</b></font>";
            }

            new MaterialDialog.Builder(mContext)
                    .title(getString(R.string.calculators_waist_measurement_dialog_title))
                    .content(
                            Html.fromHtml(getString(R.string.calculators_waist_measurement_dialog_message_first)
                                    + "<br><b>" + waistMeasurementEditTextValue + " cm</b><br><br>"
                                    + getString(R.string.calculators_waist_measurement_dialog_message_second)
                                    + "<br>" + interpretation + "<br><br><small><i>"
                                    + getString(R.string.calculators_waist_measurement_dialog_message_third)
                                    + "</i></small>"))
                    .positiveText(getString(R.string.calculators_waist_measurement_dialog_positive_button))
                    .neutralText(getString(R.string.calculators_waist_measurement_dialog_neutral_button))
                    .callback(new MaterialDialog.ButtonCallback() {
                        @Override
                        public void onNeutral(MaterialDialog dialog) {
                            showInformationDialog();
                        }
                    }).contentColorRes(R.color.black).positiveColorRes(R.color.dark_blue)
                    .neutralColorRes(R.color.dark_blue).show();
        } catch (Exception e) {
            mTools.showToast(getString(R.string.calculators_waist_measurement_invalid_value), 1);

            Log.e("CalculatorsActivity", Log.getStackTraceString(e));
        }
    }
}