Advertisement
yayachadazt

android

Sep 29th, 2014
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.25 KB | None | 0 0
  1. try {
  2. if (hargabaru.getText().equals("")) {
  3. AlertDialog.Builder alertDialog = new AlertDialog.Builder(wom.this);
  4.  
  5. // Setting Judul Dialog
  6. alertDialog.setTitle("Warning");
  7.  
  8. // Setting Pesan Dialog
  9. alertDialog.setMessage("DP Belum Di Isi");
  10.  
  11. // Setting icon untuk Dialog
  12.  
  13. // Setting tombol OK
  14. alertDialog.setNeutralButton("OK",
  15. new DialogInterface.OnClickListener() {
  16.  
  17. public void onClick(DialogInterface dialog,
  18. int which) {
  19. // Menulis code dibawah ini akan di eksekusi
  20. // setelah Dialog keluar
  21.  
  22. }
  23. });
  24.  
  25. alertDialog.show();
  26.  
  27. }else if(uangmuka.getText().equals("")) {
  28.  
  29. AlertDialog.Builder alertDialog = new AlertDialog.Builder(wom.this);
  30.  
  31. // Setting Judul Dialog
  32. alertDialog.setTitle("Warning");
  33.  
  34. // Setting Pesan Dialog
  35. alertDialog.setMessage("Harga Belum Di Isi");
  36.  
  37. // Setting icon untuk Dialog
  38.  
  39. // Setting tombol OK
  40. alertDialog.setNeutralButton("OK",
  41. new DialogInterface.OnClickListener() {
  42.  
  43. public void onClick(DialogInterface dialog,
  44. int which) {
  45. // Menulis code dibawah ini akan di eksekusi
  46. // setelah Dialog keluar
  47.  
  48. }
  49. });
  50.  
  51. alertDialog.show();
  52.  
  53. } else{
  54. Double hrg,dp,bnga,bln,asuransi;
  55. hrg = Double.parseDouble(hargabaru.getText().toString());
  56. dp = Double.parseDouble(uangmuka.getText().toString());
  57. bnga = Double.parseDouble(text1.getText().toString());
  58. bln = Double.parseDouble(bulan1.getText().toString());
  59. asuransi = Double.parseDouble(asuransi1.getText().toString());
  60. if (hrg < dp) {
  61. AlertDialog.Builder alertDialog = new AlertDialog.Builder(
  62. wom.this);
  63.  
  64. // Setting Judul Dialog
  65. alertDialog.setTitle("Warning");
  66.  
  67. // Setting Pesan Dialog
  68. alertDialog.setMessage("Uang Muka Lebih Besar Dari Harga");
  69.  
  70. // Setting icon untuk Dialog
  71.  
  72. // Setting tombol OK
  73. alertDialog.setNeutralButton("OK",
  74. new DialogInterface.OnClickListener() {
  75.  
  76. public void onClick(DialogInterface dialog,
  77. int which) {
  78. // Menulis code dibawah ini akan di eksekusi
  79. // setelah Dialog keluar
  80. uangmuka.setText("");
  81. hargabaru.setText("");
  82. }
  83. });
  84.  
  85. alertDialog.show();
  86.  
  87. } else {
  88. Double dpnet = dp - 250000 - (asuransi * hrg);
  89. Double pokok_hutang = hrg - dpnet;
  90. Double bunga_angsuran = pokok_hutang * bnga;
  91. Double angsuran = (pokok_hutang + bunga_angsuran)/bln;
  92. DecimalFormat df = new DecimalFormat("@@##");
  93. hasil2.setText("Rp." + df.format(angsuran) + ",00");
  94. }
  95. }
  96. } catch (Exception e) {
  97. AlertDialog.Builder alertDialog = new AlertDialog.Builder(wom.this);
  98.  
  99. // Setting Judul Dialog
  100. alertDialog.setTitle("Warning");
  101.  
  102. // Setting Pesan Dialog
  103. e.printStackTrace();
  104. alertDialog.setMessage(e.toString());
  105.  
  106. // Setting icon untuk Dialog
  107.  
  108. // Setting tombol OK
  109. alertDialog.setNeutralButton("OK",
  110. new DialogInterface.OnClickListener() {
  111.  
  112. public void onClick(DialogInterface dialog, int which) {
  113. // Menulis code dibawah ini akan di eksekusi setelah
  114. // Dialog keluar
  115.  
  116. }
  117. });
  118.  
  119. alertDialog.show();
  120. }
  121.  
  122. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement