error new version 1.1.7
hvar90 opened this issue · 2 comments
hvar90 commented
with 1.1.5 works well but it fail with 1.1.7
java.lang.NullPointerException at
petrov.kristiyan.colorpicker.ColorPicker.dismissDialog(ColorPicker.java:502)
at petrov.kristiyan.colorpicker.ColorPicker.setOnFastChooseColorListener(ColorPicker.java:355)
at myPackage.ChatActivity.onOptionsItemSelected(ChatActivity.java:1257)
final ColorPicker colorPicker = new ColorPicker(this);
final int init_color;
if (Build.VERSION.SDK_INT < 23)
init_color=getResources().getColor(R.color.color1);
else
init_color=getResources().getColor(R.color.color1,getTheme());
colorPicker.setTitle(getString(R.string.chooseColor));
colorPicker.setRoundColorButton(true);
colorPicker.setColors(R.array.color_chat_values);
//////here is the bug////////
colorPicker.setOnFastChooseColorListener(new ColorPicker.OnFastChooseColorListener() {
@Override
public void setOnFastChooseColorListener(int position, int color) {
SharedPreferences sharedPreferences =
PreferenceManager.getDefaultSharedPreferences(ChatActivity.this);
SharedPreferences.Editor editor = sharedPreferences.edit();
//posicion empieza desde cero
editor.putInt(QuickstartPreferences.THEME_CHAT,position);
editor.putInt(QuickstartPreferences.COLOR_CHAT,color);
editor.commit();
recreate();
}
@Override
public void onCancel(){
// put code
}
}).setDefaultColorButton(
PreferenceManager.getDefaultSharedPreferences(this)
.getInt(QuickstartPreferences.COLOR_CHAT,init_color)).setColumns(4).show();
naishadhparmar commented
Can you show what recreate()
does?
hvar90 commented
recreate is a method from Android Framework
https://developer.android.com/reference/android/app/Activity.html#recreate%28%29