zoukankan      html  css  js  c++  java
  • intent bundle的使用

    1、什么是bundle

          Bundle主要用于传递数据;它保存的数据,是以key-value(键值对)的形式存在的。我们经常使用Bundle在Activity之间传递数据,传递的数据可以是boolean、

          byte、int、long、float、double、string等基本类型或它们对应的数组,也可以是对象或对象数组。当Bundle传递的是对象或对象数组时,必须实现Serializable 

          或Parcelable接口。

    2、写数据

          Bundle bundle = new Bundle();

          bundle.putString("name", "skywang");

          bundle.putInt("height", 175);

          intent.putExtras(bundle);

    3、读数据

          Bundle bundle = this.getIntent().getExtras();

          String name = bundle.getString("name");

          int height = bundle.getInt("height");

       关于Intent的使用:

        1、写数据:intent.putExtra("key",value);

        2、读数据:String str=getIntent().getExtras().getString("name",default);

     

  • 相关阅读:
    CORS实践
    xunsearch使用记录
    apk的php解析
    MYSQLI_USE_RESULT or MYSQLI_STORE_RESULT
    企业图谱
    《软件需求工程》阅读笔记03
    2020年下半年学习进度12
    《软件需求工程》阅读笔记02
    2020年下半年学习进度11
    《软件需求工程》阅读笔记01
  • 原文地址:https://www.cnblogs.com/judes/p/5796466.html
Copyright © 2011-2022 走看看