Android

Notifications (android developers)

  Notifications https://developer.android.com/guide/topics/ui/notifiers/notifications       Set the notification content setSmallIcon() : 작은 아이콘 (필수) setContentTitle() : 제목 setContentText() : 내용 setPriority() : 안드로이드 7.1 이하 (안드로이드 8.0 이상은 channel importance 사용) NotificationCompat.Builder builder = new NotificationCompat.Builder(this, CHANNEL_ID)         .setSmallIcon(R.drawable.notification_icon)         .setContentTitle(textTitle)         .setContentText(textContent)         .setPriority(NotificationCompat.PRIORITY_DEFAULT);   채널 ID 는 안드로이드 8.0 (API 26) 부터 필수. 그 이하는 무시된다. 내용은 1줄만 가능하다. 2줄 이상 쓰려면 setStyle() 이용. NotificationCompat.Builder builder = new NotificationCompat.Builder(this, CHANNEL_ID)         .setSmallIcon(R.drawable.notification_icon)…

Read More
Android

될 때까지 안드로이드 정리 (오준석의 생존코딩) 6

  ActionSendExam FragmentExam HttpNetworkExam        1. ActionSendExam   <EditText android:id=”@+id/message_edit” android:layout_width=”match_parent” android:layout_height=”wrap_content” android:hint=”메시지” /> <Button android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:onClick=”sendMessage” android:text=”전달하기” />   public void sendMessage(View view) { EditText messageEditText = (EditText) findViewById(R.id.message_edit); Intent intent = new Intent(Intent.ACTION_SEND); intent.setType(“text/plain”); intent.putExtra(Intent.EXTRA_TEXT, messageEditText.getText().toString()); // 처리할 수 있는 액티비티가 있으면 그 액티비티를 실행하라 if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); } }      2. FragmentExam   public class ColorFragment extends Fragment { private int mColor = Color.BLUE; private TextView mHelloTextView; public ColorFragment() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater…

Read More
Android

될 때까지 안드로이드 정리 (오준석의 생존코딩) 5 강의 자료

  될 때까지 안드로이드 1장 – 안드로이드 앱 개발 준비하기 될 때까지 안드로이드 2장 – 첫 번째 앱 만들기 될 때까지 안드로이드 3장 – 뷰와 뷰그룹 될 때까지 안드로이드 4장 – 자주 사용하는 뷰, 유용한 뷰 될 때까지 안드로이드 5장 – 화면에 뷰를 수놓는 방법 될 때까지 안드로이드 6장 – 안드로이드는 액티비티로부터 될 때까지 안드로이드 7장 – 인텐트와 인텐트 필터 될 때까지 안드로이드 8장 – 메뉴 구현하기 될 때까지 안드로이드 9장 – 웹뷰- 웹 페이지 표시하기 될 때까지 안드로이드 10장 – 화면 제약을 극복하는 방법 될 때까지 안드로이드 11장 –…

Read More
Android

안드로이드 스튜디오 도움되는 정보들 1

  Android – myLooper() vs getMainLooper() how to use postDelayed() correctly in android studio? How to use the SwipeRefreshLayout? Android sample bluetooth code to send a simple string via bluetooth How to add dividers and spaces between items in RecyclerView? Adding button action in custom notification Downloading a website to a string Android Handler Tutorial start activity with left to right mode material design FAB speed dial menu tutorial (Code with Joyce)       Android – myLooper() vs getMainLooper()   getMainLooper() – Returns the application’s main looper, which lives…

Read More
Android

Android Developers

    Create a List with RecyclerView     Create swipe views with tabs using ViewPager2 https://developer.android.com/guide/navigation/navigation-swipe-view-2     Slide between fragments using ViewPager2 https://developer.android.com/training/animation/screen-slide-2     Adding Swipe-to-Refresh To Your App (SwipeRefreshLayout) https://developer.android.com/training/swipe/add-swipe-interface     Build and display a pop-up message (Snackbar) https://developer.android.com/training/snackbar/showing       Bluetooth overview https://developer.android.com/guide/topics/connectivity/bluetooth     Add the app bar https://developer.android.com/training/appbar     Menus https://developer.android.com/guide/topics/ui/menus       Create a List with RecyclerView https://developer.android.com/guide/topics/ui/layout/recyclerview     implementation ‘androidx.recyclerview:recyclerview:1.1.0’   activity_main.xml <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:app=”http://schemas.android.com/apk/res-auto” xmlns:tools=”http://schemas.android.com/tools” android:layout_width=”match_parent” android:layout_height=”match_parent” android:orientation=”vertical” tools:context=”.MainActivity3″> <androidx.recyclerview.widget.RecyclerView android:id=”@+id/my_recycler_view” android:scrollbars=”vertical” android:layout_width=”match_parent” android:layout_height=”match_parent”/> </LinearLayout>…

Read More
Android

모던 안드로이드 (오준석의 생존코딩)

  DB를 이용한 데이터 저장 방법 Room LiveData Room 비동기 처리 UI와 로직 분리 ViewModel DataBinding       모던 안드로이드 #1 – DB를 이용한 데이터 저장 방법 Room 모던 안드로이드 #3 LiveData 모던 안드로이드 #5 – Room 비동기 처리 모던 안드로이드 #7 – UI와 로직 분리 ViewModel   https://developer.android.com/training/data-storage/room https://developer.android.com/topic/libraries/architecture/adding-components https://developer.android.com/jetpack/androidx/releases/lifecycle   Room 라이브러리 추가 MainActivity 에서 onCreate() 에서 Room 입력하고 Alt + Enter -> Add Dependency     activity_main.xml   <androidx.constraintlayout.widget.ConstraintLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:app=”http://schemas.android.com/apk/res-auto” xmlns:tools=”http://schemas.android.com/tools” android:layout_width=”match_parent” android:layout_height=”match_parent” tools:context=”.MainActivity”> <EditText android:id=”@+id/todo_edit” android:layout_width=”0dp” android:layout_height=”wrap_content” android:layout_marginStart=”8dp” android:layout_marginEnd=”8dp” android:hint=”할 일” android:inputType=”textPersonName” app:layout_constraintEnd_toStartOf=”@+id/add_button” app:layout_constraintStart_toStartOf=”parent”…

Read More
Android

될 때까지 안드로이드 정리 (오준석의 생존코딩) 4

    32장 채팅 앱 만들기 : 파이어베이스 활용 1 33장 미세먼지 앱 만들기1 – 앱 소개       될 때까지 안드로이드 #34 [32장 채팅 앱 만들기 : 파이어베이스 활용 1]             될 때까지 안드로이드 #42 [33장 미세먼지 앱 만들기1 – 앱 소개]     <uses-permission android:name=”android.permission.ACCESS_FINE_LOCATION” /> <uses-permission android:name=”android.permission.ACCESS_COARSE_LOCATION” />       <application android:name=”.MyApplication”       프로젝트 레벨 classpath “io.realm:realm-gradle-plugin:3.5.0”     앱 레벨 apply plugin: ‘realm-android’ android { compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } } dependencies { implementation ‘com.google.android.material:material:1.2.0’…

Read More
Android

될 때까지 안드로이드 정리 (오준석의 생존코딩) 3

    26장 이벤트 처리 26장 분위기 변신 – Toast 커스텀 27장 툴바 사용하기 28장 리사이클러뷰 30장 생산성을 높이는 라이브러리 – Realm       될 때까지 안드로이드 #29 [26장 이벤트 처리]   <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:tools=”http://schemas.android.com/tools” android:layout_width=”match_parent” android:layout_height=”match_parent” android:orientation=”vertical” tools:context=”com.example.eventexam.MainActivity”> <TextView android:id=”@+id/view1″ android:layout_width=”match_parent” android:layout_height=”100dp” android:background=”#ffebee” android:text=”onClick, onLongClick” /> <EditText android:id=”@+id/edit1″ android:layout_width=”match_parent” android:layout_height=”wrap_content” android:hint=”onFocusChanged, onKey” /> <EditText android:id=”@+id/edit2″ android:layout_width=”match_parent” android:layout_height=”wrap_content” android:hint=”onFocusChanged, onKey” /> <TextView android:id=”@+id/event_info_text” android:la       public class MainActivity extends AppCompatActivity { private TextView mView1; private View mView2; private EditText mEdit1; private EditText mEdit2; private TextView mEventInfoTextView; @Override…

Read More
Android

될 때까지 안드로이드 정리 (오준석의 생존코딩) 2

    14장 뷰페이저 좌우로 밀리는 화면 15장 환경에 따라 화면 구성하기 16장 리소스 17장 브로드캐스트 리시버 18장 콘텐트 프로바이더 19장 비동기 처리-1 19장 비동기 처리-2 20장 DB를 이용한 데이터 저장과 공유 22장 네트워크 통신-1 OkHttp 22장 네트워크 통신-2 Gson 23장 서비스, 인텐트 서비스, 포그라운드 서비스, 바인드 서비스 24장 알림과 알람매니저 – 1 24장 알림과 알람매니저 – 2 25장 지도를 이용해보자1 – 구글 지도       될 때까지 안드로이드 #11 [14장 뷰페이저 좌우로 밀리는 화면]   # 메뉴에서 Fragment 3개를 새로 만든다.   MyPagerAdapter.java   public class MyPagerAdapter extends…

Read More