at java.util.Arrays$ArrayList.get(Arrays.java:75)
Problem in Android application:
Solution: check code for set and get selection
E/AndroidRuntime(416): FATAL EXCEPTION: main
E/AndroidRuntime(416): java.lang.IndexOutOfBoundsException
E/AndroidRuntime(416): at java.util.Arrays$ArrayList.get(Arrays.java:75)
E/AndroidRuntime(416): at android.widget.ArrayAdapter.getItem(ArrayAdapter.java:298)
E/AndroidRuntime(416): at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:351)
E/AndroidRuntime(416): at android.widget.ArrayAdapter.getView(ArrayAdapter.java:323)
E/AndroidRuntime(416): at android.widget.Spinner.makeAndAddView(Spinner.java:192)
E/AndroidRuntime(416): at android.widget.Spinner.layout(Spinner.java:151)
E/AndroidRuntime(416): at android.widget.Spinner.onLayout(Spinner.java:115)
Solution: check code for set and get selection
// Spinner _spin1 contain only 49 items
// you can set max 48 ( range 0 - 48)
// 50 is IndexOutOfBoundsException
_spin1.setSelection(50);
396LW NO topic_id
AD
Další témata ....(Topics)
if , else if, else statement with string as a switch statement in Java example source code.
MainClass.java
MainClass.java
public class MainClass {
public static void main(String[] arg) {
String[] arrayOfString = {"nothing", "Hello", "people"
, "bye-bye", "hello", "world!", "end" };
for (int i = 0; i < arrayOfString.length; i++) {
if (arrayOfString[i].equals("Hello"))
System.out.println(arrayOfString[i]);
else if (arrayOfString[i].equals("people"))
System.out.println(arrayOfString[i]);
else if (arrayOfString[i].equals("hello"))
System.out.println(arrayOfString[i]);
else if (arrayOfString[i].equals("world!"))
System.out.println(arrayOfString[i]);
else // default
System.out.println("Default");
}
}
}
/*
Default
Hello
people
Default
hello
world!
Default
*/
Brand | Motorola |
Model (codename) | Droid Razr |
Price (cena, včetně DPH v KCZ) | 10800 / 06.2012 |
Display size in Inch (v palcích) | 4.3 |
Display-resolution | 540x960 |
Dotek-typ | capacitive |
CPU typ | TI 4430 |
CPU MHz | 1.2 GB |
CPU core | 2 |
L2 cache | |
RAM | 1024 |
ROM | 15600 |
GPU | SGX540 |
NenaMark2 Benchmark | |
GPU-GLBenchmark | 3299 |
Baterie mAh | 1780 |
Foto MPx | 8 |
Autofocus | AF |
Video | HD video 30 frames/s |
Official Android ICS | Google Android 2.3.5 (Gingerbread) |
CyanogenMod support | |
Dotek-prstů-max | 10 |
Display-ppi | 256 |
Display-retina | 79% |
Networks | |
Connectivity | GSM: 850/900/1800/1900 MHz, EDGE, GPRS 3G: 900/2100 MHz, HSDPA, HSUPA, HSPA+ Bluetooth: 4.0 (EDR, A2DP, FTP, PBAP, AVRCP) Wi-Fi: 802.11b/g/n PC: microUSB, USB 2.0, microHDMI Senzors: proximity, gyroskop, akcelerometr GPS: yes, A-GPS, digital compas |
Note | Super AMOLED Display |
Motorola Droid Razr image
Issue:
When using New Activity wizard, ADT 20 asked to install Android Support library version 8 even though version 9 has been installed.
Pressing "Install/Update" then ADT popup a window downloading Support library, when finished nothing happen.
Pressing "Check Again" does nothing.
If i restarting Eclipse again this problem.
Notice: If you install new version ADT or update via SDK Manager, open SDK Manager standalone and close Eclipse.
Workaround:
- Close Eclipse
- Open SDK Manager standalone (c:\Program Files\Android\android-sdk-windows\SDK Manager.exe)
- Check the checkbox and uninstall Extras -> Android Support Library.
- Check again Extras -> Android Support Library and install it
- Restart Eclipse
- Try to create new project
When using New Activity wizard, ADT 20 asked to install Android Support library version 8 even though version 9 has been installed.
Pressing "Install/Update" then ADT popup a window downloading Support library, when finished nothing happen.
Pressing "Check Again" does nothing.
If i restarting Eclipse again this problem.
Notice: If you install new version ADT or update via SDK Manager, open SDK Manager standalone and close Eclipse.
Workaround:
- Close Eclipse
- Open SDK Manager standalone (c:\Program Files\Android\android-sdk-windows\SDK Manager.exe)
- Check the checkbox and uninstall Extras -> Android Support Library.
- Check again Extras -> Android Support Library and install it
- Restart Eclipse
- Try to create new project
// warnning
private List list = new ArrayList();
// ok /put type of added object
private List<String> list = new ArrayList<String>();
Why the app selects data from basic layout folder if smallest width is higher then the number in folder name?
Example 1
layout-sw600dp values-sw600dp (smallest width sw for data usage from this folder is 600dp density independent pixel!!!!!)
Device screen resolution is 1200 x 900 px (pixel) Wow, app to be select data from sw600dp folder! Realy?
DPI of device screen - dot per inch (pixel per inch) is 480 pixel it is wery important number!
In our case smallest dimension of screen must be at least 1800 real - physical pixels (1800 px / 3 ratio(dpi/160) = 600 dp (dip density independend pixels) to be used data from folders values-sw600dp and layout-sw600dp.
Example 2 see Example 1 abouve
Device: Nexus 7 (2012) selected from Android Studio tool layout editor
Resolution: 800x1280 px
DPI: tvdpi (approximately 213dpi)
Ratio: 1.33 (213 / 160)
Smallest width in px: 800
Convert px to dp: 601.5 (800 / 1.33)
Result:Smallest width is 601.5dp The App to be used data from folders values-sw600dp and layout-sw600dp.
Example 1
layout-sw600dp values-sw600dp (smallest width sw for data usage from this folder is 600dp density independent pixel!!!!!)
Device screen resolution is 1200 x 900 px (pixel) Wow, app to be select data from sw600dp folder! Realy?
DPI of device screen - dot per inch (pixel per inch) is 480 pixel it is wery important number!
- App selects smallest dimension of screen. In our case 900 px
Medium screen have 160 dpi (The density-independent pixel is equivalent to one physical pixel on a 160 dpi screen, which is the baseline density assumed by the system for a "medium" density screen.). - App calculate ratio 480 / 160 = 3 (The conversion of dp units to screen pixels: px = dp * (dpi / 160))
- App calculate smallest dimesnion of screen in dp 900 / 3 = 300 dip or dp (density independed pixel).
- App selects data from basic values and layout folder because sw600dp is greater than 300dp.
In our case smallest dimension of screen must be at least 1800 real - physical pixels (1800 px / 3 ratio(dpi/160) = 600 dp (dip density independend pixels) to be used data from folders values-sw600dp and layout-sw600dp.
Example 2 see Example 1 abouve
Device: Nexus 7 (2012) selected from Android Studio tool layout editor
Resolution: 800x1280 px
DPI: tvdpi (approximately 213dpi)
Ratio: 1.33 (213 / 160)
Smallest width in px: 800
Convert px to dp: 601.5 (800 / 1.33)
Result:Smallest width is 601.5dp The App to be used data from folders values-sw600dp and layout-sw600dp.
Editace: 2014-02-15 20:32:53
Počet článků v kategorii: 396
Url:at-java-util-arraysarraylist-getarrays-java75