我正在notification我的应用程序中显示OS versions除了Android 7.0(Nougat)以外的所有工作正常.这是代码
Intent notificationIntent = new Intent(context, HomeScreenActivity.class);
// set intent so it does not start a new activity
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent intent = PendingIntent.getActivity(context, 0, new Intent(), PendingIntent.FLAG_UPDATE_CURRENT | Notification.FLAG_AUTO_CANCEL | Notification.FLAG_SHOW_LIGHTS);
Notification.Builder builder = new Notification.Builder(context);
builder.setContentIntent(intent)
.setAutoCancel(true)
.setPriority(Notification.PRIORITY_MAX)
.setContentTitle(title)
.setStyle(new Notification.BigTextStyle().bigText(message))
.setContentText(message);
if (Build.VERSION.SDK_INT >= 21)
builder.setVibrate(new long[0]);
notification.flags = Notification.DEFAULT_LIGHTS | Notification.FLAG_AUTO_CANCEL;
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
builder.setColor(context.getResources().getColor(R.color.colorPrimary));
builder.setSmallIcon(R.drawable.ic_nav_reward_point);
}else{
builder.setSmallIcon(R.drawable.launcher_icon);
}
builder.setAutoCancel(true);
builder.setContentIntent(intent);
notification.flags |= Notification.FLAG_AUTO_CANCEL; …Run Code Online (Sandbox Code Playgroud) 我有一个类型的哈希图String,ArrayList<String>.两个不同keys的存储在哈希映射中,其中包含值列表.
现在我必须比较不同键的值并提取公共值.怎么能实现这个功能?
以下是Hashmap我使用的类型:
示例列表:
{Size=[43, 53, 63, 48, 58], Color=[66, 62, 65, 64, 63]}
Run Code Online (Sandbox Code Playgroud)
这是代码......
private HashMap<String, ArrayList<String>> mapMatchvalues = new HashMap<>();
for (Map.Entry<String, ArrayList<String>> map3 : mapMatchvalues.entrySet()) {
List<String> getList1 = new ArrayList<>();
getList1 = map3.getValue();
for (int i = 0; i < getList1.size(); i++) {
if (getList.contains(getList1.get(i))) {
//Print values
} else {
// Print if not matched....
}
}
}
Run Code Online (Sandbox Code Playgroud) 我正在为phone和实现一个应用程序tablet.我不确定哪个layout folder和value folder将被包含在项目中.任何人都可以给我一些关于layout folders要包含在res应用程序文件夹中的想法.