Temperature

Android platform 2.3.3

program ini dibuat karena ada tugas akhir dari matakuliah socket .. apa hubungan nya ini socket dengan android coba di pikir sekarang aplikasi client-server ujian nya konversi suhu ,, hahah lucu banget kampus tercinta ku ..


package com.ujian.socket;
 import android.app.Activity;
 import android.os.Bundle;
 import android.view.View;
 import android.widget.Button;
 import android.widget.EditText;

public class Main extends Activity implements android.view.View.OnClickListener {

Button k, f, r, d, n;

EditText input1;
 EditText input2;
 int operator;
 double a, b;

/** Called when the activity is first created. */<a class="zem_slink" title="Annotation" href="http://en.wikipedia.org/wiki/Annotation" target="_blank" rel="wikipedia">
</a>@Override
 public void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.main);
 input1 = (EditText) findViewById(R.id.editText1);
 k = (Button) findViewById(R.id.button1);
 f = (Button) findViewById(R.id.button2);
 r = (Button) findViewById(R.id.button3);
 d = (Button) findViewById(R.id.button4);
 n = (Button) findViewById(R.id.button5);

input2 = (EditText) findViewById(R.id.editText2);

k.setOnClickListener(this);
 f.setOnClickListener(this);
 r.setOnClickListener(this);
 d.setOnClickListener(this);
 n.setOnClickListener(this);

}

public void onClick(View v) {
 // TODO Auto-generated method stub
 switch (v.getId()) {

case R.id.button1:
 a = Double.parseDouble(input1.getText().toString());

operator = 1;

if (operator == 1) {
 input2.setText(Double.toString(a + 60));
 }

break;
 case R.id.button2:
 a = Double.parseDouble(input1.getText().toString());
 clear();
 operator = 2;
 if (operator == 2) {
 input2.setText(Double.toString(a - 70));
 }

break;
 case R.id.button3:
 a = Double.parseDouble(input1.getText().toString());
 clear();
 operator = 3;
 if (operator == 3) {
 input2.setText(Double.toString(a * 90));
 }

break;
 case R.id.button4:
 a = Double.parseDouble(input1.getText().toString());
 clear();
 operator = 4;
 if (operator == 4) {
 input2.setText(Double.toString(a / 23));
 }

break;
 case R.id.button5:
 a = Double.parseDouble(input1.getText().toString());
 clear();
 operator = 5;
 if (operator == 5) {
 input2.setText(Double.toString(a * 23));
 }

break;

default:
 break;
 }

}
 public void clear(){

input2.setText("");
 }
 }

untuk lebih jelas silahakn Download

Diterbitkan oleh

Taken

i need somebody for help me to make anything what i need

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s