webapp @ ウィキ
andoroidstudio2
最終更新:
webapp
-
view
/EditTextを取得
EditText input1 = (EditText) findViewById(R.id.input1);
EditText input2 = (EditText) findViewById(R.id.input2);
EditText input1 = (EditText) findViewById(R.id.input1);
EditText input2 = (EditText) findViewById(R.id.input2);
/文字列の取得方法
/入力した値をStringで取得
String hei = input1.getText().toString().trim();
String wei = input2.getText().toString().trim();
/入力した値をStringで取得
String hei = input1.getText().toString().trim();
String wei = input2.getText().toString().trim();
/TextViewの取得
TextView tv = (TextView) findViewById(R.id.height2);//R.id.(部品のid)
tv.setText(String.valueOf(height));//Int型をString型へ変換して表示
TextView tv = (TextView) findViewById(R.id.height2);//R.id.(部品のid)
tv.setText(String.valueOf(height));//Int型をString型へ変換して表示
TextView tv3 = (TextView) findViewById(R.id.bmi4);
tv3.setText("判定:" + bmi_han[1]);//複合した表示方法
tv3.setText("判定:" + bmi_han[1]);//複合した表示方法
TextView scLabel = findViewById(R.id.score);
TextView highscLabel = findViewById(R.id.highscore);
int score = getIntent().getIntExtra(EXTRA_SCORE, 0);
scLabel.setText(score + "");// +””とすれば、文字列を簡単に表示できる
TextView highscLabel = findViewById(R.id.highscore);
int score = getIntent().getIntExtra(EXTRA_SCORE, 0);
scLabel.setText(score + "");// +””とすれば、文字列を簡単に表示できる