Ankita Gaba

Here we’ll see an alternative for the deprecated function onActivityResult

First, let’s see how we use onActivityResult

Using Deprecated method [onActivityResult]

Creating intent and starting SecondActivity for the result.

Capturing results back for intent.

Now let’s perform the same task using the alternative of onActivityResult

Using Alternative way [registerForActivityResult]

Launching intent for SecondActivity.

Capturing result in registerForActivityResult.

No request codes are needed while using the launcher method.

Hope this helps….❤

--

--

Here we will see how to implement expandable layouts, which are generally used to limit the number of lines on UI, to keep the UI uniform throughout. So, let's get started…

Step 1: Designing a simple xml that consist of two textviews: one for text and the other for “…more”.

Step 2: Adding resource file for “…more” background in order to make UI look better.

Step 3: Writing corresponding class which will help show UI on the screen.

And yes we are all done. All it takes is 3 easy steps to add an expandable property to your textview.

Hope this helps…(; keep coding❤
Till next time….cheers:clinking_glasses:

--

--