1

i have to create a multiplication method in application 1 call the logic from application 2 and print the output in application 2. basically i have to create 2 application here is my code

MainActivity1 : AppCompatActivity() {
    
        override fun onCreate(savedInstanceState: Bundle?) {
            super.onCreate(savedInstanceState)
            setContentView(R.layout.activity_main)
    
            var firstValue = editText_first_no.text.toString()
            var secondValue = editText_second_no.text.toString()
    
            add_button.setOnClickListener{
                //Here i have to call method from my second app
    var result = multiPlyValue(firstValue.toLong(), secondValue.toLong())
    Toast.makeText(this, result , Toast.LENGTH_SHORT).show()
            
              }
    }
    
    
    } 


    MainActivity2 : AppCompatActivity() {
    
        override fun onCreate(savedInstanceState: Bundle?) {
            super.onCreate(savedInstanceState)
            setContentView(R.layout.activity_main)
            }
    
    
    fun multiPlyValue(firstValue: Long, secondValue: Long): Long{
            return firstValue*secondValue
        }
    } 

0 Answers0