android - declaring mime type for a "custom file" that is to be sent via bluetooth -


i need in solving issue:

i developing application transfer file application other phone using blue-tooth. when wanted transfer image file, part of code went follows:

     intent.settype("image/*");      i.putextra(i.extra_stream, uri);      //here uri has uri of image want send. 

and android manifest file went follows:

 <intent-filter>         <action android:name="android.intent.action.main"         <category android:name="android.intent.category.launcher" />        <category android:name="android.intent.category.browsable" />         <data android:scheme="file" />        <data android:mimetype="image/*" />        <data android:host="*" />    </intent-filter> 

and code worked fine. question : want send file created following line:

   f = file.createtempfile("card", ".xcard", getexternalcachedir()); 

the name of file this:

   card12434247.xcard 

now modifications required in code posted above? how should write mimetype in intent-filter?

what should line:

  intent.settype(...)? 

how should modify bluetooth able handle file

  xyz.xcard ?? 

how should declare custom mime type required send file sent via blue-tooth? required?? please help!!

try put file in bluetooth directory, worked me.

string root = environment.getexternalstoragedirectory().tostring(); intent = new intent(intent.action_send); i.settype("text/html"); file f = new file(root + "/bluetooth/test2.html"); i.putextra(intent.extra_stream, uri.fromfile(f)); startactivity(intent.createchooser(i, "send page")); 

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -