Questions tagged [string.xml]

39 questions
1
vote
2 answers

Can We use string resources for code comment in android?

Suppose we have some statement for comments which will be repeat many times. Can We use string resources for code comment in android?
1
vote
2 answers

Android studio - get a translation of an array-string's item in string.xml

I have an application that gives the user the right to choose an item from array in string.xml: USA UK and another array in the translated-to-Chinese…
1
vote
0 answers

Edit translation text at runtime from server

Overview AFAIK on Android you have twi ways to set the texts of your application: You can use string.xml with different locales You can download strings from server and set every label with a setText(language.text) but it will be a pain The…
Pier Giorgio Misley
  • 5,305
  • 4
  • 27
  • 66
1
vote
0 answers

How can I rearrange android non-english string.xml follow to english string.xml files sorting by name

I want to rearrange string tags in non-english string.xml file to follow the english version string.xml file. I know android studio has reformat code feature that will reformat by customization pattern, but I need to follow format as english version…
DrNutsu
  • 475
  • 2
  • 10
  • 21
1
vote
1 answer

Area wise locality in Android for India

I want to know locality (like state, operator,etc) from the mobile number. You can find the data about mobile number allocation here. The data is huge. I am trying it solve this similar to this solution by entering the whole data to String file (but…
Sagar Chilukuri
  • 1,430
  • 2
  • 17
  • 29
0
votes
0 answers

Why is the searchview crashing and closing on typing in it

What are the correct lines of code for extracting string.xml data and creating a search view on a recycler view? Main Activity Code: package com.example.search_view; import androidx.appcompat.app.AppCompatActivity; import…
0
votes
0 answers

SearchView from String xml

What is the full code for creating a searchview in recycler view using items from string.xml and not adding them directly in Main Activity.I have tried almost everything but nothing has worked so far. There is probably an issue with: String[] items…
0
votes
1 answer

need to change values in strings.xml file according to environment

I am developing an android app. I need to use two google console projects for my dev environment and production. But there's a strings.xml file and I can not change their strings according to the environment. Can anyone help me?
0
votes
1 answer

display string and integer in a bracket in textview

I have tried String name = mContext.getString(R.string.product_and_quantity, banner.getProduct_name().trim(), banner.getProduct_quantity()); and in String.xml file %1$s x(%2$d) but still I am not…
Durgesh Kumar
  • 935
  • 10
  • 17
0
votes
1 answer

Export Sketch text strings to Android string.xml?

This may be a crazy question - but has anyone managed to export text strings from Sketch into a text file in some a structured way? For example, I want to export the text element/layer name (for example, home_welcome) and the text value (for…
jhaaaa
  • 96
  • 10
0
votes
1 answer

How to call R.raw.sound Array from strings.xml?

I want to call this list of raw file from strings.xml int[] sound = { R.raw.sound1, R.raw.sound2, R.raw.sound3, R.raw.sound4, R.raw.sound5, }; How to type in a strings.xml and call from code ?
0
votes
2 answers

pass value to string.xml value that have a link inside it

I have this value in string.xml file: Copyright © All Rights Reserved %1$d company name And I have applied this code that pass to the above text & set that text to the…
Ali Habbash
  • 777
  • 2
  • 6
  • 29
0
votes
1 answer

Get String from String.xml in ViewPager Android

public class DietSlideAdapter extends PagerAdapter { Context context; LayoutInflater layoutInflater; public DietSlideAdapter(Context context){ this.context = context; } //Arrays public int[] slide_images2 = { R.drawable.breakfast, …
0
votes
3 answers

want to print “\n” sign without getting a new line

I have a string in my strings.xml in which there is "\n" sign between them Hello\nworld What can I do to get the "\n" sign instead of a new line?
Amrutha Saj
  • 1,408
  • 16
  • 35
0
votes
1 answer

How to find how many language's string.xml present in my application

I need to find how many language's string.xml is present in my application at run time. Example: I have string.xml for en, zh,fr.. and now my server is sending me language type as hi then I should check whether hi present in values folder or…
mradss
  • 31
  • 3