If you think the Android project Viz listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
/*
* Copyright 2012-2014, First Three LLC/*www.java2s.com*/
*
* This file is a part of Viz.
*
* Viz is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
*
* Viz is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Viz. If not, see <http://www.gnu.org/licenses/>.
*/package com.first3.viz;
import android.app.Application;
import android.content.ContentResolver;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Handler;
import android.os.Looper;
import android.preference.PreferenceManager;
import android.view.LayoutInflater;
publicclass VizApp extends Application {
privatestatic Application sContext;
@Override
publicvoid onCreate() {
sContext = this;
}
publicstatic Context getContext() {
return sContext;
}
publicstatic String getResString(int resId) {
return getContext().getString(resId);
}
publicstatic String getResString(int resId, Object... formatArgs) {
return getContext().getString(resId, formatArgs);
}
publicstatic LayoutInflater getInflator() {
return (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
publicstatic SharedPreferences getPrefs() {
return PreferenceManager.getDefaultSharedPreferences(getContext());
}
publicstatic ContentResolver getResolver() {
return getContext().getContentResolver();
}
publicstatic Looper getLooper() {
Looper looper = Looper.getMainLooper();
if (looper == null) {
looper = Looper.myLooper();
}
if (looper == null) {
thrownew RuntimeException("Error creating looper");
}
return looper;
}
publicstatic Handler getHandler() {
returnnew Handler(getLooper());
}
publicstatic ClassLoader getClsLoader() {
return sContext.getClassLoader();
}
publicstatic String getVizPackageName() {
return sContext.getPackageName();
}
}