Facebook
Twitter
LinkedIn
Instagram
Whatsapp
Call Now
Quick Inquiry

How to send from Fragment when clicking on ImageButton to Activity from android ?

How to send from Fragment when clicking on ImageButton to Activity from android ?

The reason we use requireContext is because we use it in fragment, we would use "this" if we were going to use activity as well.

AddFragment.kt(fragment to Activity)

 storageBtn.setOnClickListener {          
        startActivity(requireContext(),StorageActivity::class.java)
 } 

activity to activity

 storageBtn.setOnClickListener{
        startActivity(this,StorageActivity::class.java)
    }

9 0

Write a Comments


* Be the first to Make Comment

GoodFirms Badge
GoodFirms Badge

Fix Your Meeting With Our SEO Consultants in India To Grow Your Business Online