Android

1. 예제 (1) OneWeekSecondEx1 class MainActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { OneWeekSecondEx1Theme { // A surface container using the 'background' color from the theme Surface( modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background ) { } } } } } @Composable fun LikeButton(){ But..
1. 예제 (1) OneWeekFirstEx1 class MainActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { UserGuidePopupPreview() } } } @Preview @Composable fun UserGuidePopupPreview(){ UserGuidePopup() } @Composable fun UserGuidePopup(){ Row() { Button(onClick = { /*TODO*/ }, modifier = Modifier.weight(1f)) { Text(text = "취소") } Bu..
1. 구조 1. 작은 아이콘 : setSmallIcon() 2. 앱이름 : 앱 이름이 들어간다 3. 시간 : setShowWhen(false) 4. 큰 아이콘 : setLargeIcon() 5. 타이틀 : setContentTitle() 6. 메시지 : setContentText() 2. 구성 NotificationManager : 알림을 시스템에 발생시키는 SystemService Notification : 알림 구성 정보를 가지는 객체 NotificationCompat.Builder : 알림을 다양한 정보로 생성 NotificationChannel : 알림의 관리 단위(Android Oreo에서 추가) 3. 순서 NotificationManager 로 시스템서비스를 받아온다. 채널을 생성하여 해당 채..
1. Text 저장하기 Clipboard에 text를 저장한다. public static void copy(Context context, String text) { ClipboardManager clipboard = (ClipboardManager) context .getSystemService(Context.CLIPBOARD_SERVICE); clipboard.setPrimaryClip(ClipData.newPlainText(null, text)); } 2. Uri 저장하기 Clipboard에 Uri를 저장한다. Uri는 컨텐츠의 주소로 주로 사진, 동영상에 사용되는 주소이다. Uri를 가져올 때 Scoped Storage를 주의하고 Media Store를 사용하자. public static void ..
Bell91
'Android' 카테고리의 글 목록 (4 Page)