Android screenshot and share should be a more useful function, but not in the application to see a lot
1. Screen Cutting
/**
* Prepare to screen screenshots
*/
public void Prepareshoot () {
try{
Boolean sdcardexist = Environment.getexternalstoragestate (). Equals (Android.os.Environment.MEDIA_MOUNTED);
if (sdcardexist) {
String RootPath = Environment.getexternalstoragedirectory (). GetPath () + "/colorgo";
File Imgdir = new file (RootPath);
if (!imgdir.exists ()) {
LOG.V (Tag, "Logdir.mkdirs ()");
Imgdir.mkdirs ();
}
Imgpath = RootPath;
if (imgpathfile.equals (Imgpath + "/colorgoshareimga.png")) {
Imgpathfile = Imgpath + "/colorgoshareimgb.png";
}else{
Imgpathfile = Imgpath + "/colorgoshareimga.png";
}
}else{
Toast.maketext (Context, "the memory card is not enabled, this feature is temporarily unavailable.) ", Toast.length_long). Show ();
}
}catch (Exception ex) {
LOG.V (Tag, "Prepareshoot:" +ex.getmessage ());
}
}
2. Share, the share here is simply to share, if you want to share to two times to develop the platform, but also need a series of operations, more trouble
/**
* Run Share
*/
public void Nativeshare (String content)
{
try{
Intent shareIt = new Intent ("Android.intent.action.SEND");
Shareit.settype ("Image/png");
Shareit.putextra (Intent.extra_subject, constants.appname);
Shareit.putextra (intent.extra_text, content);
Share pictures of SD card
Shareit.putextra (Intent.extra_stream,uri.parse (imgpathfile));
Shareit.setflags (Intent.flag_activity_new_task);
StartActivity (Intent.createchooser (shareIt, constants.appname));
}catch (Exception ex) {
LOG.V (Tag, "Nativeshare:" +ex.getmessage ());
}
}
3. Application Scenario: Scripture Sharing:
For example, Zi Jing "http://zhushou.360.cn/detail/index/soft_id/1902511" small application is used to share screenshots, scripture used to persuade people to persuade themselves.
Android screenshot sharing