Sunday, April 11, 2010

Where Can Found The Legendary Pokemon?

class androids - the first exercise done in class in class Task

Si crei un programma di tipo android che mi indichi l'orario che si ha in quel momento.



package com.natalizi.android.Now;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import java.util.Date;

public class Now extends Activity implements View.OnClickListener
{
/** Called when the activity is first created. */
Button btn;
@Override
public void onCreate(Bundle icicle)
{
super.onCreate(icicle);
btn=new Button(this);
btn.setOnClickListener(this);
updateTime();
setContentView(btn);
}
public void onClick(View view){
updateTime();
} Private void
updatetime () {
btn.setText (new Date (). ToLocaleString ());}


}

0 comments:

Post a Comment