本文整理汇总了Java中com.codename1.io.Util.encodeUrl方法的典型用法代码示例。如果您正苦于以下问题:Java Util.encodeUrl方法的具体用法?Java Util.encodeUrl怎么用?Java Util.encodeUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.codename1.io.Util
的用法示例。
在下文中一共展示了Util.encodeUrl方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendMessage
import com.codename1.io.Util; //导入方法依赖的package包/类
@Override
public void sendMessage(String[] recieptents, String subject, Message msg) {
if(recieptents != null){
try {
String mailto = "mailto:" + recieptents[0];
for(int iter = 1 ; iter < recieptents.length ; iter++) {
mailto += "," + recieptents[iter];
}
mailto += "?body=" + Util.encodeUrl(msg.getContent()) + "&subject=" + Util.encodeUrl(subject);
Desktop.getDesktop().mail(new URI(mailto));
} catch (Exception ex) {
ex.printStackTrace();
}
System.out.println("sending message to " + recieptents[0]);
}
}
示例2: sendMessage
import com.codename1.io.Util; //导入方法依赖的package包/类
public void sendMessage(String[] recieptents, String subject, Message msg) {
String mailto = "mailto:" + recieptents[0];
for(int iter = 1 ; iter < recieptents.length ; iter++) {
mailto += "," + recieptents[iter];
}
mailto += "?body=" + Util.encodeUrl(msg.getContent()) + "&subject=" + Util.encodeUrl(subject);
execute(mailto);
}
示例3: buildQueryStringParameter
import com.codename1.io.Util; //导入方法依赖的package包/类
private String buildQueryStringParameter(String key, String val)
{
return Util.encodeUrl(key) + "=" + Util.encodeUrl(val);
}
示例4: createMediaByTrack
import com.codename1.io.Util; //导入方法依赖的package包/类
/*******************************************************************************************************************
*
* Helper ...
*
******************************************************************************************************************/
private MediaItem createMediaByTrack(Map track, ActionListener coverActionListener) throws MediaNotFoundException, IOException {
String url = null;
Boolean isOffline = false;
if (MediaHelper.getState(track) == MediaHelper.DOWNLOADED)
{
String path = FileManager.getInstance().getFullPath(MediaHelper.getLocalFilename(track));
url = path;
isOffline = true;
}
else {
for (Map itemMedia : (ArrayList<Map>)track.get("media")) {
if ("audio".equals(itemMedia.get("type"))) {
Map file = ((ArrayList<Map>)itemMedia.get("files")).get(0);
url = (String)file.get("url");
}
}
// There was no playable media in here. Go on and try playing the next.
if (url == null) {
log("No audio found in " + MediaHelper.getId(track));
throw new MediaNotFoundException();
}
if (url.startsWith("https://")) {
url = "http://"
// Maybe we have an "@" in the username ...
+ Util.encodeUrl(Api.getInstance().getProfile().getUsername())
+ ":"
+ Util.encodeUrl(Api.getInstance().getProfile().getToken())
+ "@"
+ url.substring(8);
}
}
Log.p("url: " + url);
final MediaItem media = new MediaItem(url, track, isOffline);
Log.p("new Media created");
// This should be null if the track is pre-loading.
if (coverActionListener != null) {
media.addCoverLoadedListener(coverActionListener);
}
if (coverUrl == null || !coverUrl.equals(media.getCoverUrl())) {
// Reset cover variables
coverUrl = null;
cover = null;
// Load the cover in a separate thread. It may take time to read the ID3 header of the file or where ever the image actually comes from.
Display.getInstance().scheduleBackgroundTask(new Runnable() {
public void run() {
media.initCover();
}
});
} else {
media.setCover(cover);
Log.p("Reuse loaded cover.");
}
return media;
}