1、普通跳转:

Intent intent=new Intent();
intent.setClass(MainActivity.this,NewActivity.class);
//新建一个Intent,使用setClass方法设置跳转的哪个界面
startActivity(intent);

2、数据传递

Bundle data=new Bundle();
//创建了一个Bundle对象用来存储在两个Activity之间传递的数据
data.putString("website","cnblogs.com/hjw1");
data.putString("name","环家伟");
data.putInt("age",20);
//添加进Bundle对象里面两个String类型的数据和一个int类型的数据
Intent gotoAnother=new Intent(MainActivity.this,Main2Activity.class);
//创建了一个从MainActivity跳转到Main2Activity的Intent
gotoAnother.putExtras(data);
//将存储了数据的Bundle对象put进Intent里面
startActivity(gotoAnother);
//开始跳转
Bundle receive=getIntent().getExtras();
//得到随Intent传递过来的Bundle对象
String name=receive.getString("name");
String website=receive.getString("website");
int age=receive.getInt("age");

Intent Activity跳转 传递数据 Bundle的更多相关文章

  1. 在Activity之间如何传递数据,请尽可能说出你所知道的传递数据的方法,并详细描述其实现过程。

    在Activity之间如何传递数据,请尽可能说出你所知道的传递数据的方法,并详细描述其实现过程. 答案:可以通过Intent对象.静态变量.剪切板和全局对象进行数据传递,具体的数据传递方法如下. 1. ...

  2. [Android]Activity跳转传递任意类型的数据、Activity为SingleTask时代替StartActivityForResult的解决方案

    以下内容为原创,欢迎转载,转载请注明 来自天天博客:http://www.cnblogs.com/tiantianbyconan/p/4389674.html 需求:在ActivityA跳转到Acti ...

  3. Android 之 使用 Intent 在活动间传递数据

    •前言 继上次学习了<通过 Intent 完成点击按钮实现页面跳转>后,我们知道了如何通过 Intent 实现页面跳转: Intent 除了可以实现页面跳转外,还可以在跳转的时候传递数据: ...

  4. Android Activity和Fragment传递数据

    1.Activity与Activity传递数据 UserLoginActivity.java: Intent welcomePage = new Intent(); Bundle dataBundle ...

  5. 四大组件之Activity——组件间传递数据的4种常用方法

    在Android中传递数据的方法非常多,本次介绍4中比较常用的数据传递方法: 通过Intent/Bundle传递数据 通过静态变量(static)传递数据:需构建跳转页面相应静态变量http://bl ...

  6. Android基础知识04—Activity活动之间传递数据

    ------活动之间传递数据------ 向下一个活动传递数据: Intent中提供了一系列的putExtra()方法,可以把数据暂存到Intent中,启动另一个活动的时候就可以取出来. 代码: (存 ...

  7. android传递数据bundle封装传递map对象

    android开发默认情况下,通过Bundle bundle=new Bundle();传递值是不能直接传递map对象的,解决办法: 第一步:封装自己的map,实现序列化即可 ? 1 2 3 4 5 ...

  8. 【Android】Intent中使用Extra传递数据

    传值方法一 Intent intent = new Intent(); Bundle bundle = new Bundle(); //该类用作携带数据 bundle.putString(" ...

  9. android 入门-Service实时向Activity通过BroadcastReceiver传递数据

    引文: http://www.cnblogs.com/linjiqin/p/3147764.html <RelativeLayout xmlns:android="http://sch ...

随机推荐

  1. delphi 属性编辑器

    RegisterPropertyEditor TPictureEditor = class(TClassProperty)   RegisterPropertyEditor(TypeInfo(TPic ...

  2. Navicat Premium 连接Oracle 数据库(图文教程)

    一.需要准备的软件 Navicat premium 32位 官方下载地址:http://www.navicat.com.cn/products/navicat-premium Instant Clie ...

  3. colgroup中col定义表格单元格宽度

    colgroup中可以使用col来定义表格单元格宽度,可以使用像素(数字),百分比,我们来具体看看有什么不同. 先看一个最基本的:用像素(数字)表示,因为table有个宽度,这里表示占比 <ht ...

  4. 解决 'Could not convert variant of type (NULL) into type (String)

    写存储过程中有不允许为空的字段,在客户端转化取数时显示 Could not convert variant of type (NULL) into type (String) 可以在存储过程中使用is ...

  5. U3D的结构体堆分配栈分配

    ST ot;//分配在栈上 ST[] arrt = new ST[2];//分配在堆上,因为数组是引用

  6. ubuntu 该软件包现在的状态极为不妥 error

    rm -rf /var/lib/dpkg/info/yourerrorsofware* dpkg --remove --force-remove-reinstreq yourerrorsoftware ...

  7. debian下redis2.8.17安装过程

    下载redis源码包,我下载的是redis2.8.17 解压缩该源码包 tar zxf redis-2.8.17.tar.gz 进入解压缩后的目录 cd redis-2.8.17/ 添加redis用户 ...

  8. Python学习笔记(一)简介总览

    Class 1 一.简介 python:脚本语言.解释型语言 缩进是python语言很重要的一个标志 python3是未来的发展趋势 二.安装 windows: 1.下载安装包: https://ww ...

  9. 浅析SQL Server 中的SOS_SCHEDULER_YIELD类型的等待

    本文出处:http://www.cnblogs.com/wy123/p/6856802.html 进程的状态转换 在说明SOS_SCHEDULER_YIELD等待之前,先简要介绍一下进程的状态(迷迷糊 ...

  10. [原创]delphi一次性批量在TScrollBox中显示N个复选框TCheckBox的源码

    unit Unit1; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System ...