Example usage for android.widget ArrayAdapter ArrayAdapter

List of usage examples for android.widget ArrayAdapter ArrayAdapter

Introduction

In this page you can find the example usage for android.widget ArrayAdapter ArrayAdapter.

Prototype

public ArrayAdapter(@NonNull Context context, @LayoutRes int resource, @NonNull List<T> objects) 

Source Link

Document

Constructor

Usage

From source file:com.max2idea.android.limbo.main.LimboActivity.java

private void populateNetDevices() {
    String[] arraySpinner = { "e1000", "pcnet", "rtl8139", "ne2k_pci", "i82551", "i82557b", "i82559er",
            "virtio" };
    // Arm supports only smc91c111 so it's used by default

    nicCfgAdapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, arraySpinner);
    nicCfgAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    this.mNetDevices.setAdapter(nicCfgAdapter);
    this.mNetDevices.invalidate();
}

From source file:com.max2idea.android.limbo.main.LimboActivity.java

private void populateMachines() {
    this.userPressedMachine = false;
    // Add from History
    ArrayList<String> machines = machineDB.getMachines();
    int length = 0;
    if (machines == null || machines.size() == 0) {
        // Log.v(TAG, "No machine in DB");
        length = 0;//from   www . j  a  v a  2s . c o m
    } else {
        // Log.v("PopMachines", "Found " + length + " machines in DB");
        length = machines.size();
    }

    String[] arraySpinner = new String[machines.size() + 2];
    arraySpinner[0] = "Open";
    arraySpinner[1] = "New";
    int index = 2;
    Iterator i = machines.iterator();
    while (i.hasNext()) {
        String file = (String) i.next();
        if (file != null) {
            arraySpinner[index++] = file;
        }
    }

    machineAdapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, arraySpinner);
    machineAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    this.mMachine.setAdapter(machineAdapter);
    this.mMachine.invalidate();

}

From source file:com.max2idea.android.limbo.main.LimboActivity.java

private void populateCPUs() {
    this.userPressedCPU = false;
    Log.v("populateCPUs", "set userPressed = " + this.userPressedCPU);

    String[] arraySpinner = {//from ww  w . j av  a 2  s  .co m
            // x86 32bit
            "Default (x86)", "qemu32", "coreduo", "486", "pentium", "pentium2", "pentium3", "athlon", "n270",

            // x86 (64Bit)
            "Default (64Bit)", "qemu64 (64Bit)", "phenom (64Bit)", "core2duo (64Bit)", "kvm64 (64Bit)"

    };

    ArrayList<String> arrList = new ArrayList<String>(Arrays.asList(arraySpinner));

    if (Const.enable_ARM) {
        arrList.add("Default (arm)");
        arrList.add("arm926 (arm)");
        arrList.add("arm946 (arm)");
        arrList.add("arm1026 (arm)");
        // "arm1136 (arm)", "arm1136-r2 (arm)", "arm1176 (arm)",
        // "arm11mpcore (arm)", "cortex-m3 (arm)", "cortex-a8 (arm)",
        // "cortex-a8-r2 (arm)", "cortex-a9 (arm)", "cortex-a15 (arm)",
        // "ti925t (arm)", "pxa250 (arm)", "sa1100 (arm)", "sa1110 (arm)",
        // "pxa255 (arm)", "pxa260 (arm)", "pxa261 (arm)", "pxa262 (arm)",
        // "pxa270 (arm)", "pxa270-a0 (arm)", "pxa270-a1 (arm)",
        // "pxa270-b0 (arm)", "pxa270-b1 (arm)", "pxa270-c0 (arm)",
        // "pxa270-c5 (arm)", "any (arm)"

    }

    cpuAdapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, arrList);

    cpuAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    this.mCPU.setAdapter(cpuAdapter);

    this.mCPU.invalidate();

}

From source file:com.max2idea.android.limbo.main.LimboActivity.java

private void populateMachineType() {
    this.userPressedMachineType = false;

    String[] arraySpinner = { "None",
            // "beagle - Beagle board (OMAP3530)",
            // "beaglexm - Beagle board XM (OMAP3630)",
            // "collie - Collie PDA (SA-1110)",
            // "nuri - Samsung NURI board (Exynos4210)",
            // "smdkc210 - Samsung SMDKC210 board (Exynos4210)",
            // "connex - Gumstix Connex (PXA255)",
            // "verdex - Gumstix Verdex (PXA270)",
            // "highbank - Calxeda Highbank (ECX-1000)",
            // "integratorcp - ARM Integrator/CP (ARM926EJ-S) (default)",
            // "mainstone - Mainstone II (PXA27x)",
            // "musicpal - Marvell 88w8618 / MusicPal (ARM926EJ-S)",
            // "n800 - Nokia N800 tablet aka. RX-34 (OMAP2420)",
            // "n810 - Nokia N810 tablet aka. RX-44 (OMAP2420)",
            // "n900 - Nokia N900 (OMAP3)",
            // "sx1 - Siemens SX1 (OMAP310) V2",
            // "sx1-v1 - Siemens SX1 (OMAP310) V1",
            // "overo - Gumstix Overo board (OMAP3530)",
            // "cheetah - Palm Tungsten|E aka. Cheetah PDA (OMAP310)",
            // "realview-eb - ARM RealView Emulation Baseboard (ARM926EJ-S)",
            // "realview-eb-mpcore - ARM RealView Emulation Baseboard (ARM11MPCore)",
            // "realview-pb-a8 - ARM RealView Platform Baseboard for Cortex-A8",
            // "realview-pbx-a9 - ARM RealView Platform Baseboard Explore for Cortex-A9",
            // "akita -  Akita PDA (PXA270)",
            // "spitz - Spitz PDA (PXA270)",
            // "borzoi - Borzoi PDA (PXA270)",
            // "terrier - Terrier PDA (PXA270)",
            // "lm3s811evb - Stellaris LM3S811EVB",
            // "lm3s6965evb - Stellaris LM3S6965EVB",
            // "tosa - Tosa PDA (PXA255)",
            "versatilepb - ARM Versatile/PB (ARM926EJ-S)",
            // "versatileab - ARM Versatile/AB (ARM926EJ-S)",
            // "vexpress-a9 - ARM Versatile Express for Cortex-A9",
            // "vexpress-a15 - ARM Versatile Express for Cortex-A15",
            // "z2 - Zipit Z2 (PXA27x)",
    };/*  w w w  .  j a v a  2 s.  c  om*/

    machineTypeAdapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, arraySpinner);
    machineTypeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    this.mMachineType.setAdapter(machineTypeAdapter);
    this.mMachineType.invalidate();
}

From source file:com.max2idea.android.limbo.main.LimboActivity.java

private void populateUI() {
    this.userPressedUI = false;

    String[] arraySpinner = { "VNC", "SDL" };

    uiAdapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, arraySpinner);
    uiAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    this.mUI.setAdapter(uiAdapter);
    this.mUI.invalidate();
}

From source file:com.max2idea.android.limbo.main.LimboActivity.java

private void populateKernel() {
    // Add from History
    ArrayList<String> kernels = favDB.getFavURL("kernel");
    int length = 0;
    if (kernels == null || kernels.size() == 0) {
        length = 0;//w  w  w. j  a v a  2s. c o  m
    } else {
        length = kernels.size();
    }

    ArrayList<String> arraySpinner = new ArrayList<String>();
    arraySpinner.add("None");
    arraySpinner.add("Open");
    Iterator i = kernels.iterator();
    while (i.hasNext()) {
        String file = (String) i.next();
        if (file != null) {
            arraySpinner.add(file);
        }
    }

    kernelAdapter = new ArrayAdapter(this, R.layout.custom_spinner_item, arraySpinner);
    kernelAdapter.setDropDownViewResource(R.layout.custom_spinner_dropdown_item);
    this.mKernel.setAdapter(kernelAdapter);
    this.mKernel.invalidate();

}

From source file:com.max2idea.android.limbo.main.LimboActivity.java

private void populateInitrd() {
    // Add from History
    ArrayList<String> initrds = favDB.getFavURL("initrd");
    int length = 0;
    if (initrds == null || initrds.size() == 0) {
        length = 0;/*from  ww w  .j  a  va2  s.co m*/
    } else {
        length = initrds.size();
    }

    ArrayList<String> arraySpinner = new ArrayList<String>();
    arraySpinner.add("None");
    arraySpinner.add("Open");
    Iterator i = initrds.iterator();
    while (i.hasNext()) {
        String file = (String) i.next();
        if (file != null) {
            arraySpinner.add(file);
        }
    }

    initrdAdapter = new ArrayAdapter(this, R.layout.custom_spinner_item, arraySpinner);
    initrdAdapter.setDropDownViewResource(R.layout.custom_spinner_dropdown_item);
    this.mInitrd.setAdapter(initrdAdapter);
    this.mInitrd.invalidate();

}

From source file:com.max2idea.android.limbo.main.LimboActivity.java

private void populateHD(String fileType) {
    // Add from History
    ArrayList<String> oldHDs = favDB.getFavURL(fileType);
    int length = 0;
    if (oldHDs == null || oldHDs.size() == 0) {
        length = 0;//from  ww w . j a  v  a 2s  . c  o  m
    } else {
        length = oldHDs.size();
    }

    ArrayList<String> arraySpinner = new ArrayList<String>();
    arraySpinner.add("None");
    arraySpinner.add("New");
    arraySpinner.add("Open");
    Iterator i = oldHDs.iterator();
    while (i.hasNext()) {
        String file = (String) i.next();
        if (file != null) {
            arraySpinner.add(file);
        }
    }

    if (fileType.equals("hda")) {

        hdaAdapter = new ArrayAdapter(this, R.layout.custom_spinner_item, arraySpinner);
        hdaAdapter.setDropDownViewResource(R.layout.custom_spinner_dropdown_item);
        this.mHDA.setAdapter(hdaAdapter);
        this.mHDA.invalidate();
    } else if (fileType.equals("hdb")) {
        hdbAdapter = new ArrayAdapter(this, R.layout.custom_spinner_item, arraySpinner);
        hdbAdapter.setDropDownViewResource(R.layout.custom_spinner_dropdown_item);
        this.mHDB.setAdapter(hdbAdapter);
        this.mHDB.invalidate();
    }
}

From source file:com.max2idea.android.limbo.main.LimboActivity.java

private void populateSnapshot() {
    // Add from History
    ArrayList<String> oldSnapshots = null;
    if (currMachine != null) {
        oldSnapshots = machineDB.getSnapshots(currMachine);
    }//  ww  w. ja v a  2  s .co m

    int length = 0;
    if (oldSnapshots == null) {
        length = 0;
    } else {
        length = oldSnapshots.size();
    }

    ArrayList<String> arraySpinner = new ArrayList<String>();
    arraySpinner.add("None");
    if (oldSnapshots != null) {
        Iterator i = oldSnapshots.iterator();
        while (i.hasNext()) {
            String file = (String) i.next();
            if (file != null) {
                arraySpinner.add(file);
            }
        }
    }
    this.userPressedSnapshot = false;

    snapshotAdapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, arraySpinner);
    snapshotAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    this.mSnapshot.setAdapter(snapshotAdapter);
    this.mSnapshot.invalidate();

    if (oldSnapshots == null) {
        this.mSnapshot.setEnabled(false);
    } else {
        this.mSnapshot.setEnabled(true);
    }

}

From source file:com.max2idea.android.limbo.main.LimboActivity.java

private void populateCDRom(String fileType) {
    this.userPressedCDROM = false;
    // Add from History
    ArrayList<String> oldCDs = favDB.getFavURL(fileType);
    int length = 0;
    if (oldCDs == null || oldCDs.size() == 0) {
        length = 0;//from   ww  w  . ja v a2s.com
    } else {
        length = oldCDs.size();
    }

    ArrayList<String> arraySpinner = new ArrayList<String>();
    arraySpinner.add("None");
    arraySpinner.add("Open");
    if (oldCDs != null) {
        Iterator i = oldCDs.iterator();
        while (i.hasNext()) {
            String file = (String) i.next();
            if (file != null) {
                arraySpinner.add(file);
            }
        }
    }
    cdromAdapter = new ArrayAdapter(this, R.layout.custom_spinner_item, arraySpinner);
    cdromAdapter.setDropDownViewResource(R.layout.custom_spinner_dropdown_item);
    this.mCD.setAdapter(cdromAdapter);
    this.mCD.invalidate();
}