完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
|
请大佬指点指点,刚刚接触 HarmonyOS
没有安卓的开发经历,所以很多问题都不太明白,请大佬们多多关照。 代码示例: private void initComponent(){ tfUsername = (TextField) findComponentById(ResourceTable.Id_tf_username); btnLogin = (Button) findComponentById(ResourceTable.Id_btn_login); btnLogin.setClickedListener(new Component.ClickedListener() { @Override public void onClick(Component component) { Intent intent = new Intent(); Operation operation = new Intent.OperationBuilder() .withDeviceId("") .withBundleName("com.arvin.PetiteBookkeeping") .withAbilityName("MainAbility") .build(); intent.setOperation(operation); String username = tfUsername.getText().toString(); intent.setParam("username",username); startAbility(intent); } }); btnRegister = (Button) findComponentById(ResourceTable.Id_btn_register); btnRegister.setClickedListener(new Component.ClickedListener() { @Override public void onClick(Component component) { Intent intent = new Intent(); present(new RegisterAbilitySlice(),intent); } }); } 报错码: E/EGL_emulation: eglQuerySurface 313d EGL_BAD_ATTRIBUTE ··· D/AGP: can not find focus in [UILinearLayout ID(259) Id(-1)] |
|
相关推荐
1个回答
|
|
|
你的bundleName写对了么,还有withAbilityName(),是填你要跳转的Ability名称格式如下
com.example.myapplication.MainAbility 下方给出参考代码 Intent startService = new Intent(); Operation operation = new Intent.OperationBuilder() .withDeviceId("") .withBundleName(getBundleName()) .withAbilityName(MusicServiceAbility.class.getName()) .build(); startService.setOperation(operation); startAbility(startService); connectAbility(startService, connection); |
|
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
4707 浏览 0 评论
31102 浏览 0 评论
【润开鸿HH-SCDAYU800A开发板试用体验】+系统编译
1115 浏览 0 评论
【汇思博SEEK100开发板试用体验】记录DevEco Studio 中遇到的问题
1497 浏览 0 评论
【汇思博SEEK100开发板试用体验】在开发板鸿蒙OS搭建QT开发环境
1227 浏览 0 评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-4 06:38 , Processed in 0.604080 second(s), Total 73, Slave 56 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
3429