从一个活动移动到下一个Android的 [英] Moving from One activity to next in Android

查看:100
本文介绍了从一个活动移动到下一个Android的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发中的Andr​​oid应用程序有一个登录界面。现在我能够成功地接收来自服务器的响应。经过一个成功的响应应该带我到下一个活动或类,我展示一个新的屏幕/活动。我应该怎么做才能实现这一目标。

I am developing an application in android which has a login Screen. Right now I am able to receive the response from the server successfully. After a successful response it should take me to the next activity or class where I display a new screen/activity. what should I do in order to achieve this.

推荐答案

在Android中使用的是意图改变从一个活动到另一个。在这种情况下,你可以使用一个明确的意向。在code这将是这样的:

In Android you are using Intents to change from one Activity to another. In this case you would use an explicit Intent. In code this would like this:

Intent goToNextActivity = new Intent(getApplicationContext(), YourNewClass.class);
startActivity(goToNextActivity);

请务必YourNewClass添加到表现为另一个活动是这样的:

Be sure to add YourNewClass to the manifest as another activity like this:

<activity android:name=".your.package.YourNewClass" />

有一个仔细看看意图的文档。你也可以阅读有关的应用程序基础的文件的文档中它是有点深,只是回答这个问题但它会给你的Andr​​oid的最重要的概念的见解。

Have a closer look at the documentation of Intent. You can also read the document about application fundamentals in the documentation it is somewhat to deep to just answer this question but it will give you insights in the most important concepts of android.

这篇关于从一个活动移动到下一个Android的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆