Google play resource override string value - android

I have app that supports few languages. When I use one of supported languages everything works pretty well, but when I use default language (phone on unsupported language(hebrew)) one of my strings overrides by string from play services package. As the result this specific string translates to unsupported language.(Hebrew) Resource path looks usual.
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_margin="#dimen/margin_10dp"
android:layout_toRightOf="#+id/iconFeedback"
android:elevation="3dp"
android:text="#string/accept"
android:textAlignment="center"
android:textSize="16dp"
android:textColor="#color/white" />
Why it can happens?
Thanks in advice

Related

Android custom fonts (nunito) not set properly in TextView

I am using custom fonts in my android TextView.
Typeface tf = Typeface.createFromAsset(getAssets(),
"nunitomedium.ttf");
txt2= (TextView) findViewById(R.id.txt2);
txt2.setTypeface(tf);
But padding between lines are not properly show.
<TextView
android:id="#+id/txt2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/_10sdp"
android:layout_marginRight="#dimen/_10sdp"
android:layout_marginTop="#dimen/_15sdp"
android:text="You can send emergency blast to friends and family whenever you feel uncomfortable. Once activated, you will be able to send an emergency blast to your safety network within seconds with the pressing of one button."
android:textColor="#color/colorBlack"
android:textSize="#dimen/_15sdp" />
Here is my output :
I also tried with following code :
android:includeFontPadding="false"
but still same issue. Not sure but I also tried to use justifyTextView from Here but same issue. Does anybody faced same issue before?
Thanks in advance.
EDIT :
If i use android:lineSpacingExtra 1st line have more space then other lines. Here is my code and output.
<TextView
android:id="#+id/txt2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/_10sdp"
android:layout_marginRight="#dimen/_10sdp"
android:layout_marginTop="#dimen/_15sdp"
android:lineSpacingExtra="#dimen/_5sdp" <<<<<<<
android:text="You can send emergency blast to friends and family whenever you feel uncomfortable. Once activated, you will be able to send an emergency blast to your safety network within seconds with the pressing of one button."
android:textColor="#color/colorBlack"
android:textSize="#dimen/_15sdp" />
Late to the party on this - we had exactly the same issue, was fixed completely by replacing the .ttf font file with the latest from Google Fonts - there's a bad early version of this font doing the rounds. Don't forget to remove any android:lineSpacingMultiplier fudges you've put in place int he meanwhile.
Add linespacingMultiplier in your XML
<TextView
android:id="#+id/textview_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/_10sdp"
android:layout_marginRight="#dimen/_10sdp"
android:layout_marginTop="#dimen/_15sdp"
android:text="You can send emergency blast to friends and family whenever you feel uncomfortable. Once activated, you will be able to send an emergency blast to your safety network within seconds with the pressing of one button."
android:textColor="#android:color/black"
android:lineSpacingMultiplier="3"
android:textSize="#dimen/_15sdp" />
Or
Add these line in your code:-
mTextViewFont=(TextView)findViewById(R.id.textview_font);
Typeface tf = Typeface.createFromAsset(getAssets(),
"nunitomedium.ttf");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
mTextViewFont.setLineSpacing((float) 5.5,(float) 1.2);
}
mTextViewFont.setTypeface(tf);
There was issue in the font file that is because of the site from where you downloaded it. I download the file from
dafontfree.net/download-nunito-f92263.htm
and then replace your file from asset folder.
and this is the output of it.

Anyone with Rockerhieu Emojicon experience?

I have been struggling with this for far too long. I want to display the nerd face http://emojipedia.org/nerd-face/ but am unsure how to go about it:
This is the current XML I have:
<com.rockerhieu.emojicon.EmojiconTextView
android:id="#+id/txtEmojicon1"
android:text=""
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="30dp"
android:textIsSelectable="true"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="44dp"
android:layout_marginStart="44dp" />
I have no idea what to place inside the android:text=""
Everything I place inside of the text="" comes out to not working
UPDATE THIS LIBRARY HAS BEEN DISCONTINUED BY THE OWNER UPDATE
see here : https://github.com/rockerhieu/emojicon
its pretty easy for you to implement any emoji type from Rockerheiu .
1.You will have to add the library as a module unlike adding it via the maven central Repository .
Once you are done adding module
Navigate to the library -> library\src\main\java\io\github\rockerhieu\emojicon\emoji and you edit the People.java File to get started on adding a new emoji code looks like this.
package io.github.rockerhieu.emojicon.emoji;
/**
* #author Hieu Rocker (rockerhieu#gmail.com)
*/
public class People {
public static final Emojicon[] DATA = new Emojicon[]{
Emojicon.fromCodePoint(0x1f604),
Emojicon.fromCodePoint(0x1f603),
Emojicon.fromCodePoint(0x1f600),
Emojicon.fromCodePoint(0x1f60a),
Emojicon.fromChar((char) 0x263a),
Emojicon.fromCodePoint(0x1f609),
Emojicon.fromCodePoint(0x1f60d),
Emojicon.fromCodePoint(0x1f618),

Appium locators don't work with saucelabs Android

I have UI component:
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Fire Event"
android:id="#+id/fireEvent"
android:layout_below="#+id/buttonViewKruxWebPage"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="43dp" />
And I want to find it using Appium ID locator:
driver.findElement(By.id("fireEvent")). It works fine locally but Appium cannot find it on Saucelabs. Locally and Remotely on Sauselabs both cases I have Appium 1.4.0.
Also i have tried variant of lacator:
driver.findElement(By.id("com.example.package:id/txtLogin"))
How long do you wait for element to appear in findElement method? It is possible that Saucelabs has bigger delays so I would suggest to increase time-outs and see what happens.

MigLayout for design android Forms

I am on a project. My instructor has told me to use MigLayout to design the forms in android. I am finding it difficult to find proper examples and while Using Eclipse for development its showing errors that android perfix is required to use the attributes.
please help me with some examples..
code that i pasted from the source site,mig4android.
<com.saynomoo.mig4android.MigLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
layout_constraints="wrap 4, debug 1"
column_constraints="[]15[75px]25[min]25[]"
row_constraints="[]15"
>
<TextView android:text="label1" component_constraints="skip"/>
<TextView android:text="label2" />
<TextView android:text="label3" component_constraints="wrap"/>
<TextView android:text="label4" />
<TextView android:text="label5" component_constraints="wmin 30"/>
<TextView android:text="label6" component_constraints="wmin 30"/>
<TextView android:text="label7" component_constraints="wmin 30"/>
</com.saynomoo.mig4android.MigLayout>
The component_constraints gave the error
This error means you forget to add android word before any attribute in xml file.
For example-
id="#+id/my_location"
You need to write android before id like below.
android:id="#+id/my_location"
Your code is perfect. But "skip" in component_constraints appears to be ignored. I had to manually add place holder to the layout to "fill in" empty spots. I tried "skip 1" and that also had no impact.
For more information see following link.
Skip as a constraint is not working

Android setting with TextView for Hebrew text?

I am setting text in TextView from string resource. Normally, Hebrew works in Right-To-Left format. When I set a text, it sets the text Right-To-Left format in LG, Samsung, Sony Phone but in HTC it does not work. It works in Left-To-Right format in HTC. Even I set Gravity to the TextView in Java file.
Text in TextView should be span according to the screen size. For example if it is 320 x 480 then it display in 4 lines but if it is Galaxy Tab then there may be 2 lines.
Here is my Code snippet:
In Java:
private TextView mVersionInfo, mVersionDescriptionOne, mVersionDescriptionTwo, mVersionDescriptionThree;
mVersionInfo = (TextView)findViewById(R.id.VersionInfo);
mVersionDescriptionOne = (TextView)findViewById(R.id.VersionDesc1);
mVersionDescriptionTwo = (TextView)findViewById(R.id.VersionDesc2);
mVersionDescriptionThree = (TextView)findViewById(R.id.VersionDesc3);
mVersionDescriptionOne.setGravity(Gravity.RIGHT);
mVersionDescriptionTwo.setGravity(Gravity.RIGHT);
mVersionDescriptionThree.setGravity(Gravity.RIGHT);
in XML:
<TextView android:id="#+id/VersionDesc1"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="#string/versiondesc1" android:textColor="#000000"
android:layout_marginTop="5dip" android:gravity="right"
android:layout_alignParentRight="true" android:layout_marginRight="10dip"
android:layout_below="#+id/Share" android:textSize="13sp"
android:layout_alignRight="#+id/Body" />
<TextView android:id="#+id/VersionDesc2"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="#string/versiondesc2" android:textColor="#000000"
android:layout_alignParentRight="true" android:layout_marginRight="10dip"
android:layout_below="#+id/VersionDesc1" android:textSize="13sp"
android:layout_marginTop="5dip" android:gravity="right"
android:layout_alignRight="#+id/Body" />
<TextView android:id="#+id/VersionDesc3"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="#string/versiondesc3" android:textColor="#000000"
android:layout_alignParentRight="true" android:layout_marginRight="10dip"
android:layout_below="#+id/VersionDesc2" android:textSize="13sp"
android:layout_marginTop="5dip" android:gravity="right"
android:layout_alignRight="#+id/Body" />
In String Resource:
<string name="versiondesc1">האפליקציה מתחברת לאתר הספק הסלולרי כדי להציג את מצב החשבון. לעיתים, כשאתר הספק איננו עובד תקין לא יהיה ניתן לקבל מידע. באם אתר הספק ישתנה האפליקציה עלולה להפסיק לעבוד. במצב כזה האפליקציה תחזור לעבודה תקינה מיד לאחר שאנו נתאים את שרת התוכנה שלנו לשינויים.</string>
<string name="versiondesc2">הערה: אנחנו לא מייצגים את חברות הסלולר ולא נמצאים איתן בקשר מסוג כלשהו!</string>
<string name="versiondesc3">אם נתקלת בבעיה, השתמש/י בכפתור יצירת קשר על מנת שנוכל לפתור אותה. נשמח לקבל כל משוב על האפליקציה.</string>
What is wrong with my code?
Anybody who has worked with another language, Please guide me here.
Thanks.
Gravity will only affect alignment and will not set base direction for the text. That it works on some devices and not others may be a font issue, or perhaps an OS version issue. Try adding a RIGHT-TO-LEFT MARK character (\u200F) at the start of your text. This might help the display on an HTC and will not hurt anything on devices where it is already working.
here is an example from my hebrew string xml, Thanks to Ted Hopp's answer:
you need to add '\u200e' before the char that causes you the problem:
<string name="basic_text1">המר על תוצאת המשחק\u200e:</string>
and the result will be:
:המר על תוצאת המשחק

Categories

Resources