我必须为菜单项添加自定义图标.请任何人建议我?我已经使用CSS类设置了图标但是没有显示.
<p:submenu label="Administration" >
<p:menuitem value="Role Master" url="/secured/role_master.xhtml?redirect=true" />
<p:menuitem value="Role Assignment" url="#" />
<p:menuitem value="User Management" url="/secured/users.xhtml?redirect=true" icon="user"/>
</p:submenu>
Run Code Online (Sandbox Code Playgroud)
以下代码代表css类
.user{
background: url('resources/images/menu/users.png') no-repeat;
height:16px;
width:16px;
}
Run Code Online (Sandbox Code Playgroud) 我想每 5 分钟向用户发送一次通知,我正在使用以下代码。它第一次向我显示通知,但下次不给。
public void startAlarm() {
AlarmManager alarmManager = (AlarmManager) this.getSystemService(this.ALARM_SERVICE);
long whenFirst = System.currentTimeMillis(); // notification time
Intent intent = new Intent(this, NotifyUser.class);
PendingIntent pendingIntent = PendingIntent.getService(this, 0, intent, 0);
alarmManager.setRepeating(AlarmManager.RTC, whenFirst, 60*5000, pendingIntent);
}
public class NotifyUser extends Service {
@Override
public IBinder onBind(Intent intent) {
// TODO Auto-generated method stub
return null;
}
@Override
public void onCreate() {
super.onCreate();
loadNotification();
}
private void loadNotification() {
NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
Notification notify = new Notification(R.drawable.ic_launcher/*android.R.drawable.stat_notify_more*/, "Hanumanji …Run Code Online (Sandbox Code Playgroud) 在尝试了几乎每一个关于这个问题的回答后,我都没有找到解决问题的方法.
问题:所以我AFNetworking 2.0.3在移植之后使用以下内容实现了我的应用程序的上传部分AFNetworking 1.3:
-(void)commandWithParams:(NSMutableDictionary*)params onCompletion:(JSONResponseBlock)completionBlock {
NSData* uploadFile = nil;
if ([params objectForKey:@"file"]) {
uploadFile = (NSData*)[params objectForKey:@"file"];
[params removeObjectForKey:@"file"];
}
AFHTTPRequestOperationManager *manager = [[AFHTTPRequestOperationManager alloc] initWithBaseURL:[NSURL URLWithString:@"http://54.204.17.38"]];
manager.responseSerializer = [AFJSONResponseSerializer serilizer];
manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"application/json"];
AFHTTPRequestOperation *apiRequest = [manager POST:@"/API" parameters:params constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {
if (uploadFile) {
[formData appendPartWithFileData:uploadFile name:@"file" fileName:@"photo.jpg" mimeType:@"image/jpeg"];
}
} success:^(AFHTTPRequestOperation *operation, id responseObject) {
completionBlock(responseObject);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
completionBlock([NSDictionary dictionaryWithObject:[error localizedDescription] forKey:@"error"]);
}];
[apiRequest start];
Run Code Online (Sandbox Code Playgroud)
} …
String temp_date="07/28/2011 11:06:37 AM";
Date date = new Date(temp_date); //Depricated
SimpleDateFormat sdf = new SimpleDateFormat("MMM-dd-yyyy hh:mm:ss");
String comp_date= sdf.format(date);
System.out.println(comp_date);
Run Code Online (Sandbox Code Playgroud)
这有效,但如果我使用这样的东西
String temp_date="07/28/2011 11:06:37 AM";
try{
SimpleDateFormat sdf = new SimpleDateFormat("MMM-dd-yyyy hh:mm:ss");
Date comp_date= sdf.parse(temp_date);
System.out.println(comp_date);
}catch(Exception e){
System.out.println(e);
}
Run Code Online (Sandbox Code Playgroud)
抛出此异常:
java.text.ParseException: Unparseable date: "07/28/2011 11:06:37 AM"
Run Code Online (Sandbox Code Playgroud) 我正在尝试通过使用该setOnClickFillInIntent方法使我的ListView Widget中的listrows可单击,但每当我单击ListItem时都没有发生任何事情.以下是我的代码的一些关键部分:
Intent i = new Intent();
Bundle extras = new Bundle();
extras.putInt(Resource.WIDGET_PACKAGE, position);
i.putExtras(extras);
row.setOnClickFillInIntent(R.id.widget_layout_parent, i);
Run Code Online (Sandbox Code Playgroud)
这是getView()我的ViewFactory 的结尾.Resource.WIDGET_PACKAGE包含我的包名称,就像任何其他键一样.位置int来自getView()参数.R.id.widget_layout_parent是所有列表项中的父布局.
这是我的WidgetProviders的结束 onUpdate()
Intent clickIntent = new Intent(context, ItemListActivity.class);
PendingIntent clickPI = PendingIntent.getActivity(context, 0,
clickIntent, PendingIntent.FLAG_UPDATE_CURRENT);
widget.setPendingIntentTemplate(R.id.widget_layout_parent, clickPI);
appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds[i],
R.id.widget_list_view);
Run Code Online (Sandbox Code Playgroud)
有什么我想念的,或者你还有什么想知道的吗?
所有帮助表示赞赏!:)
android android-widget android-listview remoteview android-pendingintent
我下面有简单的脚本,
if [ ! -e $c ];
then
mkdir "$c"
fi
Run Code Online (Sandbox Code Playgroud)
$ c包含文件夹路径.我收到错误mkdir:command not found.请帮帮我.
提前致谢.纳瓦迪普
我正在尝试解析日期字符串到日期但无法解析.它显示了一些例外
码
Date date = null;
String dtStart = "2013-11-08 05:46:55" ;
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
try {
date = format.parse(dtStart);
System.out.println("Date ->"+date);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
Stacktace:
11-08 19:04:06.394: W/System.err(8659): java.text.ParseException: Unparseable date: "2013-11-08 05:46:55"
11-08 19:04:06.402: W/System.err(8659): at java.text.DateFormat.parse(DateFormat.java:626)
Run Code Online (Sandbox Code Playgroud)
请给出一些解决方案
android ×3
date ×2
command ×1
content-type ×1
datetime ×1
ios ×1
java ×1
jsf ×1
json ×1
mkdir ×1
objective-c ×1
primefaces ×1
remoteview ×1
shell ×1