indexoutofboundsexception

    -2热度

    2回答

    我工作的一个Android应用程序,并且从下面的代码段得到一个奇怪的ArrayIndexOutOfBoundsException异常: String[] temp = q[i].answers;//retrieves a String array String answers = ""; if (temp != null) { if (temp.length > 0) {

    0热度

    3回答

    我有一个方法来刷新UIScrollView的内容。在ScrollView中有几个UIImageViews和一些UILabels。 我做清洁滚动视图的内容与下面的代码: for (int i = [publicationsScrollView.subviews count] -1; i>=0; i--) { NSLog(@"Deleting SubView: %@", [[publicat

    1热度

    1回答

    我使用MessageDigest来计算我的项目中的md5签名,但在性能测试期间它会抛出ArrayIndexOutOfBoundsException。 我发现一些帖子暗示这是因为MessageDigest是单身人士,而不是线程安全的。有谁知道我能如何解决这个问题,或者如果有一个线程安全的等效MessageDigest类?

    1热度

    2回答

    用户在我的程序启动时报告了异常结束。堆栈跟踪是: Loc 1: Classes.Get (3368, 2) Loc 2: Behold (58, 18) 我以前从来没有看到这个问题,并没有其他的用户曾报道这对我来说,我的用户说,到目前为止,这是他有这唯一的一次。 我的程序中的第18行仅仅是我的Application.Run对于我的程序的声明。 在Classes 3368线是在错误的语句: f

    0热度

    1回答

    每当我尝试访问一个联系人的号码,我得到一个索引越界异常,任何人都可以告诉我,我在这里做错了什么。类的 成员 private String[] names; private String[] number; 在我的onCreate ContentResolver cr = getContentResolver(); Cursor cur = cr.query(ContactsCont

    1热度

    3回答

    运行这段代码给了我一个数组越界异常在该行: int sum = array[k]+array[l]; //sum of l and k ...应该是一个简单的修复,但我想不出什么可以导致它,因为我使用array.length来绑定循环。谁能帮忙? P.S.对于记录来说,这段代码应该搜索一个int数组,以获得等于目标int的整数或单个整数。它仅使用println的工作,但我试图将加入目标的数字放

    1热度

    2回答

    当我运行下面的代码片段时,抛出了IndexOutOfRangeException。看起来,当抛出异常时,我是2。我的理解是,新的线程在i的值被改变后开始。有没有办法让这个代码安全的这种问题? int x[2] = {1, 3}; int numberOfThreads = 2; for (int i = 0; i < numberOfThreads; i++) { new Thr

    2热度

    1回答

    java.lang.ArrayIndexOutOfBoundsException at com.google.googlenav.map.Map.drawMapBackground(Unknown Source) at com.google.googlenav.map.Map.preLoad(Unknown Source) at com.google.android.maps.MapCont

    0热度

    1回答

    public static void bubbleSort(Farm a[], int n) { String[] animals = getString(a); for(int i = 0; i < n - 1; i++) { boolean swapped = false; for(int j = 0; j < n - 1 - i; j++) { int

    3热度

    2回答

    我有一个Java类 public class MsgLayout{ int field1; String field2; long field3; } 我必须写此对象在插座输出流的字节数组。三个字段(实例变量)具有布局。即field1必须占用1个字节,field2必须占用4个字节,而field3必须占用8个字节。 ByteBuffer bbf = ByteBuffer.allocate