010 Android programming 3rd 第二个activity android sdk

来源:互联网 发布:淘宝网婴儿鞋 编辑:程序博客网 时间:2024/06/04 18:38

主要学习新建一个activity,已经彼此之间如何传递数据。

在manifest中申明activity.

一个activity启动另一个activity.

When an activity calls startActivity(Intent), this call is sent to the OS.

In particular, it is sent to a part of the OS called the ActivityManager.

The ActivityManager then creates the Activity instance and calls its onCreate(Bundle) method.

四大组件

Activities, services, broadcast receivers, content providers.

Intent解释

显式intent, 和隐式intent

Activity之间传输数据

将是否对错送到CheatActivity中,使用intent中的extra变量。


Note that Activity.getIntent() always returns the Intent that started the activity.

消息应答

When you want to hear back from the child activity, you call the following Activity method

public void startActityForResult(Intent intent, int requestCode);


You can modify the minimum SDK version, target SDK version, and compile SDK version in your build.gradle file, but nore that modification of this file requires that you sync your project with the Gradle changes before they will be reflected.

To do this, select Tools - Android - Sync Project with Gradle Files. This will trigger a fresh build of your project with the updated values.

The Build.VERSION.SDK_INT constant is the device's version of Android. You then compare that version with the constant that stand for the Lollipop release.


阅读全文
0 0
原创粉丝点击