android - How to know which Button was pressed recently among all the Buttons in an activity? -


मेरे पास तीन बटन नामित button1 , button2 < / कोड>, बटन 3 मेरी गतिविधि में। बटन 3 onclickListener (), मुझे पता होना चाहिए कि कौन सा बटन दबाया गया था हाल ही में बटन button1 और बटन 2 के बीच।

<पी > एक स्थानीय चर रखने के लिए और जब भी कोई बटन दबाया जाता है तो उसे उपयुक्त बटन के आईडी पर सेट करें।

  int lastPressedButton; ... @ ओवरराइड सार्वजनिक शून्य पर क्लिक करें (देखें वी) {lastPressedButton = v.getId (); स्विच (v.getId ()) {// सामान्य बटन हैंडलिंग कोड}}  

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -