목록전체 글 (134)
Foggy day
1. class Person constructor(name: String) { val name: String init { this.name = name } } 2. class Person constructor(name: String) { val name: String = name } 3. class Person constructor(val name: String) { } 4. class Person(val name: String) { }
It is about initialization of lazy. class KotlinPlayGroundActivity : AppCompatActivity() { val name: String by lazy { getName() } val name2: String by lazy(::getName) override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_kotlin_play_ground) println("hello") println("name 1 : $name") println("name 2 : $name2") } @JvmName("getName1..
6. QuestionFragment Here, i used ViewPager2, RecyclerView, and EventBus. - fragment_survey_question.xml - SurveyQuestionFragment The thing to note here is EventBus. To use EnvetBus, you should add register, unregister, and @Subscribe. Register EventBus in onCreate, unregister onDestroy, and make a method with @Subscribe annotation, parameter. class SurveyQuestionFragment : Fragment(), View.OnCli..
This article is question example using assets file. The purpose of creation is to make a survey Form requires a variety of questions and answers The used things are Assets File(Json), Viewpager2, RecyclerView, Fragment navigation graph, Gson, ViewBinding, Parcelize, EventBus and so on. Video 1. package structure - survey_nav_graph.xml 2. Navigation graph container activity - ViewPagerQuestionBas..
video 1. activity_event_bus_sample_kotlin.xml 2. EventBusSampleActivityKotlin class EventBusSampleActivityKotlin : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_event_bus_sample_kotlin) GlobalBus.bus!!.register(this) val eventBusNickname = EventsNickname("jinhan") btnEventPost.setOnClickListener { Gl..
1. exo_player_activity 2. custom_exoplayer_controller 3. ExoPlayerActivity public class ExoPlayerActivity extends AppCompatActivity { private ExoPlayerActivityBinding b; private ExoPlayer exoPlayer; private Context mContext; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); b = ExoPlayerActivityBinding.inflate(getLayoutInflater()); setCo..
sample video 1. popup_activity_layout.xml 2. ShowPopup.java public class ShowPopup extends AppCompatActivity { private PopupActivityLayoutBinding b; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); b = PopupActivityLayoutBinding.inflate(getLayoutInflater()); setContentView(b.getRoot()); //If you want to fix orientation, input this code ..
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..