我有一个C程序:
#include <stdio.h>
int main(){
int b = 10; //assign the integer 10 to variable 'b'
int *a; //declare a pointer to an integer 'a'
a=(int *)&b; //Get the memory location of variable 'b' cast it
//to an int pointer and assign it to pointer 'a'
int *c; //declare a pointer to an integer 'c'
c=(int *)&a; //Get the memory location of variable 'a' which is
//a pointer to 'b'. Cast that to an int pointer
//and assign it to …
Run Code Online (Sandbox Code Playgroud) 所以我有一个int数组和一个微调器,我需要微调器来显示int数组的值.作为一个新手,我不知道如何将int数组添加到arrayadapter或simpleadapter.我也可以使用列表而不是数组,但它总是包含整数值.
mspin=(Spinner) findViewById(R.id.spinner1);
int[] items=new int[]{1,2,3,4};
ArrayAdapter<int[]> ad=new ArrayAdapter(this,android.R.layout.simple_spinner_item);
//ad.add(items); // this cause some value to be displayed, possible the id of the item.
mspin.setAdapter(ad);
Run Code Online (Sandbox Code Playgroud)
谢谢