java - Capture a screenshot and share it with social media -


here excerpt of code. can compile it, program crashes on phone/emulator.

    bitmap bitmap;     view v1 = myview.getrootview();     v1.setdrawingcacheenabled(true);     bitmap = bitmap.createbitmap(v1.getdrawingcache());     v1.setdrawingcacheenabled(false);      string path = images.media.insertimage(getcontentresolver(), bitmap,             "title", null);     uri screenshoturi = uri.parse(path);      final intent socialintent = new intent(intent.action_send);     socialintent.addflags(intent.flag_grant_read_uri_permission);      socialintent.putextra(intent.extra_stream, screenshoturi);     socialintent.settype("image/png"); 

anyone know how it? want capture screenshot , let user share if he/she likes to. else work, it's screenshot cannot get.

the way screenshot can obtained having direct access frame-buffer @ kernel level, in turn requires rooted access accomplish , pull in data there make graphics screen itself.

this requires either modded rom purpose or having root privilege so. sony, know, it, have facility in place without root rom modified, in power menu, there option 'take screenshot'. cm requires root.

there facility available in ics has programmatic api available this, see answer, earlier versions, you're out of luck.


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -