Run Method Onclick Crash In Android
Solution 1:
public void startClient(View v)
.. this will be the signature of the method
UPDATE:
as everybody is posting the same answer I think I better improve my answer a bit. Although the single line has solved your problem If you get free time you can see the following links .. There you can find clear concept about different ways to handle click events
http://www.remwebdevelopment.com/dev/a69/Different-Ways-To-Handle-Clicks.html
http://smartcloudblog.blogspot.com/2011/09/android-onclicklisteners-vs.html
Solution 2:
When you define the click method of a button in XML, the button itself is passed as a parameter to the method.
You have a startClient()
method, but Android is looking for a startClient(View v)
method. Change your method to match this signature and it will work.
Solution 3:
Change this:
publicvoidstartClient() {
with:
publicvoidstartClient(View view) {
The methon onClick take a parameter, the View.
Solution 4:
Change public void startClient()
to public void startClient(View v)
.
Post a Comment for "Run Method Onclick Crash In Android"