當前位置: 首頁>>代碼示例>>Java>>正文


Java CoronaActivity類代碼示例

本文整理匯總了Java中com.ansca.corona.CoronaActivity的典型用法代碼示例。如果您正苦於以下問題:Java CoronaActivity類的具體用法?Java CoronaActivity怎麽用?Java CoronaActivity使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CoronaActivity類屬於com.ansca.corona包,在下文中一共展示了CoronaActivity類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: LuaLoader

import com.ansca.corona.CoronaActivity; //導入依賴的package包/類
/**
 * Creates a new object for displaying banner ads on the CoronaActivity
 */
public LuaLoader() {
	CoronaActivity activity = CoronaEnvironment.getCoronaActivity();
	// Validate.
	if (activity == null) {
		throw new IllegalArgumentException("Activity cannot be null.");
	}
}
 
開發者ID:coronalabs,項目名稱:plugins-source-google-iap-v3,代碼行數:11,代碼來源:LuaLoader.java

示例2: invoke

import com.ansca.corona.CoronaActivity; //導入依賴的package包/類
/**
 * This method is called when the Lua function is called.
 * <p>
 * Warning! This method is not called on the main UI thread.
 * @param luaState Reference to the Lua state.
 *                 Needed to retrieve the Lua function's parameters and to return values back to Lua.
 * @return Returns the number of values to be returned by the Lua function.
 */
@Override
public int invoke( final LuaState luaState ) 
{
	try 
	{			
		// Fetch the Lua function's first argument.
		// Will throw an exception if it is not of type string.
		String popupName = luaState.checkString( 1 );
		String packageName = luaState.checkString( 2 );
		
		// Get the corona activity
		CoronaActivity coronaActivity = null;
		if ( CoronaEnvironment.getCoronaActivity() != null )
		{
			coronaActivity = CoronaEnvironment.getCoronaActivity();
		}
		
		// Does the package exist
		boolean doesTargetPackageExist = false;
		
		// If the corona activity is alive
		if ( coronaActivity != null )
		{
			doesTargetPackageExist = doesPackageExist( coronaActivity, packageName );
		}
		
		// Push the result
		luaState.pushBoolean( doesTargetPackageExist );
	}
	
	catch( Exception ex ) 
	{
		// An exception will occur if given an invalid argument or no argument. Print the error.
		ex.printStackTrace();
	}
	
	// Return 1 since this Lua function returns 1 value.
	return 1;
}
 
開發者ID:coronalabs,項目名稱:plugins-source-native-popup-social,代碼行數:48,代碼來源:canShowPopup.java

示例3: executeUsing

import com.ansca.corona.CoronaActivity; //導入依賴的package包/類
@Override
public void executeUsing( CoronaRuntime runtime )
{
	try 
	{
		// Fetch the Corona runtime's Lua state.
		final LuaState L = runtime.getLuaState();

		// Dispatch the lua callback
		if ( CoronaLua.REFNIL != fLuaListenerRegistryId ) 
		{
			// Setup the event
			CoronaLua.newEvent( L, "popup" );

			// Event type
			L.pushString( "social" );
			L.setField( -2, "type" );

			// Set the event.action key based on whether the message was sent, or cancelled
			switch (fResultCode) {
				case CoronaActivity.RESULT_CANCELED:
					// Event action
					L.pushString( "cancelled" );
					L.setField( -2, "action" );
					break;

				case CoronaActivity.RESULT_OK:
					// Event action
					L.pushString( "sent" );
					L.setField( -2, "action" );
					break;
			}

			// Dispatch the event
			CoronaLua.dispatchEvent( L, fLuaListenerRegistryId, 0 );
		}
	}
	catch ( Exception ex ) 
	{
		ex.printStackTrace();
	}
}
 
開發者ID:coronalabs,項目名稱:plugins-source-native-popup-social,代碼行數:43,代碼來源:showPopup.java


注:本文中的com.ansca.corona.CoronaActivity類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。