android - Crop Bitmap 150dp from Bottom of Screen to Top of Screen -


i use screen capture, , want crop bitmap programatically 150dp bottom of screen. (erase bitmap 150dp bottom of screen)

how that?

this image explanation: http://imgur.com/tp2ouvp

edited. full code take screen shot:

public void takescreenshot() {     date = new date();     android.text.format.dateformat.format("yyyy-mm-dd_hh:mm:ss", now);      try {          string folder_main = "app_folder";         file f = new file(environment.getexternalstoragedirectory(), folder_main);         if (!f.exists()) {             f.mkdirs();         }          // image naming , path  include sd card  appending name choose file         string mpath = environment.getexternalstoragedirectory().tostring() + "/app_folder/" + + ".jpg";          // create bitmap screen capture         view v1 = getwindow().getdecorview().getrootview();         v1.setdrawingcacheenabled(true);          bitmap source = v1.getdrawingcache();         int x = 0;         int y = v1.getheight() ;         int width = source.getwidth() - x;         int height = source.getheight() - y;         bitmap bitmap =  bitmap.createbitmap(source, x, y, width, height);          v1.setdrawingcacheenabled(false);          file imagefile = new file(mpath);          fileoutputstream outputstream = new fileoutputstream(imagefile);         int quality = 100;         bitmap.compress(bitmap.compressformat.jpeg, quality, outputstream);         outputstream.flush();         outputstream.close();          openscreenshotwhatsapp (imagefile);     } catch (throwable e) {         // several error may come out file handling or oom         e.printstacktrace();     } } 

i'm confusing. thanks

try code

call method, passing in outer viewgroup want screen shot of:

public bitmap screenshot(view view) {     bitmap bitmap = bitmap.createbitmap(view.getwidth(),             150, config.argb_8888);     canvas canvas = new canvas(bitmap);     view.draw(canvas);     return bitmap; } 

for more can check answers well


Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -