A few thoughts, and them my code that's producing the above error (and
I'm perplexed as to why).
1.) I'm using API 6
2.) I have "import android.content.pm.PackageInfo;" and "import
android.content.pm.PackageManager;" at the top of the java class.
3.) I've hit "control-shift-o" in eclipse to try to get it to import
anything that might be missing.
4.) Eclipse shows the methods avaiable on PackageInfo (and it lists
versionName as one of them) but then gives the error message "The
method versionName() is undefined for the type PackageInfo".
My question, what am I doing wrong (I've tried other variations of the
getPackageManager line where I specified META_DATA, etc.)
// Begin Code
String version = " (Development)";
try {
PackageInfo pi = getPackageManager().getPackageInfo
("com.testdoman.testapplication", 0);
version = pi.versionName(); // this is the line Eclipse complains
about
}
catch (PackageManager.NameNotFoundException e) {
// eat error, for testing
}
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en