목록Android (47)
Foggy day
sample video 1. activity_change_view_size_by_seek_bar.xml 2. change_vertical_size_layout.xml 3. ChangeViewHeightBottomSheet.java public class ChangeViewHeightBottomSheet { private BottomSheetBehavior behavior; private Activity activity; private int screenHeight = 0; private LinearLayout llDefaultView; private LinearLayout llChangeView; private SeekBar seekBar; private TextView tvProgressNum; pub..
Collections.sort(dayArrayList, new Comparator() { @Override public int compare(ChartDayData chartDayData, ChartDayData t1) { return chartDayData.getDay().compareTo(t1.getDay()); } });
This article is an simple example of mediaplayer using surfaceview. The reason that i make this sample, it is to play video without audiofocus. If you use VideoView, it catch audiofocus. But MediaPlayer doesn't catch audiofocus. Video 1. add video file Add video file in res -> raw. In my case, video file is mp4 type. 2. draw xml. All you need is a SurfaceView 3. wirte code Somethings you need ar..
If an error occurs when you rotate screen, add this code in manifest activity that you want to apply rotation
Sha key is needed when we use api like google and kakao and so on. So, this article is about how to get debug/release SHA-1. First, get debug sha-1. It is very easy. double click "signingReport" If you find Tasks tab, follow below. 1. Android Studio -> Preference -> Experimental -> disable "Do not build Gradle task list during Gradle Sync" 2. File -> Sync Project with Gradle files Second. get re..
we often use base64 encode/decode. when i used base64, i just added base64 in import using alt + enter. import java.util.Base64; But if you add Base64 of java, codes using it need oreo version. The solution i found is android.Base64. In fact, there is no solution. Add Adroid.Base64 instead of java.Base64 import android.util.Base64;
To use vector asset image, min sdk must be at least 24. But If you add this code "vectorDrawables.useSupportLibrary = true" in gradle, minimum sdk need not be 24. defaultConfig { vectorDrawables.useSupportLibrary = true ... }
It is a sample code of DatePickerDialog. Here, you can limit maxDate, minDate and implement spinner DatePickerDialog. Also you can remove the specific type in datepickerdialog. private void setDatePicker() { b.tvTitleDate.setOnClickListener(view -> { Calendar c = Calendar.getInstance(); DatePickerDialog datePickerDialog = new DatePickerDialog(getActivity(), android.R.style.Theme_Holo_Light_Dialo..
It is the code about How to get number of days in this month as using YearMonth Class. If you want to know number of days in this month, It is that. public static int getDayCountOfThisMonth() { Date date = new Date(); SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd"); String time = sf.format(date); YearMonth dayCount = YearMonth.from(LocalDate.parse(time, DateTimeFormatter.ofPattern("yyyy..
when there is Viewpager2 inside Viewpager2, ViewPager2 inside can't be swiped. You can see explanation of it in Google Doc. developer.android.com/training/animation/vp2-migration#nested-scrollables Support nested scrollable elements ViewPager2 does not natively support nested scroll views in cases where the scroll view has the same orientation as the ViewPager2 object that contains it. For examp..