내 앱에 서비스가 있고 필요한 항목이 들어있는 strings.xml 파일에 액세스 할 대상이 무엇입니까?서비스에서 strings.xml 파일을 사용하는 방법은 무엇입니까?
strings.xml에있는 문자열을 가져오고 싶지만 내 서비스에서이 파일에 액세스 할 수 없습니다.
문제는 문맥을 다루지 만 해결할 수는 없다고 생각합니다. 당신의 도움에 대한
package com.receiver;
protected Void doInBackground() {
// GPS timeout
final int maxSeconds = 60; //30
int count = 0;
// If we've finished finding location or exceeded timeout,
// break the loop.
while (findingLocation && count < maxSeconds) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// Continue if interrupted
}
// Increment the timer by one second
count++;
}
// If we're still finding location, switch to network locations.
if (findingLocation) {
locationHandler.sendMessage(new Message());
locationManager.removeUpdates(SMSReceiver.this);
lat = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER).getLatitude();
lng = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER).getLongitude();
msg = "";// here I whant to get my string from the strings.xml but I can't access to this file
} else {
lat = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER).getLatitude();
lng = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER).getLongitude();
msg = " "; // here I whant to get other string from the strings.xml but I can't access to this file
}
감사 :
내 서비스의 추출물이있다.
죄송합니다.
감사합니다. – user1212077