小编Ala*_*Lai的帖子

如何将Spinner选中的项值变为字符串?

我有5个Spinners.为了对此进行总结.

这是xml中的Spinner

<Spinner
            android:id="@+id/text_interested"
            android:layout_span="2"
            android:layout_width="wrap_content"
            android:layout_height="60px"
            android:entries="@array/interestedarrays"
            android:prompt="@string/interestedprompt" />
Run Code Online (Sandbox Code Playgroud)

这是Java中的Spinner

submitbtn.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
interested.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
                        public void onItemSelected(
                                AdapterView<?> adapterView, View view,
                                int i, long l) {
                            interesting = interested.getItemAtPosition(i).toString();
                        }

                        public void onNothingSelected(
                                AdapterView<?> adapterView) {

                        }
                    });
    }
});
Run Code Online (Sandbox Code Playgroud)

这里的解释:

该页面有一个按钮.按下此按钮将从微调器读取数据.我用这个检查了输出

System.out.println(interested.getItemAtPosition(i).toString());
Run Code Online (Sandbox Code Playgroud)

它甚至没有给我任何东西.

如何检索值并将其串起来?

android android-spinner

74
推荐指数
8
解决办法
20万
查看次数

Blackberry res文件夹命名约定

我创建了这样的静态函数.

public static Bitmap Bitmap(String path) {
    Bitmap bitmap = Bitmap
            .getBitmapResource(Display.getWidth() + "/" + path);
    System.out.println(Display.getWidth() + "" + path);
    return bitmap;
}
Run Code Online (Sandbox Code Playgroud)

但是,当我打电话的时候,

private Bitmap download = Config_GlobalFunction.Bitmap("btn_download.png");
Run Code Online (Sandbox Code Playgroud)

输出给了我FRIDG could not find 320/btn_download.png.

在我的res文件夹中,我得到了这是一个文件夹,img并且内部img有哪些人6个不同的文件夹160,240,320,360,480640文件夹.

如何根据Display.getWidth()?调用正确的文件夹图像?

blackberry naming-conventions

2
推荐指数
1
解决办法
636
查看次数

命中ClassCastException

我打电话给这个班级PopupScreen.

public class Custom_LoadingScreen extends PopupScreen {
private VerticalFieldManager vfm;
private Util_AnimateGifField anmtFldCycle = null;
private GIFEncodedImage gifImgCycle;

public Custom_LoadingScreen() {
    super(new VerticalFieldManager());
    Background bg = BackgroundFactory.createSolidTransparentBackground(
            Color.BLACK, 190);
    setBackground(bg);
    setBorder(BorderFactory.createSimpleBorder(new XYEdges(),
            Border.STYLE_TRANSPARENT));

    gifImgCycle = (GIFEncodedImage) GIFEncodedImage
            .getEncodedImageResource("LoadingSpinner.gif");
    anmtFldCycle = new Util_AnimateGifField(gifImgCycle,
            Field.FIELD_HCENTER);

    vfm = new VerticalFieldManager(USE_ALL_WIDTH) {
        protected void sublayout(int maxWidth, int maxHeight) {
            super.sublayout(Display.getWidth(), Display.getHeight());
            setExtent(Display.getWidth(), Display.getHeight());
        }
    };
    int padding = (Display.getHeight() - 16) / 2;
    if (padding > 0) {
        anmtFldCycle.setPadding(padding, 0, 0, 0); …
Run Code Online (Sandbox Code Playgroud)

blackberry popup classcastexception

1
推荐指数
1
解决办法
236
查看次数