---
# System prepended metadata

title: 2021.06.17（木）③④
tags: [授業ノート, AN25]

---

# 2021.06.17（木）③④
###### tags: `AN25` `授業ノート`

```java=
new TimePickerDialog(this, listener, 7, 58, false);
```
最後のfalseについて
true……24時間制
false……12時間制

時間ってまったく同じになる？
エミュレーター内のsettingsで変更せんといかん
GMTになっとるから

なるほど

BMI = 体重(kg)*（身長(m) * 身長(m))

```java=
package nhs00718.hal.ac.helloworldtest01;

import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.widget.TimePicker;
import android.app.TimePickerDialog;

import org.w3c.dom.Text;

import java.sql.Time;

public class MainActivity extends AppCompatActivity {

    private TextView aTextView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        aTextView = (TextView)findViewById(R.id.myTextView);
    }

    public void buttonMethod(View myButton){
        MyListener listener = new MyListener();
        TimePickerDialog myTPDialog = new TimePickerDialog(this, listener, 7, 58, true);
        myTPDialog.show();
    }

    public class MyListener
            implements TimePickerDialog.OnTimeSetListener{
        public void onTimeSet(TimePicker v, int hour, int min){
            aTextView.setText(String.format("Hour = %d, Minute = %d", hour, min));
        }
    }
}
```

```java=
//現在時刻取得とトーストでの表示
//xmlは一緒
package nhs00650.hal.ac.mytimepickerdialog;

import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.widget.TimePicker;
import android.app.TimePickerDialog;
import android.widget.Toast;

import java.util.Calendar;

import org.w3c.dom.Text;

import java.sql.Time;


public class MainActivity extends AppCompatActivity {

    private TextView aTextView;
    int phour;
    int pmin;
    int shour;
    int smin;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        aTextView = (TextView)findViewById(R.id.myTextView);
    }

    public void buttonMethod(View myButton){
        MyListener listener = new MyListener();

        Calendar cal = Calendar.getInstance();

        phour = cal.get(Calendar.HOUR_OF_DAY);
        pmin = cal.get(Calendar.MINUTE);

        TimePickerDialog myTPDialog = new TimePickerDialog(this, listener, phour, pmin, false);
        myTPDialog.show();
    }

    public class MyListener
            implements TimePickerDialog.OnTimeSetListener{
        public void onTimeSet(TimePicker v, int hour, int min){
            aTextView.setText(String.format("Hour = %d, Minute = %d", hour, min));
            shour = hour;
            smin = min;
            ToastMethod();
        }
    }

    public void ToastMethod(){
        Toast myToast = Toast.makeText(this,
                shour + "時" + smin + "分にアラームをセットしました!!!" , Toast.LENGTH_LONG);
        myToast.show();
    }
}

```


<span style="color: #ff3333">aaa</span>
<span style="text-decoration: underline">aaa</span>
## 雑談 (0→やまぴ 1→みや 2→やすい 3→りょうくん 4→アミカ)
:fire:
:fire_engine:
:female-firefighter: 
:male-firefighter: 
:fireworks: :fireworks: :game_die: :fireworks: :fireworks: 
:badminton_racquet_and_shuttlecock: 





久しぶりにANきた
たいしたことしてないよ
わら
