简体   繁体   English

如何在Android中打开新屏幕?

[英]how to Open new screen in Android?

i am new to android and i have created a login page after verifing login 我是android的新手,我在验证登录后创建了一个登录页面

i get results true or false on the bases of user authentication now my goal is to show another screen on successful authentication with some new textboxes and button i mean new layout how to achieve this??? 我在用户身份验证的基础上得到结果是真还是假现在我的目标是显示成功验证的另一个屏幕与一些新的文本框和按钮我的意思是新的布局如何实现这一点?

any help would be appriciated. 任何帮助都会得到满足。

You want to start new activity . 你想开始新的活动 You can read more on initiating new Activities at Android documentation . 您可以在Android文档中阅读有关启动新活动的更多信息

However you might consider making a "normal" application screen and call another Activity for login purposes instead of having a login page and redirection. 但是,您可以考虑创建一个“普通”应用程序屏幕并调用另一个Activity进行登录,而不是使用登录页面和重定向。

So if page/Activity_A requires user to be logged in, you call LoginActivity with startActivityForResult and get true/false if user has properly logged in. 因此,如果page / Activity_A要求用户登录, 使用startActivityForResult调用LoginActivity ,如果用户已正确登录,则获取true / false。

create an Intent and pass the intent to startactivty method. 创建一个Intent并将intent传递给startactivty方法。 ake sure your activity should be defined in manifest file 确保您的活动应在清单文件中定义

Read about Intents 阅读Intents

intents are used to start new activity 意图用于开始新活动

Activity is the super class that represents each of your view corresponding to your layout Activity是表示与布局对应的每个视图的超类

in Professional Android App Dev- WROX by Retro Meier gives good examples for this in a chapter for Intents and Broadcast. 在专业的Android应用程序Dev-WROX by Retro Meier在Intent and Broadcast的一章中给出了很好的例子。

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

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