我正在学习C语言,我正在尝试创建一个创建字符串数组的程序.我现在正在尝试这个:
char str[2][10];
strcpy(str[0], "foo");
strcpy(str[1], "bar");
printf("%d \n",str[0]);
printf("%d \n",str[1]);
Run Code Online (Sandbox Code Playgroud)
但我printf只返回一些数字,我希望它显示foo和bar.我一直在阅读,我认为它正在显示指向我的字符串的指针.我究竟做错了什么?
我正在建立一个使用切换按钮启动的通知:
toggleLigar.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if(toggleLigar.isChecked()){
NotificationUtil.cancelaAll(TelaCriaDesp.this);
CharSequence tickerText = "Despertador ativado!";
CharSequence title = "Você não vai perder seu ponto!";
CharSequence message = "O despertador " + despertador.getNomeDesp() + " está ativo!";
Intent intent = new Intent(TelaCriaDesp.this, TelaCriaDesp.class);
NotificationUtil.criaNotification(TelaCriaDesp.this, tickerText, title, message,
despertador.getDesp_id(), intent);
} else {
NotificationUtil.cancelaNotification(TelaCriaDesp.this, despertador.getDesp_id());
}
}
});
Run Code Online (Sandbox Code Playgroud)
现在我想根据通知状态将切换按钮分配为ON或OFF,如果它处于活动状态(正在显示),则处于ON状态,处于非活动状态则处于OFF状态...我已经尝试过:
public static boolean testaNotification(int id, Context context){
Intent intent = new Intent(context, TelaCriaDesp.class);
//intent.setAction(Intent.);
PendingIntent teste …Run Code Online (Sandbox Code Playgroud)