私はプログラミングにかなり慣れていないので、Androidデバイス用のアプリを作成する方法を独学しようとしていました. 現在、公式の Android 開発者 Web サイトの元のユーザー ガイドを使用しています。ユーザーから整数入力を取得しようとしていますが、ボタンをクリックすると、数値に .1 * (2 番目のユーザー編集テキスト ボックスから取得した数値) が乗算されます。たとえば、ユーザーは最初のテキスト ボックスに 100 を入力し、2 番目のテキスト ボックスに 10 を入力します。3 番目のテキスト ボックスの結果は 10/100*100 となり、これは 10 になります。結果が 3 番目のテキスト ボックスに表示されるようにします。
ここに私がこれまでに持っているコードがあります
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.NavUtils;
import android.view.MenuItem;
import android.view.View;
import android.widget.EditText;
public class FirstActivity extends Activity {
public final static String EXTRA_MESSAGE = "com.example.discountpricecalculator.MESSAGE";
@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_first);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
getActionBar().setDisplayHomeAsUpEnabled(true);
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
// This ID represents the Home or Up button. In the case of this
// activity, the Up button is shown. Use NavUtils to allow users
// to navigate up one level in the application structure. For
// more details, see the Navigation pattern on Android Design:
//
// http://developer.android.com/design/patterns/navigation.html#up-vs-back
//
NavUtils.navigateUpFromSameTask(this);
return true;
}
return super.onOptionsItemSelected(item);
}
public void sendMessage(View view) {
//Do something in response to button
}
}