This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

If(Static && Non-static value){

Hi. I'm working with nrf Temp, in the file TemperatureDataParser.java, and I want to send out a note when the measured temperature has passed the chosen SETTING(distinguishing between low, medium and high temperature). I Therefore wrote an if-sentence "If(Setting && temperatureAboveWantedValueForThatSetting)"

The case looks like this:

case TEMPERATURE_SERVICE_UUID:

final double temp = decodeTempLevel(data, i + 3);
td.setTemp(temp);
if (temp < 7000 && SensorsActivity.SETTING==0){
	SensorsActivity.postNotification("Insert note here");
}
break;

SETTING is the array-value for the user-chosen variable in a drop-down menu, and is declared in the class Sensoractivity:

    final Spinner userInputSpinner = (Spinner) findViewById(R.id.spinner);
public final  int TYPE = Integer.parseInt(userInputSpinner.getSelectedItem().toString());

The problem consists of TemperatureDataParser.java and all the values declared in it, being of the type static, while TYPE is a non-static (because it can be changed by the user). Any idea how to solve this? Anything that needs more explaining?

Related