목록Java (7)
Foggy day
It is necessary to seperate the use of 'getSupportFragmentManager()' and 'getChildFragmentManager()'. If you have Activity "A" and Fragment "A-1" in "A", you should use getSupportFragmentManager() when you manage "A-1". getSupportFragmentManager() need activity. But If you have Fragment "B", "C" in "A-1", you shoud use getChildFragmentManager() when you manage "B", "C". If you work in fragment "..
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..
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..

This article is an example of LayoutParams. Sometimes, you want to change propertis of view like margin or width in code. It is for that. what we need to know to use LayoutParams is ViewGroup. There are FrameLayout, Linearlayout, ConstraintLayout and RelativeLayout as ViewGroup. we can include child view like TextView, Button, and EditText. To use LayoutParams, we have to access ViewGroup. If Vi..

When making app, we mostly use viewpager and tablayout, and appbar. Animation showing or hiding appbar in activity is not too difficult. But, Sometimes a slightly complicated UI bothers us. For example, there is a fragment A in the activity, and the AppBar, tablayout, and ViewPager ars in the A fragment. The VewPapger has fragments B, C, and D. In this structure what i want to do is an animation..

This post is the example of composite design pattern without detail explanation. If you know definition or concept of composite design pattern, I recommend searching other articles on Google. Some explanations are commented out in the code. Classes used 1. AbstractExpression abstract public class AbstractExpression { public abstract int operate(); } 2. AbstractOperationExpression abstract public..