»Ë»Ñ Æ÷·³
°³¹ßÀÚÆ÷·³ ÀÔ´Ï´Ù.
  • ºÏ¸¶Å© ¾ÆÀÌÄÜ

¾Èµå·ÎÀÌµå ½ºÆ©µð¿À¿¡¼­ datePicker°¡ ÀÚ²Ù ´Þ·ÂÇüÅ·θ¸ ³ª¿Í¿ä1

Áö±Ý ÀÌ°Í °¡Áö°í ¸îÀÏ° °í¹ÎÀÔ´Ï´Ù.
¾î¶² ºí·Î±×¸¦ º¸°í, ¾Æ·¡¿Í °°ÀÌ ÄÚµùÀ» Çϸé....¿ø·¡ ¾Æ·¡¿Í °°ÀÌ ³ª¿Í¾ß Çϴµ¥¿ä...
  ^        ^     ^
(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()));
      }

}


1446137740_K_6.jpg

0
ÃßõÇϱ⠴ٸ¥ÀÇ°ß 0
|
°øÀ¯¹öÆ°
÷ºÎÆÄÀÏ
  • 1446137740_K_6.jpg

´Ù¸¥ÀÇ°ß 0 Ãßõ 0 »ËºÎó
  • ¾Ë¸² ¿å¼³, »óó ÁÙ ¼ö ÀÖ´Â ¾ÇÇÃÀº »ï°¡ÁÖ¼¼¿ä.
©¹æ »çÁø  
¡â ÀÌÀü±Û¡ä ´ÙÀ½±Û