Android screenshot sharing

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.