با سلام خدمت دوستان عزیزم
سوال من اینه که چطور میشه یک کوئری ساده (فیلتر) از داده های داخل فایل strings.xml گرفت ؟
برای مثال فایل زیر را در نظر بگیرید :
String city;
String msource;
int img;
String[] Subjects1 = new String[716];
String[] Subjects2 = new String[716];
Integer[] imageId = new Integer[716];
for (int x = 1; x < 716 + 1; x = x + 1)
{
String this_subjectcity = "subject_city_" + String.valueOf(x);
int resIDcity = getResources().getIdentifier(this_subjectcity, "string", getPackageName());
city = getResources().getString(resIDcity);
String this_subject1 = "subject_" + String.valueOf(x);
int resID1 = getResources().getIdentifier(this_subject1, "string", getPackageName());
msource = getResources().getString(resID1);
String this_imageId = "imgm" + String.valueOf(x);
img = getResources().getIdentifier(this_imageId, "drawable", getPackageName());
if (city == "تهران")
{
Subjects1[x-1] = msource;
Subjects2[x-1] = city;
imageId[x-1] = img;
}
}
من در این مثال خواستم string value هایی رو که subject_city برابر با "تهران" هست رو داخل لیست ویو نمایش بده
ولی متاسفانه برنامه force close میشه
البته این رو بگم که خود حلقه مشکل نداره و خروجی میده ، فقط زمانی که از شرط if استفاده میکنم force close میشه
ممنون میشم در این بابت من رو راهنمایی کنید.