简体   繁体   English

如何将其他活动添加到我的android项目?

[英]How to add other activities to my android project?

I am building an Android project where I have implemented Navigatin Drawer. 我正在构建一个实现了Navigatin Drawer的Android项目。 The only class I have is NavigationDrawer.java* 我唯一的类是NavigationDrawer.java *

I want that when I click the first option of the drawer to see a Login page. 当我单击抽屉的第一个选项以查看“登录”页面时,我希望这样做。 I have already built a project that contains only that. 我已经建立了一个仅包含该项目的项目。 It has the classes MainActivity.java , LoginActivity.java (This is the launcher activity) and RegisterActivity.java 它具有MainActivity.java,LoginActivity.java(这是启动器活动)和RegisterActivity.java类。

How can I use those classes now? 现在如何使用这些类? Should I build an intent? 我应该建立意图吗? is that enough? 够了吗? and Where exactly? 到底在哪里?

It depends on. 这取决于。

If you want the drawer as a navigation inside one application, one way would be using an activity containing your drawer and fragments for eg every entry of your drawer. 如果希望抽屉在一个应用程序中作为导航,一种方法是使用包含抽屉和片段的活动,例如,抽屉的每个条目。

If you have logically multiple applications wich you like to link from your application containing the drawer you should use Intents to open these. 如果逻辑上有多个应用程序希望从包含抽屉的应用程序链接,则应使用Intents打开它们。

目的是您调用其他活动的方式,您也可以在登录页面上放置一个按钮进行注册,当他们单击该按钮时,用户将被转到注册类别

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

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