I'm working on an App, and I am getting weired errors. I put in some String resource in res/values/strings
and saved it. Now If I want to access it in an Activity I get an error like this
07-13 11:16:20.050: ERROR/AndroidRuntime(5883): Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x7f060006
And I can't figure out why. Resource looks like this:
<string name="dialog_download_text">please wait while downloading</string>
and I want to Access it like
public void onCreate(Bundle b){
super.onCreate(b);
String s = getResources().getString(R.string.dialog_download_text);
}
I also looked into R.java and found my Entry
public static final class string {
public static final int dialog_download_cancel=0x7f060005;
public static final int dialog_download_text=0x7f060007;
public static final int dialog_download_title=0x7f060006;
}
I don't know what to do, because I never had a problem like this before. Please help me. Thanks all.
Sometimes I get this error (once every 2 days), and it's because eclipse is not compiling the new code and it's deploying the old apk. I fix this by
adb kill-server
andadb start-server
from the command lineThere are two cases you may get this error
1.your strings.xml file is not referred correctly?
Ans:give the correct package name for R.java file as per you application?
2.if you kept correct string.xlm path you may get still error?
Ans:once clean and build the projector restart the eclipse or android studio.
Thanks krishh
Clean the project in eclipse, and try running.If this doesn't resolve your issue, from a already running emulator uninstall the app, and run it again from eclispe.
I am currently writing the "net.superlinux.tcltktutorials" you can find it on play store now. now in the application, I want to use the standard way of using locales instead of my way of doing locales. I had to add for Arabic /res/vlaues-ar and I have the default for English /res/values. The app is about ad based YouTube Playlist TCL/Tk programming language tutorials. now the playlist can be in Arabic and in English. What I noticed is that if you have in the default /res/values 36 entries and in /res/values-ar 35 entries for the same playlist, this will make the ResourceNotFound exception. All you have to do is add the missing entry as empty at the bottom of your list just to make it equal in numbers in English and Arabic, Even if the English playlist is less in numbers.
This was my method of adding to the playlist formed inside the list activity, and also a clever way of using the resources as xml built in data:
what i had was
import android.R;
instead of
import com.example.project.R;
android.R does not have your resources it only has the general android resources.
Most likely there's an extra
import android.R;
Then your string can't be found there. Otherwise, clean the project and rebuild it, try again, then report back.