Android版的setContentView或意图? [英] Android setContentView or Intents?

查看:128
本文介绍了Android版的setContentView或意图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非常简单的2屏Android应用程序。

I have a very simple 2 screen android app.

有什么缺点简单地切换出通过的setContentView布局或者我应该使用意图?不想鸡奸了我的应用程序,如果事情是不对的。

Is there any downside to simply switching out the layouts via setContentView or should i be using intents?Don't want to bugger up my app if something is wrong with this.

推荐答案

以及关于Android开发的 http://developer.android.com/reference/android/content/Intent.html

Well as stated on Android Dev http://developer.android.com/reference/android/content/Intent.html

这是意图提供了一个设施
  执行后期运行时绑定
  在不同的code之间
  应用程序。其最显著使用
  在活动的开展,
  在那里它可以被认为是胶
  活动之间。它基本上是一个
  被动的数据结构持有
  一个动作的抽象描述
  来进行。

An Intent provides a facility for performing late runtime binding between the code in different applications. Its most significant use is in the launching of activities, where it can be thought of as the glue between activities. It is basically a passive data structure holding an abstract description of an action to be performed.

因此​​,如果你的两个屏幕是2个不同的应用程序,我会说你想简单地使用的setContentView。

Therefore if your two screens are 2 different applications I would say you want to simply use setContentView.

这将简化您的code,当你想从一个到其他视图通过信息

it will simplify your code when you want to pass info from one to the other views

这篇关于Android版的setContentView或意图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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