Android:Activity的跳转
// 实际开发中常用的方法
Intent intent = new Intent();
intent.setClass(MainActivity.this, LoginActivity.class);
startActivity(intent);
//<疯狂Android>中介绍的方法
ComponentName comp = new ComponentName(MainActivity.this, FullscreenActivity02.class);
Intent intent = new Intent();
intent.setComponent(comp);
startActivity(intent);
界面间传值:
// 数据打包
Bundle bdl = new Bundle();
bdl.putString("name", "A");
bdl.putInt("years", 17);
// 跳界传参
Intent itt_1 = new Intent(this, A01_Activity.class);
itt_1.putExtras(bdl); // 起跳
startActivity(itt_1);
//-----------------------------------------------------------------
// Intent->Bundle->取值
Intent itt_2 = getIntent();
Bundle dbl = itt_2.getExtras();
String str = dbl.getString("name");
int n = dbl.getInt("years"); System.out.println(str + "●<--------------------->●" + n);
或者不直接使用Bundle传参
// 跳界传参
Intent itt_1 = new Intent(this, A01_Activity.class);
itt_1.putExtra("name", "A");
itt_1.putExtra("years", 18); // 起跳
startActivity(itt_1);
//-------取值的地方是一样的-------------------------------------------------------------------
// Intent->Bundle->取值
Intent itt_2 = getIntent();
Bundle dbl = itt_2.getExtras();
String str = dbl.getString("name");
int n = dbl.getInt("years");
Android:Activity的跳转的更多相关文章
- Android activity界面跳转动画
实现activity界面跳转动画 1.在startActivity方法之后加入: overridePendingTransition(R.anim.pull_in_right, R.anim.pull ...
- Android Activity间跳转与传递数据
1 概述 Activity之间的跳转主要使用 startActivity(Intent intent); startActivityForResult(Intent intent,int reques ...
- Android Activity切换(跳转)时出现黑屏的解决方法
在两个Activity跳转时,由于第二个Activity在启动时加载了较多数据,就会在启动之前出现一个短暂的黑屏时间,解决这个问题比较简单的处理方法是将第二个Activity的主题设置成透明的,这样在 ...
- xamarin.android Activity之间跳转与传值
前言 由于需要,所以接触到这个新的安卓开发模式,我会把我的学习经历全都记录下来,希望对大家有用. 导读 关于Activity,学习过安卓的人也应该明白什么是Activity,推荐新手去看YZF的这篇文 ...
- Android课程---Activity的跳转与传值(转自网上)
Activity跳转与传值,主要是通过Intent类来连接多个Activity,以及传递数据. Intent是Android一个很重要的类.Intent直译是“意图”,什么是意图呢?比如你想从这个 ...
- 实现android activity之间的跳转
android程序一般不会只有一个activity,会碰到activity之间的跳转.以下是使用Intent做应用程序内部的activity做跳转.比如,应用程序第一个activity是: 点击“下一 ...
- android入门:activity之间跳转,并且回传参数
介绍: 两个activity进行跳转,在跳转过程中,将message由MainActivity传递到secondActivity,并且当secondActivity退回至MainAct ...
- android使用ARouter跳转activity(阿里巴巴开源的)
android使用ARouter跳转activity(阿里巴巴开源的) 使用ARouter方式,点击按钮跳转到其他activitypublic void buyOrSell(String str){ ...
- Android activity之间的跳转和数据传递
1.Activity之间的跳转 并且 传递数据 A Activity进行的操作 Intent intent = new Intent(context, B.class); intent.putExtr ...
随机推荐
- ios外派—本公司长年提供ios程序员外派业务(北京动点软件,可签合同)
北京动点飞扬长年提供ios工程师外派业务. 我公司程序员平均技术情况如下: 1.二年以上iPhone/ipad开发经验:2.熟练使用Xcode.Objective C编码技能:3.熟悉iOS开发框架, ...
- windows下 更新 android studio SDK 到最新版本 解决方案
一.设置代理信息 打开android studio>>File>>Settings>>Appearance&Behavion>>System S ...
- jQuery实现文字放大效果
实现效果:当鼠标移动到超链接的那一瞬间就出现提示. <!DOCTYPE html> <html> <head> <meta charset="UTF ...
- EINTR、ERESTARTSYS和SIGINT
1. 驱动使用down_interruptible,并在该函数返回非零值时返回-EINTR:应用程序不处理signal,使用CTRL-C退出应用程序: 驱动从down_interruptible返回, ...
- iPerf - The network bandwidth measurement tool
What is iPerf / iPerf3 ? iPerf3 is a tool for active measurements of the maximum achievable bandwidt ...
- Python 创建函数和代码重用
1. cat func.py #!/usr/bin/python def func(): print "hello,this is a function" def func2(): ...
- android学习笔记47——读写SD卡上的文件
读写SD卡上的文件 通过Context的openFileInput.openFileOutput来打开文件输入流.输出流时,程序打开的都是应用程序的数据文件夹里的文件,其存储的文件大小可能都比较有限- ...
- golang的采集库
goquery https://github.com/PuerkitoBio/goquery 例子 aa.html <html> <body> <div id=" ...
- TMS320C54x系列DSP的CPU与外设——第1章 绪论
第1章 绪论 TMS320C54x DSP是TMS320系列DSP产品中的定点数字信号处理器.C54x DSP满足了实时嵌入式应用的一些要求,例如通信方面的应用. C54x的中央处理单元(CPU)具有 ...
- hadoop作业调优参数整理及原理(转)
1 Map side tuning参数 1.1 MapTask运行内部原理 当map task开始运算,并产生中间数据时,其产生的中间结果并非直接就简单的写入磁盘.这中间的过程比较复杂,并且利用到了内 ...