我使用了较新的NotificationCompat构建器,但我无法收到通知以发出声音.它会振动并闪烁光线.android文档说要设置我已完成的样式:
builder.setStyle(new NotificationCompat.InboxStyle());
Run Code Online (Sandbox Code Playgroud)
但没声音?
完整代码:
NotificationCompat.Builder builder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_launcher)
.setContentTitle("Notifications Example")
.setContentText("This is a test notification");
Intent notificationIntent = new Intent(this, MenuScreen.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent,
PendingIntent.FLAG_UPDATE_CURRENT);
builder.setContentIntent(contentIntent);
builder.setAutoCancel(true);
builder.setLights(Color.BLUE, 500, 500);
long[] pattern = {500,500,500,500,500,500,500,500,500};
builder.setVibrate(pattern);
builder.setStyle(new NotificationCompat.InboxStyle());
// Add as notification
NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
manager.notify(1, builder.build());
Run Code Online (Sandbox Code Playgroud) 我敢肯定我错过了一些非常直接的东西.使用普通字体的单个自定义字体:
@font-face {
font-family: CustomFont;
src: url('CustomFont.ttf');
}
Run Code Online (Sandbox Code Playgroud)
我使用它时一切正常但如果我想添加另一个自定义字体我该怎么办?我尝试用逗号分隔下一个或添加一个完整的其他字体但无法使第二个字体工作.
我尝试用正确的APP_ID,APP_SECRET等发送curl请求到
https://oauth.vk.com/access_token?client_id=APP_ID&client_secret=APP_SECRET&code=7a6fa4dff77a228eeda56603b8f53806c883f011c40b72630bb50df056f6479e52a&redirect_uri=REDIRECT_URI
Run Code Online (Sandbox Code Playgroud)
我需要从它获取access_token,但得到一个FALSE并curl_error()
打印下一条消息,否则:
60: SSL certificate problem: self signed certificate in certificate chain
Run Code Online (Sandbox Code Playgroud)
我的代码是:
// create curl resource
$ch = curl_init();
// set url
curl_setopt($ch, CURLOPT_URL, $url);
//return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// $output contains the output string
$output = curl_exec($ch);
if ( ! $output) {
print curl_errno($ch) .': '. curl_error($ch);
}
// close curl resource to free up system resources
curl_close($ch);
return $output;
Run Code Online (Sandbox Code Playgroud)
当我手动移动到上面的链接时,我得到了access_token.为什么它不适用于卷曲?请帮忙.
我以前从未这样做过,也找不到答案.这可能不是用于此的正确数据类型,但我只想分配一个int,然后另一个没有for循环的int进入2D数组,这些值实际上是从另一个函数返回的,但为了简单起见我刚刚使用了int i和k,这就是我认为你会这样做的,但它不是:
int contents[][] = new int[2][2];
contents[0][0] = {int i, int k}
contents[1][1] = {int i, int k}
contents[2][2] = {int i, int k}
Run Code Online (Sandbox Code Playgroud)
TIA - 如果我正在咆哮错误的树,请随意指向更好的数据结构的方向.
可能重复:
Java - 将字符串转换为枚举
我有一个使用枚举的方法:
mymethod(AnotherClass.MyEnum.PassedEnum);
Run Code Online (Sandbox Code Playgroud)
我想在一个接收一个成为MyEnum的String的类中嵌套它:
public static void method(String toPass){
mymethod(AnotherClass.toPass.PassedEnum);
}
Run Code Online (Sandbox Code Playgroud)
传递的变量必须是一个String但是我需要将它转换为Enum以传递给AnotherClass?
TIA
我知道你不能动态扩展普通数组,但这是一种有效的方法吗?
public int size = 0;
public String[] OrigArray = new String[size+1];
public void expand(){
String[] tempArray = new String[size+1];
tempArray = (String[])OrigArray.clone();
OrigArray = new String[size+1];
OrigArray = (String[])tempArray.clone();
size++;
}
Run Code Online (Sandbox Code Playgroud)
我知道比尝试使用普通数组要好得多的方法,但是我想首先使用普通数组来解决这个问题.
我的愿望是它开始时OrigArray
为0 + 1(所以1)并且当expand()
被调用时,new tempArray
被制作为与之相同的大小OrigArray
然后保持OrigArray
同时OrigArray
再次声明size+1
然后将tempArray
其复制回新的大小OrigArray
.这对我来说很有意义,但我一直在走出异常?
在C++中,我有一个char数组定义为:
char miniAlphabet[] = {'A','B','C','D','E', '\0'};
Run Code Online (Sandbox Code Playgroud)
我想从其他函数修改此数组的值,而不将其传递给这些函数.这是你使用指针的地方吗?
所以我的问题是制作指向这个char数组的指针的正确方法是什么.我只是制作一个指向第一个元素的指针,然后当我想修改值时,我逐步通过内存直到我点击结束字符?
我的表架构如下所示:
+--------------------+--------------+------+-----+-------------------+-----------------------------+
| Field | Type | Null | Key | Default | Extra |
+--------------------+--------------+------+-----+-------------------+-----------------------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| name | varchar(50 | NO | | 0 | |
| modified | timestamp | NO | | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
| created | timestamp | NO | | CURRENT_TIMESTAMP | |
+--------------------+--------------+------+-----+-------------------+-----------------------------+
Run Code Online (Sandbox Code Playgroud)
我想获得名称的计数并按按天修改的名称数量分组,目前我只能按完整日期(包括时间戳)分组,例如:
SELECT name, count(*) FROM mytable GROUP BY modified
Run Code Online (Sandbox Code Playgroud)
提前致谢。
我在互联网上搜索过但无法找到答案:
我正在使用for循环来创建名为a1,a2等的36个按钮,并同时为每个按钮分配一个唯一的Action Command.
后来我想从actionPerformed(ActionEvent e)方法中获取按钮的名称.
我可以让ActionCommand足够简单,但我也需要按钮的名称.
任何帮助非常感谢!
编辑:
这是我正在使用的代码:
String letters[] = {"0", "a", "b", "c", "d", "e", "f"};
JButton btn[] = new JButton[35];
int count = 0;
for (int f=1; f < 7;f++){
for (int i=1; i < 7;i++){
btn[i] = new JButton(letters[f]+i, cup);
System.out.println(btn[i]));
mainGameWindow.add(btn[i]);
btn[i].addActionListener(this);
String StringCommand = Integer.toString(randomArrayNum());
btn[i].setActionCommand(StringCommand);
count++;
if(count == 18){
generateArray();
}
}
}
Run Code Online (Sandbox Code Playgroud)
这为6x6网格提供了36个按钮,分别为a1-6,b1-6,c1-6等
一旦我以这种方式创建按钮,我似乎无法控制按钮,我无法分配图标或获取按钮的名称.
提前致谢.
我安装了jre 7和jdk 6u29.我无法安装jre6,因为它的旧版本正在停止安装,我已经尝试删除它的所有痕迹,但它仍然告诉我安装了旧版本.
我的问题是我可以使用jdk6和jre7组合为GoogleApp引擎开发吗?我的日志中一直出现错误,表明该类是使用错误的java版本编译的?