목록Android (60)
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..
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..