×
Namespaces

Variants
Actions
(Difference between revisions)

Checando se uma API específica é suportada em Java ME

From Nokia Developer Wiki
Jump to: navigation, search
hamishwillee (Talk | contribs)
m (Hamishwillee - Fix categories)
hamishwillee (Talk | contribs)
m (Hamishwillee - Bot update - Fix metadata)
Line 13: Line 13:
 
|language= Lang-Portuguese
 
|language= Lang-Portuguese
 
|translated-by= [[User:Ivocalado]]
 
|translated-by= [[User:Ivocalado]]
|translated-from-title= Archived:How to check if a specific API is supported in Java ME
+
|translated-from-title= How to check if a specific API is supported in Java ME
 
|translated-from-id= 35599 <!-- automated guess -->
 
|translated-from-id= 35599 <!-- automated guess -->
 
|review-by= <!-- After re-review: [[User:username]] -->
 
|review-by= <!-- After re-review: [[User:username]] -->
Line 66: Line 66:
  
  
<!-- Translation --> [[en:Archived:How to check if a specific API is supported in Java ME]]
+
<!-- Translation --> [[en:How to check if a specific API is supported in Java ME]][[Category:Nokia Belle]] [[Category:S60 5th Edition]] [[Category:Series 40 6th Edition (initial release)]] [[Category:MIDP 2.0]] [[Category:Series 40]] [[Category:Symbian]] [[Category:Series 40 Developer Platform 2.0]] [[Category:Symbian Anna]] [[Category:S60 3rd Edition (initial release)]] [[Category:Series 40 Developer Platform 1.0]] [[Category:Series 40 3rd Edition FP1]] [[Category:Series 40 3rd Edition FP2]] [[Category:Java Runtime 2.3 for Symbian]] [[Category:S60 3rd Edition FP2]] [[Category:Code Snippet]] [[Category:Series 40 6th Edition FP1]] [[Category:Series 40 5th Edition (initial release)]] [[Category:Series 40 5th Edition FP1]] [[Category:Symbian^3]] [[Category:Series 40 Developer Platform 1.1]]

Revision as of 09:08, 14 September 2012

Article Metadata

Testado com
Aparelho(s): Nokia N95 8GB

Compatibilidade
Artigo
Palavras-chave: java.lang.System, javax.microedition.lcdui.Alert, javax.microedition.lcdui.AlertType, java.lang.System.getProperty()
Tradução:
Por ivocalado
Última alteração feita por hamishwillee em 14 Sep 2012

Contents

Introdução

Este trecho de código demonstra como verificar se uma determinada API Java ME é suportada no dispositivo e também qual versão é suportada. Neste exemplo, a API verificada é a API Wireless Messaging API.


Note.pngNote: O método System.getProperty() pode também ser usado para obter diversas outras propriedades que apenas versões de API. See Getting System properties in MIDP para uma lista de possibilidades.

Código fonte

import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.AlertType;
import javax.microedition.lcdui.Display;
String wmVersion = System.getProperty("wireless.messaging.version");
if (wmVersion != null) {
// A API Wireless messaging é suportada. Notificar ao usuário.
Alert alert = new Alert("Supported",
"Wireless messaging is supported. Version is: " + wmVersion,
null, AlertType.INFO);
Display.getDisplay(this).setCurrent(alert);
} else {
// A API Wireless messaging não é suportada neste dispositivo. Notificar ao usuário.
Alert alert = new Alert("Not supported",
"Wireless messaging is not supported.", null,
AlertType.INFO);
Display.getDisplay(this).setCurrent(alert);
}

Pós-condições

A MIDlet mostra um alerta que informa se a API Wireless Messaging API é suportada e em caso positivo, qual versão é suportada.

See also

64 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×