本文整理匯總了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);
}
}
}
示例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);
}
}
示例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;
}
示例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);
}
}
示例5: onActivityStarted
import android.app.Application.ActivityLifecycleCallbacks; //導入依賴的package包/類
@Override
public void onActivityStarted(Activity activity) {
ActivityLifecycleCallbacks callbacks=getLifeCycle(activity);
if(callbacks!=null){
callbacks.onActivityStarted(activity);
}
}
示例6: onActivityResumed
import android.app.Application.ActivityLifecycleCallbacks; //導入依賴的package包/類
@Override
public void onActivityResumed(Activity activity) {
ActivityLifecycleCallbacks callbacks=getLifeCycle(activity);
if(callbacks!=null){
callbacks.onActivityResumed(activity);
}
}
示例7: onActivityPaused
import android.app.Application.ActivityLifecycleCallbacks; //導入依賴的package包/類
@Override
public void onActivityPaused(Activity activity) {
ActivityLifecycleCallbacks callbacks=getLifeCycle(activity);
if(callbacks!=null){
callbacks.onActivityPaused(activity);
}
}
示例8: onActivityStopped
import android.app.Application.ActivityLifecycleCallbacks; //導入依賴的package包/類
@Override
public void onActivityStopped(Activity activity) {
ActivityLifecycleCallbacks callbacks=getLifeCycle(activity);
if(callbacks!=null){
callbacks.onActivityStopped(activity);
}
}
示例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);
}
}
示例10: onActivityDestroyed
import android.app.Application.ActivityLifecycleCallbacks; //導入依賴的package包/類
@Override
public void onActivityDestroyed(Activity activity) {
ActivityLifecycleCallbacks callbacks=getLifeCycle(activity);
if(callbacks!=null){
callbacks.onActivityDestroyed(activity);
}
}
示例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));
}
示例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));
}
示例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);
}
示例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);
}
示例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);
}