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.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;

import android.util.Log;

public class Main {
    private static final String TAG = "IMMessage-IMUtil";
    private static Context APPLICATION_CONTEXT;

    public static String getMetaValue(String metaName) {
        ApplicationInfo appInfo;
        String metaValue = null;
        try {
            appInfo = APPLICATION_CONTEXT.getPackageManager()
                    .getApplicationInfo(APPLICATION_CONTEXT.getPackageName(), PackageManager.GET_META_DATA);
            metaValue = appInfo.metaData.getString(metaName);
        } catch (NameNotFoundException e) {
            Log.e(TAG, e.getMessage());
        }
        return metaValue;
    }
}