Tableau en java pour android
daemonkill
Messages postés
7
Date d'inscription
Statut
Membre
Dernière intervention
-
daemonkill Messages postés 7 Date d'inscription Statut Membre Dernière intervention -
daemonkill Messages postés 7 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
J'essaye de faire une application android(une calculette), j'ai fait des layouts xml pour chaque button. Puis je déclare un tableau ou je lui reli mes boutons.
Je vous montre le code ce sera plus simple ==
L'application compile mais ne marche pas sous android.
Merci de votre aide
J'essaye de faire une application android(une calculette), j'ai fait des layouts xml pour chaque button. Puis je déclare un tableau ou je lui reli mes boutons.
Je vous montre le code ce sera plus simple ==
package com.example.calc.tata;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.widget.Button;
import android.widget.EditText;
public class MainActivity extends Activity {
EditText ecran;
Button button[];
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
button[0] = (Button) findViewById(R.id.button0);
button[1] = (Button) findViewById(R.id.button1);
button[2] = (Button) findViewById(R.id.button2);
button[3] = (Button) findViewById(R.id.button3);
button[4] = (Button) findViewById(R.id.button4);
button[5] = (Button) findViewById(R.id.button5);
button[6] = (Button) findViewById(R.id.button6);
button[7] = (Button) findViewById(R.id.button7);
button[8] = (Button) findViewById(R.id.button8);
button[9] = (Button) findViewById(R.id.button9);
button[10] = (Button) findViewById(R.id.buttonPlus);
button[11] = (Button) findViewById(R.id.buttonMoins);
button[12] = (Button) findViewById(R.id.buttonMultiplier);
button[13] = (Button) findViewById(R.id.buttonDivision);
button[14] = (Button) findViewById(R.id.button10);
button[15] = (Button) findViewById(R.id.buttonPoint);
button[16] = (Button) findViewById(R.id.buttonC);
ecran = (EditText) findViewById(R.id.editText01);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
L'application compile mais ne marche pas sous android.
Merci de votre aide
A voir également:
- Tableau en java pour android
- Jeux java itel touche - Télécharger - Jeux vidéo
- Tableau word - Guide
- Android recovery - Guide
- Waptrick java football - Télécharger - Jeux vidéo
- Trier un tableau excel - Guide