Sha256: 43110d25b06184e35f0fb47987492a59ccc0277293e557533815f1af3866449a

Contents?: true

Size: 1.07 KB

Versions: 5

Compression:

Stored size: 1.07 KB

Contents

package com.rhomobile.rhodes;

import java.util.ArrayList;
import java.util.List;

import android.app.Application;
import android.os.Process;

public class RhodesApplication extends Application {
	
	private List<Runnable> mOnExit = new ArrayList<Runnable>();
	
	static {
		NativeLibraries.load();
	}
	
	static native void setStartParameters(String uri);
	
	@Override
	public void onCreate() {
		super.onCreate();
	}
	
	public void addOnExitHandler(Runnable action) {
		synchronized (this) {
			mOnExit.add(action);
		}
	}
	
	public boolean removeOnExitHandler(Runnable action) {
		synchronized (this) {
			return mOnExit.remove(action);
		}
	}
	
	public void exit() {
		List<Runnable> onExit = new ArrayList<Runnable>();
		synchronized (this) {
			onExit.addAll(mOnExit);
		}
		
		for (Runnable action : onExit) {
			action.run();
		}
		
		try {
			RhodesService r = RhodesService.getInstance();
			if (r != null)
				r.stopSelf();
		}
		catch (Exception e) {}
		
		RhodesActivity ra = RhodesActivity.getInstance();
		if (ra != null)
			ra.finish();
		
		Process.killProcess(Process.myPid());
	}
	
}

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rhodes-2.4.1 platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesApplication.java
rhodes-2.4.1.beta.1 platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesApplication.java
rhodes-2.4.0 platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesApplication.java
rhodes-2.4.0.beta.2 platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesApplication.java
rhodes-2.4.0.beta.1 platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesApplication.java