0

hello i have merged two android apps (A,B) i.e B as library into A into it works fine but both app A and B have android:name=".MainActivityA" and android:name=".MainActivityB" i made App B launcher and it works fine but somewhere in activities MainActivityA should be called and when i make and intent call

val intent = Intent(requireContext(), Class.forName("com.test.app.MainActivityA")) startActivity(intent)

caused by java.lang.classcastexception android.app.application cannot be cast to appears so how i can merge them together so that i can declare them as a single class on manifest android:name tag or what would be the best solution? thanks

Khal
  • 163
  • 1
  • 10
  • Try replacing `Class.forName("com.test.app.MainActivityA")` with MainActivityA::class.java. – AlphaOne Apr 03 '21 at 05:03
  • @AlphaOne its not working can i combine these to classes into one is it possible?? – Khal Apr 03 '21 at 05:21
  • refer this site you will found your answer bro https://stackoverflow.com/a/7574735/12543430 – D_K Apr 03 '21 at 05:28

1 Answers1

0
val intent = Intent(requireContext(), MainActivityA::class.java)
this.startActivity(intent)