当前位置:网站首页>Intent jump pass list set
Intent jump pass list set
2022-07-24 12:24:00 【AaVictory.】
- Android Two activity Common value transfer between Such as : Single String ,int … Not much
- Click here for reference articles
The following is about transmission list aggregate
Be careful :list The entity classes that pass values are serialized
- First create an entity class ( For test later )
import java.io.Serializable;
// Don't forget to serialize Serializable
public class DemoBean implements Serializable {
String xm;
int age;
public String getXm() {
return xm;
}
public void setXm(String xm) {
this.xm = xm;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
}
- first activity
// Write a test method
public void ToJump(){
List<DemoBean> list=new ArrayList<>();
// to list add to 5 Data
for (int i=0;i<5;i++){
DemoBean demoBean=new DemoBean();
demoBean.setXm(" tearful "+i);
demoBean.setAge(i);
list.add(demoBean);
}
Intent intent=new Intent(this,MainActivity.class);
intent.putExtra("list", (Serializable) list);
startActivity(intent);
}
- the second activity Page to receive
Intent intent=getIntent();
List<DemoBean> list= (List<DemoBean>) intent.getSerializableExtra("list");
Log.e("TAG","---"+list.size());// list.size()==5
Pass on ArrayList The collection and list equally
Be careful : Entity classes are serialized
- first activity
public void ToJump(){
ArrayList<DemoBean> arrayList=new ArrayList();
for (int i=0;i<5;i++){
DemoBean demoBean=new DemoBean();
demoBean.setXm(" tearful "+i);
demoBean.setAge(i);
arrayList.add(demoBean);
}
Intent intent=new Intent(this,MainActivity.class);
intent.putExtra("arrayList",arrayList);
startActivity(intent);
}
- the second activity Page to receive
Intent intent=getIntent();
ArrayList<DemoBean> arrayList= (ArrayList<DemoBean>) intent.getSerializableExtra("arrayList");
Log.e("TAG","--------"+arrayList.size());// Yes 5 Data list.size()==5
- That's all
边栏推荐
- 基于ARM和FPGA的数字示波器设计——QMJ
- Using huggingface model to translate English
- Snowflake algorithm (PHP)
- Wechat official account development: Material Management (temporary and permanent)
- [rust] rust language foundation | you should quickly get an impression when learning a language
- [C and pointer Chapter 11] dynamic memory allocation
- Buckle practice - 25 non overlapping intervals
- Anaconda environment migration
- Acwing 92. recursive implementation of exponential enumeration
- Buckle practice - 24 remove repeated letters
猜你喜欢

6-16 vulnerability exploitation -rlogin maximum permission login

How to realize the function of grabbing red envelopes in IM system?

Design of digital oscilloscope based on arm and FPGA -- QMJ
![[data mining engineer - written examination] sheen company in 2022](/img/67/c61dfce8c397ab55fab835b6e81a5f.jpg)
[data mining engineer - written examination] sheen company in 2022

String matching KMP

微信小程序生成二维码
![[mathematical basis of Cyberspace Security Chapter 3] congruence](/img/00/42a5f7f6f0e8a50884f4639767949f.jpg)
[mathematical basis of Cyberspace Security Chapter 3] congruence

Use and expansion of fault tolerance and fusing

With the strong development of cloud native, how should enterprises seize business opportunities

How to find out the function calling process of complex code running as soon as possible
随机推荐
L1-049 seat allocation of ladder race
6-16 vulnerability exploitation -rlogin maximum permission login
Shell script case ---2
[Commons beanautils topic] 004 beanautils topic
Wechat applet learning five page Jump methods
for mysql
Use abp Zero builds a third-party login module (III): web side development
Chapter 1 Introduction
Buckle practice - maximum number of 28 splices
try...finally总结
【C和指针第14章】预处理器
[data mining engineer - written examination] sheen company in 2022
Guys, do you need to configure anything to use rocksdb when using flinksql? Or do you need any jar packages
Online XML to CSV tool
Learn some programming: anti unemployment "vaccine"
Reserved instances & Savings Plans
JS image to Base64
STM32——C语言基础
Browser logic vulnerability collection
Why is the datetime type field 8 hours earlier when I use flinkcdc to read MySQL's binlog?