日付を取得できるようにしました
This commit is contained in:
parent
87c5af9f01
commit
8a7ab0b7a1
|
@ -6,6 +6,7 @@ import androidx.core.app.ActivityCompat;
|
|||
import androidx.core.app.NotificationCompat;
|
||||
import androidx.core.app.NotificationManagerCompat;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
|
@ -17,6 +18,9 @@ import android.os.Vibrator;
|
|||
|
||||
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -25,6 +29,13 @@ public class MainActivity extends AppCompatActivity {
|
|||
BluetoothManager bluetoothManager;
|
||||
BluetoothAdapter bluetoothAdapter;
|
||||
|
||||
//↓日付を取得するやつ
|
||||
public static String getNowDate() {
|
||||
@SuppressLint("SimpleDateFormat") final DateFormat df = new SimpleDateFormat("yyy/MM/dd HH:mm:ss");
|
||||
final Date date = new Date(System.currentTimeMillis());
|
||||
return df.format(date);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
|
Loading…
Reference in New Issue
Block a user