Traditional Culture Encyclopedia - Weather inquiry - How to realize the sharing function in the development of weather forecast based on android?

How to realize the sharing function in the development of weather forecast based on android?

Now sharing is basically ready-made:

Android? Self-contained sharing function: Although it is relatively low, and the sharing panels displayed by different manufacturers may be different, the function can still be used. If you want to develop and write advanced functions, you need to use third-party sharing.

/**

*? Shared function

*

*? @param? Context? context

*? @param? activityTitle? Name of the activity

*? @param? Message title

*? @param? msgText? Message content

*? @param? imgPath? Image path, or null if the image is not shared.

*/

Public? Invalid? ShareMsg (string? ActivityTitle, string? msgTitle,? String? msgText,

String? imgPath)? {

Intention? Intention? =? New? Intent (intention). ACTION _ SEND);

What if? (imgPath? ==? null? ||? imgPath.equals(" ")? {

intent . settype(" text/plain "); ? //? plain text

}? Or what? {

Documents? f? =? New? File (imgpath);

What if? (f? ! =? null? & amp& amp? f.exists()? & amp& amp? f.isFile())? {

intent . settype(" image/jpg ");

Yuri? u? =? uri . from file(f);

intent.putExtra(Intent。 EXTRA_STREAM,? u);

}

}

intent.putExtra(Intent。 Extra _ theme,? msg title);

intent.putExtra(Intent。 EXTRA_TEXT,? msgText);

intent.setFlags(Intent。 Flag _ Activity _ New _ Task);

start activity(intent . create chooser(intent,activity title));

}3. Third-party sharing: Use more sharing-> Wumeng, link: /4. Third-party sharing: sharing with more users-> ShareSDK, link:/