473,385 Members | 1,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Can i use multiple OnClick() function in one code??

i am making an android app .I am just a beginner. can someone tell me if i can use more than one OnClick() in my code. As i need to perform specific tasks on each button click.
Sep 9 '13 #1
1 1327
Nepomuk
3,112 Expert 2GB
Hello Aradhya and welcome to bytes.com!

In Android programming, every button (in fact everything that extends a View) can have an OnClickListener which you can set with the setOnClickListener(OnClickListener) function. Look at the first example on the Button api reference, that gives you an idea of how to set OnClickListeners via Java or the second and third code blocks for how to set one via XML. So yes, you can have many, many OnClick methods. :-)
Sep 9 '13 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: jdub | last post by:
I bringing up a list of movies in a separate window where each one has an "onclick" function which is suppose to call a procedure and pass in the variables and display the details of the selected...
4
by: jj6849 | last post by:
I have been using the dom to add a row to my form for awhile now, but now I need to do some validation to make sure certain check boxes aren't checked with other check boxes. Now of course it works...
1
by: quickcur | last post by:
Hi, here is my code: <html> <head> <script type="text/javascript"> function setImage(num) { alert(num); }
4
by: manu3d | last post by:
Hi everybody, I'm generating some DIVs dinamically, inclusive of an event function to run when the user clicks on them. While the following lines work perfectly in FF 1.5, I.E. 6.0 ignores...
2
by: gert | last post by:
obj=function() { this.attribute=1 this.method=function() { img=document.createElement('img') img.onclick=function { this.attribute=2 // i need the obj this not the img this :) }
1
by: Mike Scirocco | last post by:
I use this function to detect an iframe button click. It works in IE6 but not in FF 1.5. function setupbutton(){ var myiframe=document.getElementById('ifrmEditCategory'); var...
2
by: SM | last post by:
Hello, I have two functions: show_thumbnail() and show_photo(). See code below. In show_thumbnail() i create a <ullist using Javascript and the DOM. In the tag <ai create a onclick function and...
3
by: msinghal | last post by:
hi, I am facing one problem which is related to AJAX. I have a html page which has some links. When the page is refreshed using AJAX then if some new new link is added to the page on this refresh,...
1
omerbutt
by: omerbutt | last post by:
hi i am trying to bond an onclick function of jGrowl but it is not working iit was initially used as the document ready function and i am changing it to use it on click here is the code <!DOCTYPE...
3
by: Mohamed abdul | last post by:
am working with that code, when i click addrow button onclick function is not working in IE but working in mozilla, chrome code is <td><INPUT type="button" value="Add Row"...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.