本文整理汇总了Java中android.app.Activity.getTitle方法的典型用法代码示例。如果您正苦于以下问题:Java Activity.getTitle方法的具体用法?Java Activity.getTitle怎么用?Java Activity.getTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.app.Activity
的用法示例。
在下文中一共展示了Activity.getTitle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applyTaskDescription
import android.app.Activity; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private static void applyTaskDescription(@NonNull Activity activity, @Nullable String key) {
int color = 0;
Bitmap icon = null;
if (activity instanceof ATETaskDescriptionCustomizer) {
final ATETaskDescriptionCustomizer customizer = (ATETaskDescriptionCustomizer) activity;
color = customizer.getTaskDescriptionColor();
icon = customizer.getTaskDescriptionIcon();
if (color == ATE.USE_DEFAULT)
color = Config.primaryColor(activity, key);
} else {
color = Config.primaryColor(activity, key);
}
// Task description requires fully opaque color
color = ATEUtil.stripAlpha(color);
// Default is app's launcher icon
if (icon == null)
icon = ((BitmapDrawable) activity.getApplicationInfo().loadIcon(activity.getPackageManager())).getBitmap();
// Sets color of entry in the system recents page
ActivityManager.TaskDescription td = new ActivityManager.TaskDescription(
(String) activity.getTitle(), icon, color);
activity.setTaskDescription(td);
}
示例2: applyTaskDescription
import android.app.Activity; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private static void applyTaskDescription(@NonNull Activity activity, @Nullable String key, int color) {
// Sets color of entry in the system recents page
try {
ActivityManager.TaskDescription td = new ActivityManager.TaskDescription(
(String) activity.getTitle(),
((BitmapDrawable) activity.getApplicationInfo().loadIcon(activity.getPackageManager())).getBitmap(),
color);
activity.setTaskDescription(td);
} catch (Exception ignored) {
}
}