android.app.Activity.getLocalClassName()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(9.1k)|赞(0)|评价(0)|浏览(819)

本文整理了Java中android.app.Activity.getLocalClassName()方法的一些代码示例,展示了Activity.getLocalClassName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Activity.getLocalClassName()方法的具体详情如下:
包路径:android.app.Activity
类名称:Activity
方法名:getLocalClassName

Activity.getLocalClassName介绍

暂无

代码示例

代码示例来源:origin: facebook/facebook-android-sdk

@Override
public void onActivityStopped(Activity activity) {
  if (hasBiillingActivity
      && activity.getLocalClassName().equals(BILLING_ACTIVITY_NAME)) {
    FacebookSdk.getExecutor().execute(new Runnable() {
      @Override
      public void run() {
        final Context context = FacebookSdk.getApplicationContext();
        ArrayList<String> purchases = InAppPurchaseEventManager
            .getPurchasesInapp(context, inAppBillingObj);
        if (purchases.isEmpty()) {
          purchases = InAppPurchaseEventManager
              .getPurchaseHistoryInapp(context, inAppBillingObj);
        }
        logPurchaseInapp(context, purchases);
      }
    });
  }
}

代码示例来源:origin: jingle1267/android-utils

/**
   * 删除程序的快捷方式
   *
   * @param activity Activity
   */
  public static void delShortcut(Activity activity) {
    Intent shortcut = new Intent(
        "com.android.launcher.action.UNINSTALL_SHORTCUT");
    // 快捷方式的名称
    shortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME,
        activity.getString(R.string.app_name));
    String appClass = activity.getPackageName() + ""
        + activity.getLocalClassName();
    ComponentName comp = new ComponentName(activity.getPackageName(),
        appClass);
    shortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, new Intent(
        Intent.ACTION_MAIN).setComponent(comp));
    activity.sendBroadcast(shortcut);
  }
}

代码示例来源:origin: com.uphyca/android-junit4-robolectric

/**
 * @return
 * @see android.app.Activity#getLocalClassName()
 */
public String getLocalClassName() {
  return mActivity.getLocalClassName();
}

代码示例来源:origin: stackoverflow.com

public class MyApplication extends Application implements ActivityLifecycleCallbacks {

  public boolean userLoggedoff;

  ... 

  @Override  
  public void onActivityResumed(Activity activity) {
    Log.i("Activity Resumed", activity.getLocalClassName());

    if (userLoggedoff) 
       startPasswordActivity() // Make sure you add 'CLEAR_TOP' flag to intent
  }

  ... 

}

代码示例来源:origin: iqiyi/Neptune

@Override
public java.lang.String getLocalClassName() {
  return mOriginActivity.getLocalClassName();
}

代码示例来源:origin: stackoverflow.com

@Override
public void onAttach(Activity activity) {
  super.onAttach(activity);
  try{
    mCallback = (BasketCallback)activity;
  }catch(ClassCastException ex){
    throw new ClassCastException(activity.getLocalClassName() + " must implement BasketCallback");
  }
}

代码示例来源:origin: 121880399/QuickMvp

/**
 * 添加Activity
 * */
public void addActivity(Activity activity) {
  if (allActivity != null) {
    Log.d("ddd","activity name:"+activity.getLocalClassName());
    allActivity.put(activity.getLocalClassName(),activity);
  }
}

代码示例来源:origin: devinhu/androidone

/**
 * add Activity to Stack
 */
public void addActivity(Activity activity) {
  if (activityStack == null) {
    activityStack = new Stack<Activity>();
  }
  NLog.e(tag, "app into activity: "+ activity.getLocalClassName());
  activityStack.add(activity);
}

代码示例来源:origin: 121880399/QuickMvp

/**
 * 删除Activity
 * */
public void removeActivity(Activity activity) {
  if (allActivity != null) {
    allActivity.remove(activity.getLocalClassName());
  }
}

代码示例来源:origin: ZhuoKeTeam/QPM

private List<String> getRunningActivityNames() {
    List<Activity> activityList = ActivityUtils.getActivityList();
    List<String> activitiNames = new ArrayList<>();
    for (Activity activity : activityList) {
      activitiNames.add(activity.getLocalClassName());
    }
    return activitiNames;
  }
}

代码示例来源:origin: smuyyh/SprintNBA

/**
   * 删除程序的快捷方式
   *
   * @param activity Activity
   */
  public static void delShortcut(Activity activity) {

    Intent shortcut = new Intent("com.android.launcher.action.UNINSTALL_SHORTCUT");
    // 快捷方式的名称
    shortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME, activity.getString(R.string.app_name));
    String appClass = activity.getPackageName() + "." + activity.getLocalClassName();
    ComponentName comp = new ComponentName(activity.getPackageName(), appClass);
    shortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, new Intent(Intent.ACTION_MAIN).setComponent(comp));
    activity.sendBroadcast(shortcut);
  }
}

代码示例来源:origin: huangweicai/OkLibDemo

/**
   * 删除程序的快捷方式
   *
   * @param activity Activity
   */
  public static void delShortcut(Activity activity) {

    Intent shortcut = new Intent(
        "com.android.launcher.action.UNINSTALL_SHORTCUT");
    // 快捷方式的名称
    shortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME,
        activity.getString(R.string.app_name));
    String appClass = activity.getPackageName() + "."
        + activity.getLocalClassName();
    ComponentName comp = new ComponentName(activity.getPackageName(),
        appClass);
    shortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, new Intent(
        Intent.ACTION_MAIN).setComponent(comp));
    activity.sendBroadcast(shortcut);
  }
}

代码示例来源:origin: HJXANDHMR/AndroidUtils

/**
   * 删除程序的快捷方式
   *
   * @param activity Activity
   */
  public static void delShortcut(Activity activity) {

    Intent shortcut = new Intent(
        "com.android.launcher.action.UNINSTALL_SHORTCUT");
    // 快捷方式的名称
    shortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME,
        activity.getString(R.string.app_name));
    String appClass = activity.getPackageName() + "."
        + activity.getLocalClassName();
    ComponentName comp = new ComponentName(activity.getPackageName(),
        appClass);
    shortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, new Intent(
        Intent.ACTION_MAIN).setComponent(comp));
    activity.sendBroadcast(shortcut);
  }
}

代码示例来源:origin: ZhuoKeTeam/QPM

@Override
public void exec() throws QPMException {
  Activity topActivity = ActivityUtils.getTopActivity();
  if (topActivity != null) {
    analysys.onCollectTopActivityInfo(topActivity.getLocalClassName());
  }
}

代码示例来源:origin: wordplat/ikvStockChart

private void initUI() {
  View view = LayoutInflater.from(getContext()).inflate(R.layout.view_list_refresh, null);
  statusHint = (TextView) view.findViewById(R.id.list_refresh_status);
  updateTime = (TextView) view.findViewById(R.id.list_refresh_updateTime);
  loadingImage = (ImageView) view.findViewById(R.id.list_refresh_loading_image);
  loadingImage.setVisibility(GONE);
  view.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
  addView(view);
  sDataFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  mLastUpdateTimeUpdater = new LastUpdateTimeUpdater();
  try {
    mLastUpdateTimeKey = ((Activity)getContext()).getLocalClassName();
    UPDATE_TIME_KEY = getContext().getPackageName();
  }catch (Exception e) {
    e.printStackTrace();
  }
}

代码示例来源:origin: wordplat/TabNavigation

private void initUI() {
  View view = LayoutInflater.from(getContext()).inflate(R.layout.view_list_refresh, null);
  statusHint = (TextView) view.findViewById(R.id.list_refresh_status);
  updateTime = (TextView) view.findViewById(R.id.list_refresh_updateTime);
  loadingImage = (ImageView) view.findViewById(R.id.list_refresh_loading_image);
  loadingImage.setVisibility(GONE);
  view.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
  addView(view);
  sDataFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  mLastUpdateTimeUpdater = new LastUpdateTimeUpdater();
  try {
    mLastUpdateTimeKey = ((Activity)getContext()).getLocalClassName();
    UPDATE_TIME_KEY = getContext().getPackageName();
  }catch (Exception e) {
    e.printStackTrace();
  }
}

代码示例来源:origin: bitstadium/HockeySDK-Android

view.setDrawingCacheEnabled(true);
final Bitmap bitmap = view.getDrawingCache();
final String filename = currentActivity.getLocalClassName();

代码示例来源:origin: michelelacorte/AndroidAppShortcuts

}else{
  out.writeUTF(activity.getPackageName());
  out.writeUTF(activity.getPackageName()+"."+activity.getLocalClassName());

代码示例来源:origin: sregg/spotify-tv

@SuppressWarnings("deprecation")
private void riseAndShine(Activity activity) {
  KeyguardManager keyguardManager = (KeyguardManager) activity.getSystemService(Context.KEYGUARD_SERVICE);
  KeyguardLock keyguardLock = keyguardManager.newKeyguardLock(activity.getLocalClassName());
  keyguardLock.disableKeyguard();
  activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
  PowerManager powerManager = (PowerManager) activity.getSystemService(Context.POWER_SERVICE);
  WakeLock lock = powerManager.newWakeLock(
      PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE,
      "wakeup!");
  lock.acquire();
  lock.release();
}

代码示例来源:origin: appium/appium-espresso-driver

public static void startActivity(String activity, @Nullable String waitActivity,
                   @Nullable Long waitDuration) {
    logger.info(String.format("Starting activity '%s'", activity));
    Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
    String fullyQualifiedAppActivity = getFullyQualifiedActivityName(instrumentation, activity);
    String fullyQualifiedWaitActivity = isBlank(waitActivity)
        ? fullyQualifiedAppActivity
        : getFullyQualifiedActivityName(instrumentation, waitActivity);
    Intent intent = new Intent(Intent.ACTION_MAIN);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setClassName(instrumentation.getTargetContext(), fullyQualifiedAppActivity);
    Instrumentation.ActivityMonitor activityStateMonitor = instrumentation
        .addMonitor(fullyQualifiedWaitActivity, null, false);
    instrumentation.startActivitySync(intent);
    if (waitDuration == null) {
      waitDuration = ACTIVITY_STARTUP_TIMEOUT;
    }
    Activity currentActivity = instrumentation.waitForMonitorWithTimeout(activityStateMonitor, waitDuration);
    if (currentActivity == null) {
      throw new IllegalStateException(String.format("Activity '%s' was unable to start within %sms timeout",
          fullyQualifiedWaitActivity, waitDuration));
    }
    logger.info(String.format("Activity '%s' started", currentActivity.getLocalClassName()));
  }
}

相关文章

Activity类方法