WEB开发网
开发学院手机开发Android 开发 开发实例:Android 身高计算器的实现 阅读

开发实例:Android 身高计算器的实现

 2010-05-24 00:03:00 来源:WEB开发网   
核心提示:package app.test;import android.app.Activity;import android.app.AlertDialog;import android.app.AlertDialog.Builder;import android.os.Bundle;import android.view.

package app.test;

import android.app.Activity;

import android.app.AlertDialog;

import android.app.AlertDialog.Builder;

import android.os.Bundle;

import android.view.View;

import android.widget.*;

import android.content.DialogInterface;

import android.content.Intent;

import android.graphics.Color;

public class test extends Activity

{

/** Called when the activity is first created. */

private Button mButton;

private EditText fEeditText;

private EditText mEeditText;

private RadioGroup mRadioGroup;

private double fheight;

private double mheight;

private String Sex;

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.main);

mButton=(Button)findViewById(R.id.confirm);

fEeditText=(EditText)findViewById(R.id.fheigt);

mEeditText=(EditText)findViewById(R.id.mheigt);

mButton.setOnClickListener(new Button.OnClickListener()

{

@Override

public void onClick(View v)

{

// TODO Auto-generated method stub

if(fEeditText.getText().toString().length()< 1)

{

Builder adia=new AlertDialog.Builder(test.this);

adia.setMessage("请?入父亲的身高");

adia.setTitle("提示");

adia.setNeutralButton("确定", new DialogInterface.OnClickListener() {

@Override

public void onClick(DialogInterface dialog, int which) {

// TODO Auto-generated method stub

fEeditText.setHighlightColor(Color.RED);

}

});

1 2 3 4 5  下一页

Tags:开发实例 Android 身高

编辑录入:coldstar [复制链接] [打 印]
赞助商链接