Android Open Source - Joetz-Android-V2 Joetz Application

From Project

Back to project page Joetz-Android-V2.


The source code is released under:

GNU General Public License

If you think the Android project Joetz-Android-V2 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

package com.example.jens.myapplication.sam;
/*  www.  ja  v  a 2 s  .co m*/

import android.content.Context;
import android.content.Intent;

import com.example.jens.myapplication.apimanager.manager.ActivityManager;
import com.example.jens.myapplication.apimanager.manager.CampManager;
import com.example.jens.myapplication.apimanager.manager.ImageManager;
import com.example.jens.myapplication.apimanager.manager.LoginManager;
import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
import com.nostra13.universalimageloader.core.assist.QueueProcessingType;

 * The application class for the Joetz application<br/>
 * Holds all the managers to manage resources of the application
public class JoetzApplication extends Application {
    private static JoetzApplication context;

    private LoginManager loginManager;
    private CampManager campManager;
    private ImageManager imageManager;
    private ActivityManager activityManager;

    public void onCreate() {
        this.context = this;

    public LoginManager getLoginManager(){
        if(loginManager == null){
            loginManager = new LoginManager(this);
        return loginManager;

    public CampManager getCampManager(){
        if(campManager == null){
            campManager = new CampManager();
        return campManager;

    public ImageManager getImageManager(){
        if(imageManager == null){
            imageManager = new ImageManager();
        return imageManager;

    public ActivityManager getActivityManager(){
        if(activityManager == null){
            activityManager = new ActivityManager();
        return activityManager;

     * Get the application
     * @return the application object
    public static JoetzApplication getContext(){
        return context;

    public static void initImageLoader(Context context) {
        // This configuration tuning is custom. You can tune every option, you may tune some of them,
        // or you can create default configuration by
        //  ImageLoaderConfiguration.createDefault(this);
        // method.
        ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
                .threadPriority(Thread.NORM_PRIORITY - 2)
                .diskCacheFileNameGenerator(new Md5FileNameGenerator())
                .diskCacheSize(50 * 1024 * 1024) // 50 Mb
                .writeDebugLogs() // Remove for release app
        // Initialize ImageLoader with configuration.

     * Restart the application if the user is not logged in.
     * Can be used when loading activities which require the user to be logged in, but due to
     * recreation of the application object, the user is no longer logged in.
    public void restartIfLoggedOut(){

     * Perform a restart of the application
    public void restartApplication(){
        Intent i = getBaseContext().getPackageManager()
                .getLaunchIntentForPackage( getBaseContext().getPackageName() );

Java Source Code List