Problem with fill the sms body in Androids' default sms Acvtivity - android

I have a problem with opening a default sms Activity.
I'm using the code:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("sms:"+contact));
intent.putExtra("sms_body", R.string.sms);
startActivity(intent);
It happens to fill the number but not body. Have you come across this problem? Or maybe you know other way to open default sms Activity with filled number and body?
EDIT
OK. What I found is that Android has problem with accessing the String in R file. What is the way to convert some R.string to String in code?

So there is a way. Sorry for being stupid
intent.putExtra("sms_body", getString(R.string.sms));

Related

Autoresponse for Line

How to achieve the android line automatically reply message function?
Receiving messages using NotificationListenerService, what you need to do now is to reply to the messenger when you receive the message, and automatically do not touch the screen at all?
The following is the message text to the line, and you want to manually select the object to be transferred.
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setData(Uri.parse("line://msg/text/" + text));
startActivity(intent);
But I would like to send a message to a specific person manually.
A similar problem is Automatic reply for whatsapp messages approach, but I was going to automatic-reply-for-line not whatsapp.
There are other products seen on this function, but can try all the methods have tried to achieve the function I want ....
So is this possible?

Android Google Translate QuickTranslateActiviy - Intent extra issue

I want to use the QuickTranslateActiviy
and I have tried this
Intent i = new Intent();
i.setAction(Intent.ACTION_PROCESS_TEXT);
i.addCategory(Intent.CATEGORY_DEFAULT);
i.putExtra(Intent.EXTRA_TEXT,"String");
i.setType(ClipDescription.MIMETYPE_TEXT_PLAIN);
i.setComponent(new ComponentName("com.google.android.apps.translate","com.google.android.apps.translate.QuickTranslateActivity"));
startActivity(i);
and It just keep showing the toast that could not find text.
But the manifest of the Google translate here show that it accept plain text
had anyone try that before?Or am I doing it in a wrong way?
Tactically, you are using the wrong extra name. It should be EXTRA_PROCESS_TEXT or EXTRA_PROCESS_TEXT_READONLY, not EXTRA_TEXT.
Strategically, your implementation will break any time that the Google Translate app refactors their code or otherwise changes the fully-qualified class name of the activity.

Send Image and Text both using ACTION_SEND or ACTION_SEND_MULTIPLE

- We have tried to post image and text using the below code:
final Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE);
shareIntent.setType("image/png");
shareIntent.putExtra(android.content.Intent.EXTRA_STREAM, Uri.parse("file:///mnt/sdcard/UserImages/"+ ParseUser.getCurrentUser().getObjectId() + ".png"));
shareIntent.putExtra(android.content.Intent.EXTRA_TEXT,"Hello test");
startActivity(Intent.createChooser(shareIntent,"Share"));
- We have also tried using shareIntent.setType("*/*"), but still no luck.
- When we are trying to post this on email, only text is appearing in it, and when we tried posting it on whatsapp then only the image was visible.
- We are unable to post both together, can anyone suggest the proper way of doing it.
Thank you very much in advance.
Now your code gonna work due the new updates to whatsapp, before this didn't accept this kind of intent (ACTION_SEND_MULTIPLE) because it accepts only one file at a time.

Android - Send SMS and make the text not editable

String number = "0707775544";
Uri uri = Uri.parse(number);
Intent smsIntent = new Intent(Intent.ACTION_SENDTO, uri);
smsIntent.putExtra("sms_body", "Hello world!");
startActivity(smsIntent);
When I run this code, Android's default SMS opens up and I can of course send this. My question is: is there anyway I can make the the text "Hello world!" NOT editable, and if you want to write a personal message, it gets below this "Hello world!".
Thanks in advance!
If i got the question right, SmsManager is your solution.
This tutorial might also be usefull.
see this tutorial
http://android10.org/index.php/articlesfullapplications/241-sms-messaging-in-android-send-and-receive
you can customize the layout to disable the part you don't want changed then send the message directly

android : email with templates

I am sending emails from my application.
I want to know if there is a way to define templates for eg :
subject: Regarding {{title}}
Body: You may be interested in the product {{title}} \b {{desc}}
I would like to define this templates in some resource file.
Thanks for your help and time.
Just construct mailto URL in accordance with RFC-2368, which includes subject and other fields. So in the end you'll have URI which can be used to start email sender activity:
Uri uri=Uri.parse("mailto:example#example.com?subject=Here goes test message");
intent = new Intent(Intent.ACTION_SENDTO, uri);
activity.startActivity(intent);
Futhero you can programmatically construct mailto URL as you want
You can put in strings.xml w/ string format character like %d %s %f..., and make use of String.format().
It's nice if others have better ideas :)

Categories

Resources