@@ -0,0 +1,1749 @@
+/*%0A * Copyright (C) 2015, %E7%A8%8B%E5%BA%8F%E4%BA%A6%E9%9D%9E%E7%8C%BF%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *   http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage me.yifeiyuan.utils;%0A%0Aimport android.content.Context;%0Aimport android.content.pm.PackageInfo;%0Aimport android.content.pm.PackageManager;%0A%0A/**%0A * Created by %E7%A8%8B%E5%BA%8F%E4%BA%A6%E9%9D%9E%E7%8C%BF on 15/12/28.%0A */%0Apublic class AppUtil %7B%0A%0A    /**%0A     * @param context %E4%B8%8A%E4%B8%8B%E6%96%87%0A     * @return app%E7%9A%84%E7%89%88%E6%9C%AC%E5%90%8D%0A     */%0A    public static String getVersionName(Context context)%0A    %7B%0A        PackageManager pm = context.getPackageManager();%0A        try%0A        %7B%0A            PackageInfo packageInfo = pm.getPackageInfo(context.getPackageName(), 0);%0A            return packageInfo.versionName;%0A        %7D catch (PackageManager.NameNotFoundException e)%0A        %7B%0A            e.printStackTrace();%0A        %7D%0A        return %22%22;%0A    %7D%0A%0A    /**%0A     *%0A     * @param context %E4%B8%8A%E4%B8%8B%E6%96%87%0A     * @return %E8%8E%B7%E5%8F%96%E7%89%88%E6%9C%AC%E5%8F%B7%0A     */%0A    public static int getVersionCode(Context context)%0A    %7B%0A        PackageManager pm = context.getPackageManager();%0A        try%0A        %7B%0A            PackageInfo packageInfo = pm.getPackageInfo(context.getPackageName(), 0);%0A            return packageInfo.versionCode;%0A        %7D catch (PackageManager.NameNotFoundException e)%0A        %7B%0A            e.printStackTrace();%0A        %7D%0A        return 0;%0A    %7D%0A%7D%0A

add apputil