twitter - Not able to attach File to an email app in android from asset folder -


i tried attaching image asset folder email. haven't got considerable success in while have been able tweet image asset of contentprovider

public class assetprovider extends contentprovider {

@override public assetfiledescriptor openassetfile( uri uri, string mode ) throws filenotfoundexception {     log.v("herreee", "assetsgetter: open asset file");     assetmanager = getcontext( ).getassets( );     string file_name = uri.getlastpathsegment( );     if( file_name == null )         throw new filenotfoundexception( );     assetfiledescriptor afd = null;     try     {         afd = am.openfd( file_name );     }     catch(ioexception e)     {         e.printstacktrace( );     }     return afd;//super.openassetfile(uri, mode); }  @override public string gettype( uri p1 ) {     // todo: implement method     return null; }  @override public int delete( uri p1, string p2, string[] p3 ) {     // todo: implement method     return 0; }  @override public cursor query( uri p1, string[] p2, string p3, string[] p4, string p5 ) {     // todo: implement method     return null; }  @override public cursor query( uri uri, string[] projection, string selection, string[] selectionargs, string sortorder, cancellationsignal cancellationsignal ) {     // todo: implement method     return super.query( uri, projection, selection, selectionargs, sortorder, cancellationsignal ); }  @override public uri insert( uri p1, contentvalues p2 ) {     // todo: implement method     return null; }  @override public boolean oncreate( ) {     return false; }  @override public int update( uri p1, contentvalues p2, string p3, string[] p4 ) {     // todo: implement method     return 0; } 

}

code posting image asset folder twitter :

intent intent = new intent(intent.action_send);             intent.putextra(intent.extra_text,"test tweet");             intent.settype("*/*");             final packagemanager pm = mcontext.getpackagemanager();             final list<?> activitylist = pm.queryintentactivities(intent, 0);             int len =  activitylist.size();             boolean isfound = false;             (int = 0; < len; i++) {                 final resolveinfo app = (resolveinfo) activitylist.get(i);                 if(app.activityinfo.packagename.contains("com.twitter.android")){                     isfound = true;                     final activityinfo activity=app.activityinfo;                     final componentname name=new componentname(activity.applicationinfo.packagename, activity.name);                     intent.addcategory(intent.category_launcher);                     intent.setflags(intent.flag_activity_new_task | intent.flag_activity_reorder_to_front);                     intent.setcomponent(name);                     uri uri = uri.parse("content://com.authority/file:///android_asset/image.png");                     intent.putextra(android.content.intent.extra_stream, uri);                     mcontext.startactivity(intent);                     break;                 }             } 

but while doing same email gives message "can't attach empty file"

email:

intent intent = new intent(intent.action_send);         intent.settype("*/*");         intent.putextra(intent.extra_subject, "checkout application");         intent.putextra(intent.extra_text, "test mail");         uri uri = uri.parse("content://com.authority/file:///android_asset/image.png"));         intent.putextra(android.content.intent.extra_stream,uri);         mcontext.startactivity(intent); 

please suggest.

thanks in advance.

the latest facebook app versions doesn't allow share text using intents. have use facebook sdk share/publish post or can share images or url.

please refer post, says facebook design team has intentionally closed pre-filling message against policy.

for more information can refer these stack overflow questions :

  1. share text on facebook android app via action_send
  2. android: how share image text on facebook via intent?

edit 1 : there work around refer so answer.


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -