'Canhub image is not shown
I use canhub to crop image. Even I load the image, it is not shown. When I log the uri or canhub imageviewer, it is not null. I added the permissions and checked manually, there is no problem about permissions.
My main_activity.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.canhub.cropper.CropImageView
android:id="@+id/CropImageView"
android:layout_width="400dp"
android:layout_height="400dp"
android:layout_weight="1"
tools:ignore="MissingConstraints"
tools:layout_editor_absoluteX="5dp"
tools:layout_editor_absoluteY="61dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
and MainActivity.java
public class MainActivity extends AppCompatActivity {
CropImageView mCropImageView;
Uri mCropImageUri;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mCropImageView = (CropImageView)findViewById(R.id.CropImageView);
//ImageView test = findViewById(R.id.test);
Uri uri = Uri.parse("android.resource://com.example.testaygaz/drawable/bird.jpg");
Log.i("MainActivity",mCropImageView.toString());
//test.setImageURI(uri);
mCropImageView.setImageUriAsync(uri);
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
