Pass 2D array to another Activity

后端 未结 5 1983
猫巷女王i
猫巷女王i 2020-11-30 12:43

how do i pass 2 denominational array object as a parameter to another activity

how to get two dimensional array string value in another activity

   S         


        
5条回答
  •  庸人自扰
    2020-11-30 13:33

    set the 2darray as public static void. let current_class be the class in which we create our 2d array We want to pass the data to NewActivity

    Class ourClass=Class.forName("com.example.testapp.NewActivity");
    Intent ourIntent= new Intent(current_class.this,ourClass);
    intent_name.putExtra("name", 2darray_name);
    startActivity(ourIntent);`
    

    to access this in NewActivity , use current_class.2darray_name where current_class is the class where it was originally defined.

提交回复
热议问题