Теперь Кью работает в режиме чтения

Мы сохранили весь контент, но добавить что-то новое уже нельзя

Ошибка приложения,оно вылетает как исправить в андроид студио?

Я прописал код для передачи картинок в firebase storage.с использованнием библиотек cropper image и piccaso. 
Вот сам код
savenick_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (checker.equals("clicked")) {
ValidateControlers();
} else {
ValidateAndSaveOnlyInfo();
}
}
});
plusphoto.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
checker = "clicked";
CropImage.activity().setAspectRatio(1, 1).start(SettingaccActivity.this);
}
});
getUserInfo();
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE && resultCode == RESULT_OK && data != null) {
CropImage.ActivityResult result = CropImage.getActivityResult(data);
imageUri = result.getUri();
imageprof.setImageURI(imageUri);
} else {
Toast.makeText(this, "Произошла ошибка", Toast.LENGTH_SHORT).show();
}
}
private void ValidateControlers() {
if (TextUtils.isEmpty(nick_edit.getText().toString()))
Toast.makeText(this, "Введите ние", Toast.LENGTH_SHORT).show();
}
else if( checker.equals("clicked"))
{
uploadProfilImage();
}
private void uploadProfilImage() {
final ProgressDialog progressDialog=new ProgressDialog(this);
progressDialog.setTitle("Идет загрузка");
progressDialog.setMessage("Пожалуйста подождите");
progressDialog.show();
if (imageUri !=null){
final StorageReference fileRef= storageprofilpicsRef.child(mAuth.getCurrentUser().getUid()+"jpg");
uploadTask=fileRef.putFile(imageUri);
uploadTask.continueWithTask(new Continuation() {
@Override
public Object then(@NonNull Task task) throws Exception {
if (!task.isSuccessful()){
throw task.getException();
}
return fileRef.getDownloadUrl();
}
}).addOnCompleteListener(new OnCompleteListener<Uri>() {
@Override
public void onComplete(@NonNull Task <Uri>task) {
if (task.isSuccessful()){
Uri downloadUri=task.getResult();
myUri=downloadUri.toString();
HashMap<String,Object> userMap=new HashMap<>();
userMap.put("uid",mAuth.getCurrentUser().getUid());
userMap.put("name",nick_edit.getText().toString());
userMap.put("image",myUri);
databaseReference.child(mAuth.getCurrentUser().getUid()).updateChildren(userMap);
progressDialog.dismiss();
startActivity(new Intent(SettingaccActivity.this,HomeActivity.class));
}
}
});
}
else {
Toast.makeText(this, "Изображение не выбрано", Toast.LENGTH_SHORT).show();
}
}
private void ValidateAndSaveOnlyInfo() {
if (TextUtils.isEmpty(nick_edit.getText().toString()))
Toast.makeText(this, "Введите ние", Toast.LENGTH_SHORT).show();
}
else{
HashMap<String,Object> userMap=new HashMap<>();
userMap.put("uid",mAuth.getCurrentUser().getUid());
userMap.put("name",nick_edit.getText().toString());
databaseReference.child(mAuth.getCurrentUser().getUid()).updateChildren(userMap);
startActivity(new Intent(SettingaccActivity.this,HomeActivity.class));
}
private void getUserInfo() {
databaseReference.child(mAuth.getCurrentUser().getUid()).addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
if (snapshot.exists()&&snapshot.getChildrenCount()>0)
{
String name=snapshot.child("name").getValue().toString();
nick_edit.setText(name);
if (snapshot.hasChild("image")) {
String image = snapshot.child("image").getValue().toString();
Picasso.get().load(image).into(imageprof);
}
}
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
}
});
}.
И ошибка
Process: mychati.app, PID: 31163
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{mychati.app/mychati.app.SettingaccActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.pm.ApplicationInfo android.content.Context.getApplicationInfo()' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3455)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3699)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2135)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:236)
at android.app.ActivityThread.main(ActivityThread.java:8056)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:656)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.pm.ApplicationInfo android.content.Context.getApplicationInfo()' on a null object reference
at android.content.ContextWrapper.getApplicationInfo(ContextWrapper.java:184)
at android.view.ContextThemeWrapper.getTheme(ContextThemeWrapper.java:174)
at android.app.AlertDialog.resolveDialogTheme(AlertDialog.java:245)
at android.app.AlertDialog.<init>(AlertDialog.java:214)
at android.app.AlertDialog.<init>(AlertDialog.java:210)
at android.app.AlertDialog.<init>(AlertDialog.java:148)
at android.app.ProgressDialog.<init>(ProgressDialog.java:99)
at mychati.app.SettingaccActivity.uploadProfilImage(SettingaccActivity.java:117)
at mychati.app.SettingaccActivity.<init>(SettingaccActivity.java:113)
at java.lang.Class.newInstance(Native Method)
at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:95)
at androidx.core.app.CoreComponentFactory.instantiateActivity(CoreComponentFactory.java:45)
at android.app.Instrumentation.newActivity(Instrumentation.java:1254)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3443)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3699) 
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85) 
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) 
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2135) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loop(Looper.java:236) 
at android.app.ActivityThread.main(ActivityThread.java:8056) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:656) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967)
Пробовал переставлять скобки не помогли все равно вылетает при нажатии на кнопку которая ведёт на активити с этим кодом. Как это исправить?
AndroidМобильные приложения+2
Эрчим Шестаков
  ·   · 151