Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a crash in use #2

Open
guoruidong opened this issue Aug 4, 2017 · 1 comment
Open

a crash in use #2

guoruidong opened this issue Aug 4, 2017 · 1 comment

Comments

@guoruidong
Copy link

use in activity,
1、onCreate only findViewById(),to select picture in galleryor camera
cropPhotoView = (EditPhotoView) findViewById(R.id.crop_photo_view);
cropPhotoView.setOnBoxChangedListener(new OnBoxChangedListener() {
@OverRide
public void onChanged(int x1, int y1, int x2, int y2) {
//TODO: cropping box updated
Log.e("GRD_CROP_","("+x1+","+y1+");("+x2+","+y2+").");
}
});
,2、last onActivityResult to EditableImage editableImage = new EditableImage("/storage/emulated/0/DCIM/IMG_-741262829.jpg");
editableImage.setBox(new ScalableBox(25,25,200,200));
cropPhotoView.initView(this,editableImage);
it will crash,log
java.lang.NullPointerException: Attempt to invoke virtual method 'int me.littlecheesecake.croplayout.model.ScalableBox.getY1()' on a null object reference
at me.littlecheesecake.croplayout.SelectionView.drawShadow(SelectionView.java:142)
at me.littlecheesecake.croplayout.SelectionView.onDraw(SelectionView.java:133)
at android.view.View.draw(View.java:16184)
at android.view.View.updateDisplayListIfDirty(View.java:15180)
at android.view.View.draw(View.java:15954)
at android.view.ViewGroup.drawChild(ViewGroup.java:3609)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3399)
at android.view.View.draw(View.java:16187)
at android.view.View.updateDisplayListIfDirty(View.java:15180)
at android.view.View.draw(View.java:15954)
at android.view.ViewGroup.drawChild(ViewGroup.java:3609)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3399)
at android.view.View.updateDisplayListIfDirty(View.java:15175)
at android.view.View.draw(View.java:15954)
at android.view.ViewGroup.drawChild(ViewGroup.java:3609)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3399)
at android.view.View.updateDisplayListIfDirty(View.java:15175)
at android.view.View.draw(View.java:15954)
at android.view.ViewGroup.drawChild(ViewGroup.java:3609)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3399)
at android.view.View.updateDisplayListIfDirty(View.java:15175)
at android.view.View.draw(View.java:15954)
at android.view.ViewGroup.drawChild(ViewGroup.java:3609)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3399)
at android.view.View.updateDisplayListIfDirty(View.java:15175)
at android.view.View.draw(View.java:15954)
at android.view.ViewGroup.drawChild(ViewGroup.java:3609)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3399)
at android.view.View.updateDisplayListIfDirty(View.java:15175)
at android.view.View.draw(View.java:15954)
at android.view.ViewGroup.drawChild(ViewGroup.java:3609)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3399)
at android.view.View.draw(View.java:16187)
at com.android.internal.policy.PhoneWindow$DecorView.draw(PhoneWindow.java:2690)
at android.view.View.updateDisplayListIfDirty(View.java:15180)
at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:281)
at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:287)
at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:322)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:2615)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2434)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2067)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1107)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6013)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
at android.view.Choreographer.doCallbacks(Choreographer.java:670)
at android.view.Choreographer.doFrame(Choreographer.java:606)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

but if I use like this
cropPhotoView = (EditPhotoView) findViewById(R.id.crop_photo_view);
EditableImage editableImage = new EditableImage("/storage/emulated/0/DCIM/IMG_-741262829.jpg");
editableImage.setBox(new ScalableBox(25,25,200,200));

            cropPhotoView.initView(this,editableImage);
            cropPhotoView.setOnBoxChangedListener(new OnBoxChangedListener() {
                @Override
                public void onChanged(int x1, int y1, int x2, int y2) {
                    //TODO: cropping box updated
                    Log.e("GRD_CROP_","("+x1+","+y1+");("+x2+","+y2+").");
                }
            });
        }

it will runing ,but cant change picture in onactivityresult

@dijiubuzhan
Copy link

update to me.littlecheesecake:croplayout:1.1.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants