Android 5 And Onclick In Xml Layout
Solution 1:
I had a very similar problem, it happens only on Android Lollipop, whilst it works fine on the older versions. Looks like a bug or undocumented feature in 5.0.
Make sure that in the layout file where your ImageButton
resides there is noandroid:theme
set, i.e. nothing like this:
android:theme="@style/Base.Theme.AppCompat.Light"
Instead, define your application theme in AndroidManifest.xml
application element:
<application...android:theme="@android:style/Theme.Holo.Light"... >
Solution 2:
i can't find what is the real problem, maybe some incompatiblity between eclipse and api 21 or something else.
for now i just set an onClickListener
for that button.
Solution 3:
finally i found the problem.
all i need is to associate the xml layout to an activity. for this in the design tab of xml layout make sure you selected the right activity.
Solution 4:
It happens when you have declared the public void onClick(View view)
method inside the fragment instead of activity
Solution 5:
Be sure that your onClick method
publicvoidphotoDetailButtonMethod(View theButton)
{
//something
}
is written outside onCreate()
method and in your Activity class.
Post a Comment for "Android 5 And Onclick In Xml Layout"