bsegonnes Posted February 3, 2011 Share Posted February 3, 2011 Bonjour, A chaque nouvelle version de mon applie, je dois modifier le texte du numéro de version dans toutes les traductions : res/values/string.xml res/values-fr/string.xml ... Un peut chiant à force ! Comment mettre dans une String : <string name="about_application_name">MultiReader 1.8 by Bernard Segonnes (2009)</string> le numéro de version automatiquement récupéré dans le Manifest.xml ? android:versionName="1.8" Merci de votre aide Link to comment Share on other sites More sharing options...
Alocaly Posted February 4, 2011 Share Posted February 4, 2011 Moi je le fais en code, je ne sais pas s'il y a un moyen de le faire directement en xml. Pour le faire en code : TextView VersionEntry = (TextView) findViewById(R.id.VersionText); try { PackageManager pm = getPackageManager(); PackageInfo pi; // Version pi = pm.getPackageInfo( getPackageName(), 0); VersionEntry.setText( pi.versionName ); } catch( Exception e ) { e.printStackTrace(); } Emmanuel / Alocaly Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.