[英]How to declare a button from another activity in the main one in android?
I have a problem with accessing a button from another activity.我在访问另一个活动的按钮时遇到问题。 I was searching all over the internet and the best I found is this:
我在互联网上搜索,我找到的最好的是:
View inflatedView=getLayoutInflater().inflate(R.layout.activity_songcontrol, null);
final Button playNpauseBtn = (Button)inflatedView.findViewById(R.id.pauseNplayBtn);`
When I click the button nothing happens and I get mSecurityInputMethodService is null
in logcat当我单击按钮时,没有任何反应,我在 logcat 中得到
mSecurityInputMethodService is null
this approach is not recommended.不推荐这种方法。 It's best to have a layout that can include another layout to reuse the same button
最好有一个可以包含另一个布局的布局来重用相同的按钮
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.