Open punks1323 opened 6 years ago
@punks1323 Can you show me the error log? I need it to locate the error place.
Hi,
Extremely sorry for the delayed response. PFA Crash log with source code used.
Source Code which I have used is :
private void MakeBudgetRangeReady() {
try {
ArrayList
for (int i = 0; i < 100; i++) {
options1Items.add("i " + i);
}
for (int i = 0; i < 100; i++) {
ArrayList<String> options2Items_01 = new ArrayList<>();
for (int j = 0; j < 100; j++) {
options2Items_01.add("j " + j);
}
options2Items.add(options2Items_01);
}
for (int i = 0; i < 100; i++) {
ArrayList<ArrayList<String>> options2Items_01 = new ArrayList<>();
for (int j = 0; j < 100; j++) {
ArrayList<String> options2Items_02 = new ArrayList<>();
for (int k = 0; k < 100;k++) {
options2Items_02.add("k " + k);
}
options2Items_01.add(options2Items_02);
}
options3Items.add(options2Items_01);
}
OptionsPickerView budgetOptions = new
OptionsPickerView.Builder(context, new OptionsPickerView.OnOptionsSelectListener() { @Override public void onOptionsSelect(int options1, int options2, int options3, View v) { Log.i(TAG, "onOptionsSelect: " + options1 + "\t" + options2 + "\t" + options3); } }) .setTitleText("城市选择") .setContentTextSize(20)//设置滚轮文字大小 .setDividerColor(Color.LTGRAY)//设置分割线的颜色 .setSelectOptions(0, 1)//默认选中项 .setBgColor(Color.BLACK) .setTitleBgColor(Color.DKGRAY) .setTitleColor(Color.LTGRAY) .setCancelColor(Color.YELLOW) .setSubmitColor(Color.YELLOW) .setTextColorCenter(Color.LTGRAY) .isCenterLabel(false) //是否只显示中间选中项的label文字,false则每项item全部都带有label。 //.setLabels("省", "市", "区") .setBackgroundId(0x66000000) //设置外部遮罩颜色 .build();
//pvOptions.setSelectOptions(1,1);
budgetOptions.setPicker(options1Items, options2Items,
options3Items);//三级选择器 budgetOptions.show(); } catch (Exception e) { e.printStackTrace(); }
}
[image: Inline image 1]
Note : It works fine on some better performance devices but on fewer devices which i have used for testing like Samsung Mega 5.8(Jelly Bean) or YU5010(Lollipop 5.0.1) it crashes with the given Log.
On Tue, Dec 19, 2017 at 7:05 AM, xiaosongzeem notifications@github.com wrote:
@punks1323 https://github.com/punks1323 Can you show me the error log? I need it to locate the error place.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Bigkoo/Android-PickerView/issues/458#issuecomment-352612400, or mute the thread https://github.com/notifications/unsubscribe-auth/AQmPgvxGnz5HqIJfQPS7QpJGCjWU6cAnks5tBxLHgaJpZM4RFlBu .
@punks1323 Time consuming processing cannot be done in the main thread,so you need do like this( pseudo code ):
runOnBackgroundThread(){
// step one : init data source.
// step two : init picker view.
// call runOnUiThread();
}
runOnUiThread(){
// step three : show picker view.
}
it is giving OutOfMemoryError and crashing if items are more than 100, there is no ArrayIndexOutOfBoundException. Please help