i am getting an error when converting my message into html on run time.
according to my requirement, i am using this code
messageTextView.setText(Html.fromHtml((message2
) + " " +
" "));
for some space at runtime.but if message2 contain dot(.) in the last of message its showing as a clickable link so i used like this-
messageTextView.setText(message2+ Html.fromHtml(
" " + " " +
" "));
but its getting error in some devices.not showing any space at run time.How to resolved this?
Related
I'm trying to write a long text log message on Fabrics system (Android), like this:
Answers.getInstance().logCustom(new CustomEvent("Request:" + requestUrl + "\nResponse:" + json));
The message become cut, and can't find a way to expand it:
Even when the message is added as a custom attribute, like #Alexizamerican suggested,
Answers.getInstance().logCustom(new CustomEvent("Requests"))
.putCustomAttribute("Request", requestUrl + "\nResponse:" + json)
it stays cut in the Events Dashboard, see picture below:
How to see the whole message?
It's best to include longer messages as custom attributes of an event, rather than in the event name. For example:
Answers.getInstance().logCustom(new CustomEvent("Requests"))
.putCustomAttribute("Request", requestUrl + "\nResponse:" + json)
Check out
https://docs.fabric.io/android/answers/answers-events.html#custom-attributes
for more details.
Since I add the following lines to mij jQuery script, the whole jQuery is not working anymore on Mobile Devices. On all the PC browsers everything works fine
if ( $("input[name=campaign_id").val() ) {
$('#address').load('/Xscripts/fetch_users_data.php?cid=' + $("input[name=campaign_id").val(), function(responseTxt, statusTxt, xhr){
if(statusTxt == "error")
alert("Error by loading data: " + xhr.status + ": " + xhr.statusText);
});
};
There is no error message, but just all the jQuery functions are completely not working.
Does anyone have any clue how to fix this? How can this load code make the complete jQuery-script crashing on iPhone and Android? Removing these lines makes the rest of the script running again.
Many thanks in advance,
NiFa
OK lets try some things
1st close input attr with ] .. replace a next code in both places
$("input[name=campaign_id]").val()
------^------
2nd for load url you can try
'Xscripts/fetch_users_data.php?cid=' + $("input[name=campaign_id]").val()
or
'./Xscripts/fetch_users_data.php?cid=' + $("input[name=campaign_id]").val()
hope it helps
So here's my problem.
I have a Timer which is supposed to send a SMS every X seconds.
And i want the text message to be the current GPS location of the user.
So, i want to send a kind of Google Maps URL, using the GPS coordinates i get, and adding some markers, maptype, size.... for the map.
To do that, i need to use the character "&" in the URL. In order to get something like that :
http://maps.googleapis.com/maps/api/staticmap?center=40.714728,-73.998672&zoom=12&size=400x400&maptype=roadmap
(ie : https://developers.google.com/maps/documentation/staticmaps/?csw=1#URL_Parameters)
But, when i want to use this kind of URL, using "&" in my text message of the SMS. The SMS is never sent. When i remove every part containing the "&", it's working fine.
I tried to use "& ;" instead of "&". Still doesn't work.
Here's my SMS manager to send the SMS :
smsManager.sendTextMessage(INT, null, "Alert - RED AREA \n TIME : " + current date + " \n Lat: " + latitude + " \n Long: " + longitude + "Link Maps : http://maps.googleapis.com/maps/api/staticmap?center=" + latitude + "," + longitude +"&zoom=12&size=400x400&maptype=satellite", null, null);
The code above, doesn't send any messages.
But this one does :
smsManager.sendTextMessage(INT, null, "Alert - RED AREA \n TIME : " + current date + " \n Lat: " + latitude + " \n Long: " + longitude + "Link Maps : http://maps.googleapis.com/maps/api/staticmap?center=" + latitude + "," + longitude, null, null);
Any ideas ?
Thanks !
Use "%26" instead of "&" or "&", the URL will still parse and the SMS will construct properly
The simplest solution would be to think of some sort of special character (or string) that you would use to replace the '&' character in your string.
You would go through your source string and replace every occurence of '&' with the special string (representing '&').
The reversed mechanism should be implemented in the receving side.
BUT BE CAREFUL! you need to choose your special string carefully! Because if you choose a string that could normally occur in your source string, the receiver would insert a fake '&' characters.
If this solution is not good enough, let me know... I have had a similar problem in one of my apps, and found a workaround without replacing a character with something else.
It took me for the whole day to figure out this problem. I am working on a webapp (using Phonegap + HTML + jQuery + CSS).
It consists of one screen, which displays user signatures.
I used the same .js file which is used in iPhone and in that the signature image is appearing without any problem, but the same code is not working on Android (I tried using Android 2.2.1, 2.3.3, 3.0 and 4.0) But nothing works.
Following is the code snippet from my .js file :
SignatureButtonThumbComponent.prototype.setInitialValue = function () {
var date, value;
value = this.record.valueForField(this.config.key);
//value = window.btoa(this.record.valueForField(this.config.key)); // Not Working
console.log("Signature Value : " + value);
console.log("Signature Date value : " + date);
date = this.record.valueForField(this.config.key_date);
if (value !== 'undefined') {
this.el.append("<button class='captured_signature_button'><img src='" + value + "'/></button>");
if (date) {
return this.el.append("<div class='signature_date'>" + (Formatter.timeFormattedNicely(date)) + "</div>");
}
} else {
return this.el.append("<button class='big blue arrow_button' id='get_patient_signature'><span>" + this.config.button_label + "</span><span class='icons arrow_right'></span></button>");
}
};
EDIT: Following is my logcat output :
09-21 12:01:19.562: D/PhoneGapLog(1362): Signature Date value : undefined
09-21 12:01:19.672: D/PhoneGapLog(1362): Signature Value : undefined
After Figuring little more, What Now I am getting in logcat is this :
09-21 16:33:27.947: D/PhoneGapLog(948): file:///android_asset/www/new_mobile.js: Line 15790 : Signature Value : data:,
Finally after the whole day's run, I found the solution.
Basically Android does not support canvas of HTML5, though it claims for the same.
Whenever I tried to save paint of canvas object, I got data:, meaning null as an output.
Here is a nice js, which you can use to override the default method of canvas.toDataURL().
The only drawback to this js is that its comparatively slow to save your graphic. But as of my situation, its well suited and I integrated it in my jquery. You can find this js here : http://code.google.com/p/todataurl-png-js/
Passing the following SSML (Speech Synthesis Markup Language) document to the com.svox.pico TextToSpeech engine resulted in a reading of the XML body but no control from the phoneme element or the emphasis element. This result (no apparent SSML control) is the same on a Nexus One running Android 2.2 as well as on the emulator running an AVD with SDK level 8.
String text = "<?xml version=\"1.0\"?>" +
"<speak version=\"1.0\" xmlns=\"http://www.w3.org/2001/10/synthesis\" " +
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " +
"xsi:schemaLocation=\"http://www.w3.org/2001/10/synthesis " +
"http://www.w3.org/TR/speech-synthesis/synthesis.xsd\" " +
"xml:lang=\"en-US\">" +
"tomato " +
"<phoneme alphabet=\"ipa\" ph=\"təmei̥ɾou̥\"> tomato </phoneme> " +
"That is a big car! " +
"That <emphasis> is </emphasis> a big car! " +
"That is a <emphasis> big </emphasis> car! " +
"That is a huge bank account! " +
"That <emphasis level=\"strong\"> is </emphasis> a huge bank account! " +
"That is a <emphasis level=\"strong\"> huge </emphasis> bank account!" +
"</speak>";
mTts.speak(text, TextToSpeech.QUEUE_ADD, null);
Does any Android TTS engine support any of the SSML elements?
I've been experimenting with SSML and it seems that the TTS engine wraps its input automaticly with the root <speak> element, so if you leave it out, then it works fine and you don't get a parser error.
Example:
String text = "Testing <phoneme alphabet=\"xsampa\" ph=\""{k.t#`\"/>.";
mTts.speak(text, TextToSpeech.QUEUE_ADD, null);
The answer seems to be "sort of". Not all the SSML tags are supported yet, but some test examples of the use of the <phoneme> tag are at https://android.googlesource.com/platform/external/svox/+/89292811b7fe82e5c14fa13942779763627e26db
Though the test examples produce the desired speech output, they also produce XML parser error messages in logcat. I've opened an issue about these seemingly incorrect error messages at the Android issue tracker (issue 11010).
It does appear that android.speech.tts at SDK level 23 supports a subset of SSML. Speech text can be wrapped in <speak> tags, and <say-as> is observed, while <break> is not. There is no documentation regarding SSML support.