Áö±Ý ÀÌ°Í °¡Áö°í ¸îÀÏ° °í¹ÎÀÔ´Ï´Ù.
¾î¶² ºí·Î±×¸¦ º¸°í, ¾Æ·¡¿Í °°ÀÌ ÄÚµùÀ» Çϸé....¿ø·¡ ¾Æ·¡¿Í °°ÀÌ ³ª¿Í¾ß Çϴµ¥¿ä...
^ ^ ^
(2004) (11) (34)
V V V
Àú´Â ±×³É ´Þ·ÂÀÌ ³ª¿Í¼ ´Þ·Â¿¡¼ ³¯Â¥¸¦ ¼±ÅÃÇÏ°Ô²û ³ª¿Í¹ö·Á¿ä.....
²À ºÎŹµå¸³´Ï´Ù.
<÷ºÎÆÄÀÏó·³ ³ª¿ÔÀ¸¸é Çϴµ¥ ÃÖÁ¾ ¸ñÇ¥ÀÔ´Ï´Ù>
--------------------------------------------------------------------
package mk.myapplication;
import java.text.DateFormat;
import java.util.Calendar;
import android.app.Activity;
import android.app.DatePickerDialog;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.TextView;
public class MainActivity extends Activity {
DateFormat fmDateAndTime = DateFormat.getDateTimeInstance();
TextView dateAndtimeLabel;
Calendar dateAndTime=Calendar.getInstance();
DatePickerDialog.OnDateSetListener d = new DatePickerDialog.OnDateSetListener()
{
@Override
public void onDateSet(DatePicker view, int year, int monthofYear,int dayOfMonth)
{
dateAndTime.set(Calendar.YEAR, year);
dateAndTime.set(Calendar.MONTH,monthofYear);
dateAndTime.set(Calendar.DAY_OF_MONTH, dayOfMonth);
updateLabel();
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button btn = (Button)findViewById(R.id.dateBtn);
btn.setOnClickListener(new View.OnClickListener()
{
public void onClick(View V)
{
new DatePickerDialog(MainActivity.this,d,dateAndTime.get(Calendar.YEAR),
dateAndTime.get(Calendar.MONTH),
dateAndTime.get(Calendar.DAY_OF_MONTH)).show();
}
} );
dateAndtimeLabel = (TextView)findViewById(R.id.dateAndtime);
updateLabel();
}
private void updateLabel()
{
dateAndtimeLabel.setText(fmDateAndTime.format(dateAndTime.getTime()));
}
}
| |
|
datepicker¿¡¼
android:id=\"@+id/date\"
android:layout_width=\"wrap_content\"
android:layout_height=\"wrap_content\"
android:calendarviewshown=\"false\"
android:spinnersshown=\"true\">