My Android Calculator App With Swipe View With Tabs Is Crashing
I have created two simple calculator apps, they are working well. I wanted to put that code in a new app (swipe view with 3 tabs) each app code in each tab. The app installing,open
Solution 1:
java.lang.IllegalStateException: Could not find method clickFun1(View) in a parent or ancestor Context for android:onClick attribute defined onview class android.support.v7.widget.AppCompatButton with id 'calcBtn'You have a layout that has an android:onClick attribute, referring to a clickFun1 method. There is no method by that name on your activity. There is a method by that name on one of your fragments, but the standard android:onClick logic will not find that one.
Options to deal with this include:
Remove the
android:onClickattribute, instead registering anOnClickListeneron this button in your fragmentGet rid of the fragment, moving the business logic, including this
clickFun1()method, into the activityUse the data binding library to tie the
android:onClickattribute to your fragment
If you are new to Android development, I recommend the first option.
Post a Comment for "My Android Calculator App With Swipe View With Tabs Is Crashing"