Sharing text file programatically - Android Q&A, Help & Troubleshooting

Hi, I am quite new to Android development. I need to share a text file from my Android app via WhatsApp, mail etc. I am using the below code:
File file = new File(stringFile);
Intent intentShare = new Intent(Intent.ACTION_SEND);
intentShare.setType("text/*");
intentShare.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://"+file));
startActivity(Intent.createChooser(intentShare, "Share the file ..."));
stringFile contains the full path of my file. The file is in internal storage. When I run the above code. I am getting the share apps like WhatsApp. gmail etc.
i am also able to select the requited app( say gmail) and proceed. But the thing is the file is not sent at all.
Is there anything I need to do in special? The file is created in internal storage. The path is /data/user/0/com.example.myappname/files/myfile.txt
Kindly help.Thanks

The receiving app has no permission to access the data your file://Uri points to.
I think you should store the data in your own ContentProvider or system MediaStore in order for the receiving app to have access to the text file.

If you will store the file in your own ContentProvider, you should pass the Content Uri into the function call intentShare.putExtra() then.

Related

Outlook msg files read via Android app

Hi
Someone know how I can open msg file under Android platform.
On Android Market there is no app like that.
???
Hi
There is no solution ??
I am also looking for a reader for outlook msg files.
https://play.google.com/store/apps/details?id=com.igates.office&hl=en
This isn't free but it says it will let you open .mgs files.
Its called Documento, if it can open a msg file then I guess its worth the money.
View MSG, RTF, EML, XLSX, XPS, Doc, Docx, Excel XLS

Android FileOutStream: can not find my saved txt file

hello, everyone,
I'm an newbie developer for android device.
Recently I want to save my data into an txt file using FileOutputStream.
Here is my code:
Code:
FileOutputStream outStream=this.openFileOutput("2222.txt",Context.MODE_APPEND + Context.MODE_WORLD_READABLE);
String data1 = Float.toString(cpuUsage);
Log.i("savedata",data1);
outStream.write(data1.getBytes());
outStream.close();
The code worked perfectly.
But the problem is I can not find where to see this file on my computer.
I was told that the fileoutstream will ususally save file in data/(packages name)/files.
But data directory is empty in file explorer on Eclipse.
Anybody please help..
Best

how i can add apps in SuperSu list manually ?

hi all,
recently i have rooted Samsung Tab 4 SM-T230.
i have installed notepad app and want to edit hosts file to enter various entries at once (copy and paste from created text file) which hosts editor app not allowed me, but problem is when i am running notepad it is not asking to grant Super user permission and system not allowing notepad app to save hosts file. how i can enter notepad app manually in SuperSu files list? is there any settings option to handle? or any other app suggested to do so?
the list i found here for hosts file:
https://gist.github.com/marshymarsh/5c34b5a6530d46fa0f3076bed52d293a
regards

How to hook or inject an external library to an application?

Before discussing the question (subject)
Let me explain first as follows.
what i do looks like this
1. An application that receives data from .zip.
1.2 Extract the file into a folder (eg download/name/[library.so, config.json]).
1.3 Read data from config.json (target package name).
2. Get pid from target package name.
2.2 Insert external library to target
External library as a mod menu (reference https://github.com/LGLTeam/Android-...0bd9653/app/src/main/jni/Includes/Utils.h#L61)
The problem is 2.2, which I don't know what to do. Or the keywords should I search for it?

Attempting to pull assets, images, and resources from an APK

I am attempting to extract the images from the game Summoners War to use for wallpapers and such.
I am able to get the APK file and have the image files in question in the assets folder, however they are not able to be opened in any image editor or photo viewer, I believe that they are encrypted. I do have access to the source code through Jadax, but I am not sure how to locate the key to decrypt them, or how exactly to decrypt them even if I had said key.
How does one go about extracting the images so I can use them for PC/phone wallpapers?
Solved.
Delete the first 16 bytes of hex data, then change the file extension to .jpg.

Categories

Resources