简体   繁体   中英

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

this approach is not recommended. It's best to have a layout that can include another layout to reuse the same button

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM