Android DatePicker帮助,知道哪个EditText调用了
我正在关注本教程: http://developer.android.com /resources/tutorials/views/hello-datepicker.html 。
我有两个 EditText,其中一个调用 showDialog(0),即 DatePickerDialog。我如何知道哪个 EditText 调用了 showDialog?因为 updateDisplay (教程中的方法)没有显示如何执行此操作!
I'm following this tutorial: http://developer.android.com/resources/tutorials/views/hello-datepicker.html .
I have two EditText, and which one calls showDialog(0) that is the DatePickerDialog. How can I know which EditText called the showDialog? Because the updateDisplay (method in tutorial) doesn't show how to do this!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在你的OnClick方法中,你可以得到哪个视图被点击
然后,将它与你的editTexts的id(你在xml文件上设置的id)进行比较,你就会知道调用了哪个视图
On your OnClick method, you can get which view was clicked
Then, compare it to the id of your editTexts (the ids that you set on the xml file) and you will know which one was called