This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static boolean SendSMS(String phone, String text){ | |
try { | |
String smsurl = "sms://+"+phone; | |
MessageConnection conn = | |
(MessageConnection)Connector.open(smsurl); | |
TextMessage msgOut = (TextMessage) conn.newMessage(MessageConnection.TEXT_MESSAGE); | |
msgOut.setPayloadText(text); | |
Utils.log("sending to "+smsurl); | |
conn.send(msgOut); | |
return true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static synchronized String getAppVersion() { | |
ApplicationDescriptor descriptor = ApplicationDescriptor.currentApplicationDescriptor(); | |
String version = descriptor.getVersion(); //read from the alx files | |
if(version == null || version.trim().equals("")) { //read value from jad file | |
CodeModuleGroup[] allGroups = CodeModuleGroupManager.loadAll(); | |
String moduleName = ApplicationDescriptor.currentApplicationDescriptor().getModuleName(); | |
if (moduleName == null || allGroups == null) { | |
return "1.0 (sim)"; // be default, for simulator | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Inherit your main window from this custom class: | |
@implementation MotionWindow | |
- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event { | |
if (event.type == UIEventTypeMotion && event.subtype == UIEventSubtypeMotionShake) { | |
NSLog(@"Global Shake!"); | |
[[NSNotificationCenter defaultCenter] postNotificationName:@"DeviceShaken" object:self]; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)setHtml:(NSString*)content{ | |
NSString *r = [NSString stringWithFormat:@"<html><body style='background-color: transparent'>%@</body></html>", content,nil]; | |
[calcview loadHTMLString:r baseURL:nil]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public boolean isNetworkAvailable() { | |
Context context = getApplicationContext(); | |
ConnectivityManager connectivity = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); | |
if (connectivity == null) { | |
return true; | |
} else { | |
NetworkInfo[] info = connectivity.getAllNetworkInfo(); | |
if (info != null) { | |
for (int i = 0; i < info.length; i++) { | |
if (info[i].getState() == NetworkInfo.State.CONNECTED) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final String dir = System.getProperty("fileconn.dir.memorycard")+ "BlackBerry/SubFolder/"; | |
public final static void createDir(String dir) { | |
FileConnection fconn; | |
try { | |
fconn = (FileConnection) Connector.open(dir, | |
Connector.READ_WRITE); | |
if (!fconn.exists()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getApplication().addGlobalEventListener(this); | |
public void eventOccurred(long guid, int data0, int data1, Object object0, | |
Object object1) { | |
if(guid != Main.NOTIFICATIONS_ID_1) return; | |
Utils.log("db changed, reloading list"); | |
UiApplication.getUiApplication().invokeLater(new Runnable() { | |
public void run() { | |
try { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File sd = new File(Environment.getExternalStorageDirectory() + File.separator + PDFFolder + File.separator + model.get(idx)); | |
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.fromFile(sd)); | |
intent.setDataAndType(Uri.fromFile(sd), "application/pdf"); | |
try { | |
getContext().startActivity(intent); | |
}catch(ActivityNotFoundException e){ | |
//Show a message that PDF viewer is not installed | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resultView.setText(result); | |
while(resultView.getLayout().getLineWidth(0) < (resultView.getRight() - resultView.getLeft())) | |
resultView.setText(resultView.getText() + " "); |
OlderNewer