-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDietas.java
56 lines (37 loc) · 1.45 KB
/
Dietas.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package com.javierramirez.healthyapp;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.EditText;
import android.os.Bundle;
import android.widget.ImageButton;
import android.widget.RelativeLayout;
import android.widget.TextView;
public class Dietas extends AppCompatActivity {
RelativeLayout receta;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_dietas);
SharedPreferences preferences = getSharedPreferences("DatosUsuario", Context.MODE_PRIVATE); //Acceder al archivo DatosUsuario
float SuIMC = preferences.getFloat("SuIMC", 0);
receta=(RelativeLayout)findViewById(R.id.RecetaFondo);
if ((SuIMC < 18))
{
receta.setBackgroundDrawable(getResources().getDrawable(R.drawable.su));
}
else if ((SuIMC >= 18) && (SuIMC <= 24.9))
{
receta.setBackgroundDrawable(getResources().getDrawable(R.drawable.rmp1));
}
else if ((SuIMC >= 25) && (SuIMC <= 27))
{
receta.setBackgroundDrawable(getResources().getDrawable(R.drawable.bajarpeso));
}
else if ((SuIMC >= 27.1))
{
receta.setBackgroundDrawable(getResources().getDrawable(R.drawable.rbp2));
}
}
}