Advertisement
Guest User

Untitled

a guest
Oct 1st, 2014
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. package com.example.currencyconverter;
  2.  
  3. import android.support.v7.app.ActionBarActivity;
  4. import android.os.Bundle;
  5. import android.view.Menu;
  6. import android.view.MenuItem;
  7. import android.view.View;
  8. import android.widget.EditText;
  9. import android.widget.TextView;
  10.  
  11. public class MainActivity extends ActionBarActivity {
  12.  
  13. @Override
  14. protected void onCreate(Bundle savedInstanceState) {
  15. super.onCreate(savedInstanceState);
  16. setContentView(R.layout.activity_main);
  17. }
  18. public void convert(View v){
  19. EditText num1text=(EditText)findViewById(R.id.nummer1);
  20. Float numm1=Float.parseFloat(num1text.getText().toString());
  21. Float ans=numm1*127/100;
  22.  
  23. TextView antwoord=(TextView)findViewById(R.id.uitkomst);
  24. antwoord.setText(ans.toString());
  25. }
  26.  
  27. @Override
  28. public boolean onCreateOptionsMenu(Menu menu) {
  29. // Inflate the menu; this adds items to the action bar if it is present.
  30. getMenuInflater().inflate(R.menu.main, menu);
  31. return true;
  32. }
  33.  
  34. @Override
  35. public boolean onOptionsItemSelected(MenuItem item) {
  36. // Handle action bar item clicks here. The action bar will
  37. // automatically handle clicks on the Home/Up button, so long
  38. // as you specify a parent activity in AndroidManifest.xml.
  39. int id = item.getItemId();
  40. if (id == R.id.action_settings) {
  41. return true;
  42. }
  43. return super.onOptionsItemSelected(item);
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement