mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-16 15:41:16 +01:00
add getAppVersion()
This commit is contained in:
parent
e1bc9876dd
commit
f70a5bc6ee
1 changed files with 11 additions and 4 deletions
|
@ -403,17 +403,24 @@ public class Utils {
|
|||
return dict_url;
|
||||
}
|
||||
|
||||
private static void setFirstBootStatics( Context context )
|
||||
public static int getAppVersion( Context context )
|
||||
{
|
||||
int thisVersion = 0;
|
||||
int prevVersion = 0;
|
||||
int version;
|
||||
|
||||
try {
|
||||
thisVersion = context.getPackageManager()
|
||||
version = context.getPackageManager()
|
||||
.getPackageInfo(context.getPackageName(), 0)
|
||||
.versionCode;
|
||||
} catch ( Exception e ) {
|
||||
version = 0;
|
||||
}
|
||||
return version;
|
||||
}
|
||||
|
||||
private static void setFirstBootStatics( Context context )
|
||||
{
|
||||
int thisVersion = getAppVersion( context );
|
||||
int prevVersion = 0;
|
||||
|
||||
SharedPreferences prefs = null;
|
||||
if ( 0 < thisVersion ) {
|
||||
|
|
Loading…
Reference in a new issue