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


Java ActivityLifecycleCallbacks類代碼示例

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


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

示例1: setAutoSession

import android.app.Application.ActivityLifecycleCallbacks; //導入依賴的package包/類
@TargetApi(14)
public static void setAutoSession(Application application) {
    MWConfiguration.initContext(application.getApplicationContext());
    if (VERSION.SDK_INT >= 14) {
        try {
            ActivityLifecycleCallbacks xVar = new x();
            application.unregisterActivityLifecycleCallbacks(xVar);
            application.registerActivityLifecycleCallbacks(xVar);
            m.a().h(true);
        } catch (NoSuchMethodError e) {
            m.a().h(false);
        } catch (NoClassDefFoundError e2) {
            m.a().h(false);
        }
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:17,代碼來源:Session.java

示例2: initApp

import android.app.Application.ActivityLifecycleCallbacks; //導入依賴的package包/類
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
private static void initApp(Context context) {

    Application application = (Application) mAppContext;

    if (application != null) {
        mAppInited = true;
        if (mLifecycleCallbacks == null) {
            mLifecycleCallbacks = new PXLifecycleCallbacks();
        }
        application
                .unregisterActivityLifecycleCallbacks((ActivityLifecycleCallbacks) mLifecycleCallbacks);
        application
                .registerActivityLifecycleCallbacks((ActivityLifecycleCallbacks) mLifecycleCallbacks);
    }

}
 
開發者ID:Pixate,項目名稱:pixate-freestyle-android,代碼行數:18,代碼來源:PixateFreestyle.java

示例3: getLifeCycle

import android.app.Application.ActivityLifecycleCallbacks; //導入依賴的package包/類
private ActivityLifecycleCallbacks getLifeCycle(Activity activity){
    String fullName=activity.getClass().getName();
    //通過activity的名字獲取對應的生命周期注冊對象
    if(manager!=null){
        return manager.getLifecycle(fullName);
    }
    return null;
}
 
開發者ID:zillachan,項目名稱:AndZilla,代碼行數:9,代碼來源:ActivityLifeCycle.java

示例4: onActivityCreated

import android.app.Application.ActivityLifecycleCallbacks; //導入依賴的package包/類
@Override
public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
    ActivityLifecycleCallbacks callbacks=getLifeCycle(activity);
    if(callbacks!=null){
        callbacks.onActivityCreated(activity,savedInstanceState);
    }
}
 
開發者ID:zillachan,項目名稱:AndZilla,代碼行數:8,代碼來源:ActivityLifeCycle.java

示例5: onActivityStarted

import android.app.Application.ActivityLifecycleCallbacks; //導入依賴的package包/類
@Override
public void onActivityStarted(Activity activity) {
    ActivityLifecycleCallbacks callbacks=getLifeCycle(activity);
    if(callbacks!=null){
        callbacks.onActivityStarted(activity);
    }
}
 
開發者ID:zillachan,項目名稱:AndZilla,代碼行數:8,代碼來源:ActivityLifeCycle.java

示例6: onActivityResumed

import android.app.Application.ActivityLifecycleCallbacks; //導入依賴的package包/類
@Override
public void onActivityResumed(Activity activity) {
    ActivityLifecycleCallbacks callbacks=getLifeCycle(activity);
    if(callbacks!=null){
        callbacks.onActivityResumed(activity);
    }
}
 
開發者ID:zillachan,項目名稱:AndZilla,代碼行數:8,代碼來源:ActivityLifeCycle.java

示例7: onActivityPaused

import android.app.Application.ActivityLifecycleCallbacks; //導入依賴的package包/類
@Override
public void onActivityPaused(Activity activity) {
    ActivityLifecycleCallbacks callbacks=getLifeCycle(activity);
    if(callbacks!=null){
        callbacks.onActivityPaused(activity);
    }
}
 
開發者ID:zillachan,項目名稱:AndZilla,代碼行數:8,代碼來源:ActivityLifeCycle.java

示例8: onActivityStopped

import android.app.Application.ActivityLifecycleCallbacks; //導入依賴的package包/類
@Override
public void onActivityStopped(Activity activity) {
    ActivityLifecycleCallbacks callbacks=getLifeCycle(activity);
    if(callbacks!=null){
        callbacks.onActivityStopped(activity);
    }
}
 
開發者ID:zillachan,項目名稱:AndZilla,代碼行數:8,代碼來源:ActivityLifeCycle.java

示例9: onActivitySaveInstanceState

import android.app.Application.ActivityLifecycleCallbacks; //導入依賴的package包/類
@Override
public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
    ActivityLifecycleCallbacks callbacks=getLifeCycle(activity);
    if(callbacks!=null){
        callbacks.onActivitySaveInstanceState(activity,outState);
    }
}
 
開發者ID:zillachan,項目名稱:AndZilla,代碼行數:8,代碼來源:ActivityLifeCycle.java

示例10: onActivityDestroyed

import android.app.Application.ActivityLifecycleCallbacks; //導入依賴的package包/類
@Override
public void onActivityDestroyed(Activity activity) {
    ActivityLifecycleCallbacks callbacks=getLifeCycle(activity);
    if(callbacks!=null){
        callbacks.onActivityDestroyed(activity);
    }
}
 
開發者ID:zillachan,項目名稱:AndZilla,代碼行數:8,代碼來源:ActivityLifeCycle.java

示例11: registersCallbacks

import android.app.Application.ActivityLifecycleCallbacks; //導入依賴的package包/類
@Test
public void registersCallbacks() {
  recognizer.start();

  verify(mockApplication).registerActivityLifecycleCallbacks(any(ActivityLifecycleCallbacks.class));
  verify(mockApplication).registerComponentCallbacks(any(ComponentCallbacks2.class));
  verify(mockApplication).registerReceiver(any(BroadcastReceiver.class), any(IntentFilter.class));
}
 
開發者ID:jenzz,項目名稱:RxAppState,代碼行數:9,代碼來源:DefaultAppStateRecognizerSetupTest.java

示例12: unregistersCallbacks

import android.app.Application.ActivityLifecycleCallbacks; //導入依賴的package包/類
@Test
public void unregistersCallbacks() {
  recognizer.start();
  recognizer.stop();

  verify(mockApplication).unregisterActivityLifecycleCallbacks(any(ActivityLifecycleCallbacks.class));
  verify(mockApplication).unregisterComponentCallbacks(any(ComponentCallbacks2.class));
  verify(mockApplication).unregisterReceiver(any(BroadcastReceiver.class));
}
 
開發者ID:jenzz,項目名稱:RxAppState,代碼行數:10,代碼來源:DefaultAppStateRecognizerSetupTest.java

示例13: setActivityToCreated

import android.app.Application.ActivityLifecycleCallbacks; //導入依賴的package包/類
@TargetApi(ICE_CREAM_SANDWICH)
private void setActivityToCreated() {
  final ArgumentCaptor<ActivityLifecycleCallbacks> captor =
      forClass(ActivityLifecycleCallbacks.class);

  verify(application).registerActivityLifecycleCallbacks(captor.capture());

  final ActivityLifecycleCallbacks callbacks = captor.getValue();

  callbacks.onActivityCreated(activity, null);
}
 
開發者ID:google,項目名稱:agera,代碼行數:12,代碼來源:RepositoryAdapterTest.java

示例14: setActivityToDestroyed

import android.app.Application.ActivityLifecycleCallbacks; //導入依賴的package包/類
@TargetApi(ICE_CREAM_SANDWICH)
private void setActivityToDestroyed() {
  final ArgumentCaptor<ActivityLifecycleCallbacks> captor =
      forClass(ActivityLifecycleCallbacks.class);

  verify(application).registerActivityLifecycleCallbacks(captor.capture());

  final ActivityLifecycleCallbacks callbacks = captor.getValue();

  callbacks.onActivityDestroyed(activity);
}
 
開發者ID:google,項目名稱:agera,代碼行數:12,代碼來源:RepositoryAdapterTest.java

示例15: setActivityToResumed

import android.app.Application.ActivityLifecycleCallbacks; //導入依賴的package包/類
@TargetApi(ICE_CREAM_SANDWICH)
private void setActivityToResumed() {
  final ArgumentCaptor<ActivityLifecycleCallbacks> captor =
      forClass(ActivityLifecycleCallbacks.class);

  verify(application).registerActivityLifecycleCallbacks(captor.capture());

  final ActivityLifecycleCallbacks callbacks = captor.getValue();

  callbacks.onActivityResumed(activity);
}
 
開發者ID:google,項目名稱:agera,代碼行數:12,代碼來源:RepositoryAdapterTest.java


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