當前位置: 首頁>>代碼示例>>Java>>正文


Java BatteryManager.BATTERY_HEALTH_UNKNOWN屬性代碼示例

本文整理匯總了Java中android.os.BatteryManager.BATTERY_HEALTH_UNKNOWN屬性的典型用法代碼示例。如果您正苦於以下問題:Java BatteryManager.BATTERY_HEALTH_UNKNOWN屬性的具體用法?Java BatteryManager.BATTERY_HEALTH_UNKNOWN怎麽用?Java BatteryManager.BATTERY_HEALTH_UNKNOWN使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在android.os.BatteryManager的用法示例。


在下文中一共展示了BatteryManager.BATTERY_HEALTH_UNKNOWN屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: translateBatteryHealth

public static String translateBatteryHealth(int batteryHealth) {
    switch (batteryHealth) {
        case BatteryManager.BATTERY_HEALTH_UNKNOWN:
            return "UNKNOWN HEALTH";
        case BatteryManager.BATTERY_HEALTH_GOOD:
            return "GOOD";
        case BatteryManager.BATTERY_HEALTH_OVERHEAT:
            return "OVERHEAT";
        case BatteryManager.BATTERY_HEALTH_DEAD:
            return "DEAD";
        case BatteryManager.BATTERY_HEALTH_OVER_VOLTAGE:
            return "OVER VOLTAGE";
        case BatteryManager.BATTERY_HEALTH_UNSPECIFIED_FAILURE:
            return "UNSPECIFIED FAILURE";
        case BatteryManager.BATTERY_HEALTH_COLD:
            return "COLD";
        default:
            return "UNKNOWN (" + batteryHealth + ")";
    }
}
 
開發者ID:patrickfav,項目名稱:under-the-hood,代碼行數:20,代碼來源:TypeTranslators.java

示例2: getHealthStatus

public String getHealthStatus() {
    String status = "";
    switch (mHealth) {
        case BatteryManager.BATTERY_HEALTH_UNKNOWN:
            status = "Unknown";
            break;
        case BatteryManager.BATTERY_HEALTH_GOOD:
            status = "Good";
            break;
        case BatteryManager.BATTERY_HEALTH_OVERHEAT:
            status = "Overheat";
            break;
        case BatteryManager.BATTERY_HEALTH_DEAD:
            status = "Dead";
            break;
        case BatteryManager.BATTERY_HEALTH_OVER_VOLTAGE:
            status = "Over Voltage";
            break;
        case BatteryManager.BATTERY_HEALTH_UNSPECIFIED_FAILURE:
            status = "Unspecified Failure";
            break;
    }

    return status;
}
 
開發者ID:greenhub-project,項目名稱:batteryhub,代碼行數:25,代碼來源:DataEstimator.java

示例3: setHealth

private void setHealth(int healthValue) {
    String health;

    switch (healthValue) {
        case BatteryManager.BATTERY_HEALTH_GOOD:
            health = getString(R.string.battery_health_good);
            break;
        case BatteryManager.BATTERY_HEALTH_DEAD:
            health = getString(R.string.battery_health_dead);
            break;
        case BatteryManager.BATTERY_HEALTH_COLD:
            health = getString(R.string.battery_health_cold);
            break;
        case BatteryManager.BATTERY_HEALTH_OVERHEAT:
            health = getString(R.string.battery_health_overheat);
            break;
        case BatteryManager.BATTERY_HEALTH_OVER_VOLTAGE:
            health = getString(R.string.battery_health_over_voltage);
            break;
        case BatteryManager.BATTERY_HEALTH_UNSPECIFIED_FAILURE:
            health = getString(R.string.battery_health_unspecified);
            break;
        case BatteryManager.BATTERY_HEALTH_UNKNOWN:
        default:
            health = getString(R.string.battery_health_unknown);
    }

    mViewHealth.setValue(health);
    mBatteryInfo.setHealth(health);
}
 
開發者ID:Smart-Studio,項目名稱:device-info,代碼行數:30,代碼來源:BatteryViewImpl.java

示例4: getBatteryHealth

public String getBatteryHealth() {
    String health = BATTERY_HEALTH_UNKNOWN;
    Intent intent = getBatteryStatusIntent();
    int status = intent.getIntExtra(BatteryManager.EXTRA_HEALTH, 0);
    switch (status) {
        case BatteryManager.BATTERY_HEALTH_COLD:
            health = BATTERY_HEALTH_COLD;
            break;

        case BatteryManager.BATTERY_HEALTH_DEAD:
            health = BATTERY_HEALTH_DEAD;
            break;

        case BatteryManager.BATTERY_HEALTH_GOOD:
            health = BATTERY_HEALTH_GOOD;
            break;

        case BatteryManager.BATTERY_HEALTH_OVERHEAT:
            health = BATTERY_HEALTH_OVERHEAT;
            break;

        case BatteryManager.BATTERY_HEALTH_OVER_VOLTAGE:
            health = BATTERY_HEALTH_OVER_VOLTAGE;
            break;

        case BatteryManager.BATTERY_HEALTH_UNKNOWN:
            health = BATTERY_HEALTH_UNKNOWN;
            break;

        case BatteryManager.BATTERY_HEALTH_UNSPECIFIED_FAILURE:
            health = BATTERY_HEALTH_UNSPECIFIED_FAILURE;
            break;
    }
    return health;
}
 
開發者ID:anitaa1990,項目名稱:DeviceInfo-Sample,代碼行數:35,代碼來源:DeviceInfo.java

示例5: getHealth

/**
 * Method to resolve the battery health
 */
private void getHealth() {
    if (DEBUG) {
        MyLog.i(CLS_NAME, "getHealth");
    }

    if (batteryIntent != null) {

        final SaiyResources sr = new SaiyResources(mContext, sl);

        final int health = batteryIntent.getIntExtra(BatteryManager.EXTRA_HEALTH,
                BatteryManager.BATTERY_HEALTH_UNKNOWN);

        switch (health) {

            case BatteryManager.BATTERY_HEALTH_COLD:
                setHealthResponse(sr.getString(ai.saiy.android.R.string.cold));
                break;
            case BatteryManager.BATTERY_HEALTH_DEAD:
                setHealthResponse(sr.getString(ai.saiy.android.R.string.dead));
                break;
            case BatteryManager.BATTERY_HEALTH_GOOD:
                setHealthResponse(sr.getString(ai.saiy.android.R.string.good));
                break;
            case BatteryManager.BATTERY_HEALTH_OVERHEAT:
                setHealthResponse(sr.getString(ai.saiy.android.R.string.over_heating));
                break;
            case BatteryManager.BATTERY_HEALTH_OVER_VOLTAGE:
                setHealthResponse(sr.getString(ai.saiy.android.R.string.over_voltage));
                break;
            case BatteryManager.BATTERY_HEALTH_UNKNOWN:
                setHealthResponse(sr.getString(ai.saiy.android.R.string.currently_indeterminable));
                break;
            case BatteryManager.BATTERY_HEALTH_UNSPECIFIED_FAILURE:
                setHealthResponse(sr.getString(ai.saiy.android.R.string.currently_indeterminable));
                break;
            default:
                setHealthResponse(sr.getString(ai.saiy.android.R.string.currently_indeterminable));
                break;
        }

        sr.reset();

    } else {
        if (DEBUG) {
            MyLog.w(CLS_NAME, "batteryIntent: null");
        }
        setAccessFailure();
    }
}
 
開發者ID:brandall76,項目名稱:Saiy-PS,代碼行數:52,代碼來源:BatteryInformation.java


注:本文中的android.os.BatteryManager.BATTERY_HEALTH_UNKNOWN屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。