problem filling string[] with string-array from strings.xml

后端 未结 3 881
别那么骄傲
别那么骄傲 2021-01-22 19:32

EDIT: woah ... somehow i replaced this question with another one i was asking, glad there is this rollback feature

this specific question deals with the

3条回答
  •  無奈伤痛
    2021-01-22 20:15

    i know this is poor coding, apologies in advance. so to fix this problem, i moved

    String[] impactsn;
    impactsn = getResources().getStringArray(R.array.impacts);
    

    to my main activity and made it static. now i refer to it within my Impacts class as (MainActivity).impactsn[]

    i know this is not how you are supposed to share objects between classes, but it seems to be the easiest way so far. this is yet another reason why i am regretting my decision to make all of my tabs seperate activities. if you have any suggestions or advice on how to fix this code without using static references or on reasons why all of my tabs should be the same activities, please chime in.

提交回复
热议问题