How to use String arrays in layouts?How to save an Android Activity state using save instance state?Fling gesture detection on grid layoutWhy is the Android emulator so slow? How can we speed up the Android emulator?Can I underline text in an Android layout?Referencing a string in a string array resource with xmlReference one string from another string in strings.xml?How to escape % in String.Format?How do I fix android.os.NetworkOnMainThreadException?What's “tools:context” in Android layout files?How to avoid reverse engineering of an APK file?

How did Jayne know when to shoot?

Is it possible to have a career in SciComp without contributing to arms research?

What is this green alien supposed to be on the American covers of the "Hitchhiker's Guide to the Galaxy"?

Differentiable functions and existence of limits

What makes MOVEQ quicker than a normal MOVE in 68000 assembly?

Wait or be waiting?

How can I automate this tensor computation?

What would be the safest way to drop thousands of small, hard objects from a typical, high wing, GA airplane?

Company looks for long-term employees, but I know I won't be interested in staying long

How long were the Apollo astronauts allowed to breathe 100% oxygen at 1 atmosphere continuously?

Why do jet engines sound louder on the ground than inside the aircraft?

Why do the digits of a number squared follow a similar quotient?

Batch processing/extracting raw data of one raster using one shapefile (with many polygons)?

Manager asking me to eat breakfast from now on

Do higher dimensions have axes?

Which GPUs to get for Mathematical Optimization (if any)?

May I use a railway velocipede on actively-used British railways?

In this iconic lunar orbit rendezvous photo of John Houbolt, why do arrows #5 and #6 point the "wrong" way?

Is this Android phone Android 9.0 or Android 6.0?

Real orthogonal and sign

Applying for jobs with an obvious scar

What's a German word for »Sandbagger«?

Why do space operations use "nominal" to mean "working correctly"?

How can I help our ranger feel special about her beast companion?



How to use String arrays in layouts?


How to save an Android Activity state using save instance state?Fling gesture detection on grid layoutWhy is the Android emulator so slow? How can we speed up the Android emulator?Can I underline text in an Android layout?Referencing a string in a string array resource with xmlReference one string from another string in strings.xml?How to escape % in String.Format?How do I fix android.os.NetworkOnMainThreadException?What's “tools:context” in Android layout files?How to avoid reverse engineering of an APK file?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I created a string-array in my strings.xml file and I want access array in
my layout to fill my chips. How can I do it?



This my strings.xml



<string-array name="shortcutCategoryNames">
<item>Digital</item>
<item>Clothes</item>
<item>Sport</item>
<item>Cosmetics</item>
</string-array>


This is my layout



 <com.google.android.material.chip.ChipGroup
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.chip.Chip
android:id="@+id/chp_digital"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<com.google.android.material.chip.Chip
android:id="@+id/chp_clothes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>


</com.google.android.material.chip.ChipGroup>









share|improve this question



















  • 1





    "I want access array in my layout to fill my chips" -- there is no mechanism for doing that, sorry. You will need to use Java/Kotlin code to create your chips and put them in the group.

    – CommonsWare
    Mar 26 at 10:50

















0















I created a string-array in my strings.xml file and I want access array in
my layout to fill my chips. How can I do it?



This my strings.xml



<string-array name="shortcutCategoryNames">
<item>Digital</item>
<item>Clothes</item>
<item>Sport</item>
<item>Cosmetics</item>
</string-array>


This is my layout



 <com.google.android.material.chip.ChipGroup
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.chip.Chip
android:id="@+id/chp_digital"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<com.google.android.material.chip.Chip
android:id="@+id/chp_clothes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>


</com.google.android.material.chip.ChipGroup>









share|improve this question



















  • 1





    "I want access array in my layout to fill my chips" -- there is no mechanism for doing that, sorry. You will need to use Java/Kotlin code to create your chips and put them in the group.

    – CommonsWare
    Mar 26 at 10:50













0












0








0








I created a string-array in my strings.xml file and I want access array in
my layout to fill my chips. How can I do it?



This my strings.xml



<string-array name="shortcutCategoryNames">
<item>Digital</item>
<item>Clothes</item>
<item>Sport</item>
<item>Cosmetics</item>
</string-array>


This is my layout



 <com.google.android.material.chip.ChipGroup
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.chip.Chip
android:id="@+id/chp_digital"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<com.google.android.material.chip.Chip
android:id="@+id/chp_clothes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>


</com.google.android.material.chip.ChipGroup>









share|improve this question
















I created a string-array in my strings.xml file and I want access array in
my layout to fill my chips. How can I do it?



This my strings.xml



<string-array name="shortcutCategoryNames">
<item>Digital</item>
<item>Clothes</item>
<item>Sport</item>
<item>Cosmetics</item>
</string-array>


This is my layout



 <com.google.android.material.chip.ChipGroup
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.chip.Chip
android:id="@+id/chp_digital"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<com.google.android.material.chip.Chip
android:id="@+id/chp_clothes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>


</com.google.android.material.chip.ChipGroup>






android android-layout android-resources






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 26 at 12:16









Fantômas

33.4k15 gold badges66 silver badges93 bronze badges




33.4k15 gold badges66 silver badges93 bronze badges










asked Mar 26 at 10:43









Alireza BideliAlireza Bideli

361 silver badge8 bronze badges




361 silver badge8 bronze badges







  • 1





    "I want access array in my layout to fill my chips" -- there is no mechanism for doing that, sorry. You will need to use Java/Kotlin code to create your chips and put them in the group.

    – CommonsWare
    Mar 26 at 10:50












  • 1





    "I want access array in my layout to fill my chips" -- there is no mechanism for doing that, sorry. You will need to use Java/Kotlin code to create your chips and put them in the group.

    – CommonsWare
    Mar 26 at 10:50







1




1





"I want access array in my layout to fill my chips" -- there is no mechanism for doing that, sorry. You will need to use Java/Kotlin code to create your chips and put them in the group.

– CommonsWare
Mar 26 at 10:50





"I want access array in my layout to fill my chips" -- there is no mechanism for doing that, sorry. You will need to use Java/Kotlin code to create your chips and put them in the group.

– CommonsWare
Mar 26 at 10:50












2 Answers
2






active

oldest

votes


















0














You can get String Array using below method.



ArrayList<String> tagList = new ArrayList();

String[] someArray = getResources().getStringArray(R.array.shortcutCategoryNames);
tagList.addAll(Arrays.asList(some_array));





share|improve this answer






























    0














    You can get string-array using this code:



    String strArray[] = getResources().getStringArray(R.array. shortcutCategoryNames);


    Then loop through strArray to create Chip and add those Chip to ChipGroup programmatically






    share|improve this answer

























      Your Answer






      StackExchange.ifUsing("editor", function ()
      StackExchange.using("externalEditor", function ()
      StackExchange.using("snippets", function ()
      StackExchange.snippets.init();
      );
      );
      , "code-snippets");

      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "1"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55355183%2fhow-to-use-string-arrays-in-layouts%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      You can get String Array using below method.



      ArrayList<String> tagList = new ArrayList();

      String[] someArray = getResources().getStringArray(R.array.shortcutCategoryNames);
      tagList.addAll(Arrays.asList(some_array));





      share|improve this answer



























        0














        You can get String Array using below method.



        ArrayList<String> tagList = new ArrayList();

        String[] someArray = getResources().getStringArray(R.array.shortcutCategoryNames);
        tagList.addAll(Arrays.asList(some_array));





        share|improve this answer

























          0












          0








          0







          You can get String Array using below method.



          ArrayList<String> tagList = new ArrayList();

          String[] someArray = getResources().getStringArray(R.array.shortcutCategoryNames);
          tagList.addAll(Arrays.asList(some_array));





          share|improve this answer













          You can get String Array using below method.



          ArrayList<String> tagList = new ArrayList();

          String[] someArray = getResources().getStringArray(R.array.shortcutCategoryNames);
          tagList.addAll(Arrays.asList(some_array));






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 26 at 11:01









          PrincePrince

          1,50412 silver badges30 bronze badges




          1,50412 silver badges30 bronze badges























              0














              You can get string-array using this code:



              String strArray[] = getResources().getStringArray(R.array. shortcutCategoryNames);


              Then loop through strArray to create Chip and add those Chip to ChipGroup programmatically






              share|improve this answer



























                0














                You can get string-array using this code:



                String strArray[] = getResources().getStringArray(R.array. shortcutCategoryNames);


                Then loop through strArray to create Chip and add those Chip to ChipGroup programmatically






                share|improve this answer

























                  0












                  0








                  0







                  You can get string-array using this code:



                  String strArray[] = getResources().getStringArray(R.array. shortcutCategoryNames);


                  Then loop through strArray to create Chip and add those Chip to ChipGroup programmatically






                  share|improve this answer













                  You can get string-array using this code:



                  String strArray[] = getResources().getStringArray(R.array. shortcutCategoryNames);


                  Then loop through strArray to create Chip and add those Chip to ChipGroup programmatically







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 26 at 10:49









                  LiarLiar

                  9611 gold badge7 silver badges17 bronze badges




                  9611 gold badge7 silver badges17 bronze badges



























                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55355183%2fhow-to-use-string-arrays-in-layouts%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                      SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                      은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현