@Artutit

Почему не работает cropimage?

public class ProfilRegsetActivity extends AppCompatActivity {
    private ImageView imageprofilreguser;
    private EditText editnameregsett;
    private Button buttonsavesetreguser,buttonnosettreguser;
    private DatabaseReference databaseReference;
    private FirebaseAuth mAuth;
    private Uri imageUri=null;
    private String myUri="";
    private StorageTask uploadTask;
    private StorageReference storageProfilePicsRef;
    private static final int GalleryCode=1;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_profil_regset);
        mAuth=FirebaseAuth.getInstance();
        databaseReference= FirebaseDatabase.getInstance().getReference().child("User");
        storageProfilePicsRef= FirebaseStorage.getInstance().getReference().child("Profile Pic");
        imageprofilreguser=(ImageView) findViewById(R.id.imageprofilreguser);
        buttonnosettreguser=(Button) findViewById(R.id.buttonnosettreguser);
        buttonsavesetreguser=(Button) findViewById(R.id.buttonsavesetreguser);

        buttonnosettreguser.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent noIntent=new Intent(ProfilRegsetActivity.this,HomeActivity.class);
                startActivity(noIntent);
            }
        });
        buttonsavesetreguser.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                uploadProfileImage();
            }
        });
        imageprofilreguser.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
               Intent gaIntent=new Intent(Intent.ACTION_GET_CONTENT);
               gaIntent.setType("image/*");
               startActivityForResult(gaIntent,GalleryCode);
            }
        });
    }

    private void uploadProfileImage() {
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        if (requestCode==GalleryCode&&resultCode==RESULT_OK);
        {
           imageUri=data.getData();

            CropImage.activity()
                    .setGuidelines(CropImageView.Guidelines.ON)
                    .start(this);
        }
        if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) {
            CropImage.ActivityResult result = CropImage.getActivityResult(data);
            if (resultCode == RESULT_OK) {
                Uri resultUri = result.getUri();
                imageprofilreguser.setImageURI(imageUri);
            } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) {
                Exception error = result.getError();
            }
    }
}

Сюда снизу встроил cropimage и хотел сделать его для редактирования фото перед публикацией в storage firebase.но он не работает. Код кропа взят с GitHub и немного изменён под себя. В манифест все что надо тоже встроил и в gradle тоже. Как исправить?
  • Вопрос задан
  • 38 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы