开发者

Set private integer to another private integer

开发者 https://www.devze.com 2023-03-28 08:47 出处:网络
How do you set the value of one private integer to another? i.e: private Integer [] mOne = {R.string.1, R.string.2};

How do you set the value of one private integer to another? i.e:

private Integer [] mOne = {R.string.1, R.string.2};

to be-->

开发者_开发技巧private Integer [] mTwo = {Integer mOne[]};

except that code doesn't work. the point being to have mTwo = {R.string.1,R.string.2} without having to explicitly write that...

I know what I want to say, just don't know how to say it! thanks for your help


private Integer[] mTwo = mOne;

This creates a reference. If you need a copy:

private Integer[] mTwo = mOne.clone();


This should work:

private Integer [] mTwo = mOne;
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号