목록Android (47)
Foggy day
when you use a animation in a fragment transaction, screen would flicker. It is caused because of animation drawable. If you use animation drawable like below, obviously flickering occurs slide_in_right.xml The cause is set. Remove
val intSrc = Observable.just(1, 2, 3) intSrc.subscribe(::println) val strSrc = intSrc.map { value -> value * 10 } strSrc.subscribe(::println) val src = Observable.just("A", "B", "C", "D") src.flatMap { s -> Observable.just(s + 2, s + 3) } src.subscribe(::println) val flatMap = Observable.range(2, 3).flatMap { x -> Observable.range(1, 9).map { y -> String.format("%d*%d=%d", x, y, x * y) } } flatM..
val source = Observable.create { emitter: ObservableEmitter? -> emitter?.onNext("Hello") emitter?.onNext("android") emitter?.onComplete() }.subscribe(::println) // source.subscribe(::println) val source = Observable.just("Hello", "android") source.subscribe(::println) val stringList = listOf("A", "B", "C") val source = Observable.fromArray(stringList) source.subscribe(::println) val stringArrayL..
val items: PublishSubject = PublishSubject.create() items.onNext(1) items.onNext(2) items.onNext(3) items.filter { i -> i % 2 == 0 }.subscribe(::println) items.onNext(4) items.onNext(5) items.onNext(6) items.onNext(7) items.onNext(8)
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 "..
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 ..