开发者

Java android put a variable to find a spinner id

开发者 https://www.devze.com 2023-04-11 02:26 出处:网络
I have a xml layout where is my spinner with id \"test\" How can I put my variable \"IdSpinner\" into R object.

I have a xml layout where is my spinner with id "test"

How can I put my variable "IdSpinner" into R object.

I want to make a common method to create a lot of spinners ,where arg开发者_开发问答ument is a spinner id.

listLanguage('test');

public void listLanguage(String test) {
   final Spinner spinnerLanguage = (Spinner) findViewById(R.id....);
}


You can't do it in this way (if I understood correctly)- I mean put idSpinner in R.id..., use another approach - just create dynamically Spinner object, in this case you can create as much Spinners as you want.

0

精彩评论

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

关注公众号