Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import android.content.Context;

import android.content.pm.PackageManager;

public class Main {
    /**
     * Get meta data of named node: fix bug for integer values
     */
    public static String getAppMetaData(Context context, String name) {
        try {
            return context.getPackageManager().getApplicationInfo(context.getPackageName(),
                    PackageManager.GET_META_DATA).metaData.get(name).toString();
        } catch (Exception e) {
            return null;
        }
    }

    public static String getAppMetaData(Context context, String archiveFilePath, String name) {
        try {
            return context.getPackageManager().getPackageArchiveInfo(archiveFilePath,
                    PackageManager.GET_META_DATA).applicationInfo.metaData.get(name).toString();
        } catch (Exception e) {
            return null;
        }
    }
}