zoukankan      html  css  js  c++  java
  • android active间数据传递

    Bundle是key-value存储。

    Bundle bundle=new Bundle();
    bundle.putString("key", "value");
    Bundle bundle=new Bundle();
    bundle.putString("key", "value");
    Intent a= new Intent(this,TargetActivity.class);
    a.putExtras(bundle);

    如果不是在Activity类方法中,而是在其他类中,可以使用下面的方式声明Intent。

    public class ActivityInstance extends Activity{
    
    protected void onCreate(Bundle savedInstanceState) {}
    private class RegisterOnclick implements View.OnClickListener {
    public void onClick(View v) { 
     Intent a= new Intent(ActivityInstance.this,TargetActivity.class);   
    }}
    }

     这里涉及到如何获取Context.

  • 相关阅读:
    备用
    Python进阶
    *args 和 **kwargs
    C语言
    【Pythno库】-Re
    【C语言】-struct
    Django By Example
    字符串
    Python库
    【Keil】Keil5-改变字的大小和颜色
  • 原文地址:https://www.cnblogs.com/lucika/p/5691905.html
Copyright © 2011-2022 走看看