ImageView Invisible/Visible

J'ai cette imageView que je veux être Invisible au premier abord...
Puis quand je clique sur un bouton (calculateButton), l'imageView sera Visible.

Voici mon ImageView:

<ImageView
     android:id="@+id/imageView1"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:layout_alignRight="@+id/resultLabel"
     android:layout_below="@+id/resultLabel"
     android:src="@drawable/image" />

Et voici mon code pour le calculateButton:

     public void calculateClickHandler(View view) {
if (view.getId() == R.id.calculateButton) {
EditText weightText = (EditText) findViewById(R.id.weightText);
EditText heightText = (EditText)findViewById(R.id.heightText);
TextView resultText = (TextView)findViewById(R.id.resultLabel);
int weight = (int) Float.parseFloat(weightText.getText().toString());
int height = (int) Float.parseFloat(heightText.getText().toString());
int bmiValue = calculateBMI(weight, height);
String bmiInterpretation = interpretBMI(bmiValue);
resultText.setText("Your BMI is:" + " " + bmiValue  + " " +  bmiInterpretation); }
}
private int calculateBMI (int weight, int height) {
return (int)  weight * 703 / (height * height) ;
}
private String interpretBMI(int bmiValue) {
if (bmiValue <= 16.0 && bmiValue <= 18.5) {
return "Underweight";   
} else if (bmiValue > 18.5 && bmiValue <= 25 ){
return "Normal (Healthy)";
} else if (bmiValue > 25 && bmiValue <= 30  ) {
return "Overweight";
} else {
return "Obese"; }
}
}
  • ensuite utilisés imageview.setVisibility(View.VISIBLE); et imageview.setVisibility(View.INVISIBLE);
  • je vous remercie beaucoup pour l'aide.
InformationsquelleAutor Deloy | 2014-03-03