abdallahalaraby / blink Goto Github PK
View Code? Open in Web Editor NEWAndroid library that enables users to take screenshots for Views and Activities.
Android library that enables users to take screenshots for Views and Activities.
If the view want to take screenshot is in a scrollview, and this view may be already scrolled and only show a part. When this, it may can't take a full picture of the view.
I want to capture the whole screen and use the library like this,
Bitmap bitmap = Screenshot.getInstance().takeScreenshotForScreen(MainActivity.this); String path = Environment.getExternalStorageDirectory().toString() + "/test"; Log.i(TAG, "onCreate: " + path); FileUtils.getInstance().storeBitmap(bitmap, path);
but failed and the log following
01-02 11:01:52.019 19258-19258/com.xugaoxiang.shottext E/AndroidRuntime: FATAL EXCEPTION: main Process: com.xugaoxiang.shottext, PID: 19258 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xugaoxiang.shottext/com.xugaoxiang.shottext.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) at android.app.ActivityThread.access$800(ActivityThread.java:151) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5254) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference at android.graphics.Bitmap.createBitmap(Bitmap.java:614) at com.xugaoxiang.shottext.Screenshot.takeScreenshotForView(Screenshot.java:37) at com.xugaoxiang.shottext.Screenshot.takeScreenshotForScreen(Screenshot.java:44) at com.xugaoxiang.shottext.MainActivity.onCreate(MainActivity.java:27) at android.app.Activity.performCreate(Activity.java:5995) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) at android.app.ActivityThread.access$800(ActivityThread.java:151) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5254) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.