简体   繁体   English

尝试使用 Intent,启动新应用程序并使用新应用程序登录凭据让启动应用程序自动登录

[英]Attempting to use Intent, to launch a new app and have the launching application automatically log in using new apps login credentials

I have an application that is currently set to launch another application, this new application requires login information to be entered before you can go any further in the application.我有一个当前设置为启动另一个应用程序的应用程序,这个新应用程序需要输入登录信息,然后才能在应用程序中进一步操作。 The required login credentials are saved in the newly launched applications .java files.所需的登录凭据保存在新启动的应用程序 .java 文件中。 I want the original application to pull the login data from the new app (or just update the text fields with the data) and automatically log in without the user having to adjust any settings.我希望原始应用程序从新应用程序中提取登录数据(或仅使用数据更新文本字段)并自动登录,而无需用户调整任何设置。

I'm new to Android development and very rusty on basic Java, I'm trying to learn and the best way I can is to look at some code that will do this or an explanation on what is required to complete a task such as this.我是 Android 开发的新手,对基本的 Java 非常生疏,我正在努力学习,我能做的最好的方法是查看一些可以执行此操作的代码或有关完成此类任务所需内容的说明.

Any help is appreciated!任何帮助表示赞赏!

When activity1 launches activity2, use startActvityForResult(intent) instead of startActivity(intent).当activity1 启动activity2 时,使用startActvityForResult(intent) 而不是startActivity(intent)。 When activity2 has the requested credentials, bundle them and return to activity1 (override the method onActivityResult() to handle the results).当 activity2 拥有请求的凭据时,将它们捆绑并返回到 activity1(覆盖方法 onActivityResult() 以处理结果)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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