Pass 2D array to another Activity

后端 未结 5 1980
猫巷女王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:25

    one Solution is that you can set it as Static so that you can use that in any of your activity.

    Class A{
     public static String [][]str;
    ...
        Intent l = new Intent(context,AgAppMenu.class);
                     l.putExtra("msg",str);
                     l.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);   
                     context.startActivity(l);
    
    
    }
    
    Class B{
    
    ...
    you can use it with Just A.(ArrayName)
    System.out.println(A.str);
    
    }
    

    Hope it will Help you.

提交回复
热议问题