Tabbed activity layout <---> fragment communication | Sololearn: Learn to code for FREE!

0

Tabbed activity layout <---> fragment communication

In Android studio, for tabbed activity, is there any way to add different apps to the tabs? I couldn't succeed to communicate with the buttons in layout by fragments' kotlin files... For example there is a fragment with parrented pages as 'tab1.kt' and 'tab1_layout.xml' In that layout page made some buttons named 'btn0' 'btn1' and 'btn2'; i wrote 'btnClickAdd' to the 'onClick' setting. In the next step i wrote a method as 'fun btnClickAdd(view:View){...}' and '...' Contains some codes with 'when' loop to add some texts to the 'textView' in layout page as long as presed the buttons... But it doesn't work! When i pressed one of the buttons app crashes... Because it says "button couldn't find the method i wrote to the 'onClick' setting" What should i do???

5/29/2019 7:50:22 PM

Ugur Serhat Toy

0 Answers

New Answer