06-28-2011 04:51 PM
Call the enterEventDispatcher before deleting the contact. This will provide an application instance.
06-30-2011 07:52 AM
how could i call enterEventDispatcher in background thread .I run this thread using alternet entry point .So this thread is active before createing object of UiApplication.Is there any way i could keep my instance of application alive forever.
please help me on this.
06-30-2011 10:28 AM
You could handle this using one entry point. Use Application.requestBackground to move the GUI application to the background (instead of exiting). You can also override Application.acceptsForeground to return false while the application is in this state to prevent it from appearing in the task switcher.
07-01-2011 05:54 AM - edited 07-01-2011 06:02 AM
After switching to one entry point and overriding the onClose()...in which i have send my application in background create following problem...
I m giving my code sample...
public static void main(String args[]) {
try {
if (mBackgroundThread == null) {
System.out.println("Background thread started from main: thread is null");
startThread();
} else {
if (!BackGroundApp.isAlive) {
System.out.println("Background thread started from main: thread is not alive");
startThread();
}
}
} catch (Exception e) {
System.out.println("Exception in background thread");
e.printStackTrace();
}
App = new BBApplication();
App.enterEventDispatcher();
}
public static void startThread() {
mBackgroundThread = new BackGroundApp();
mBackgroundThread.start();
}
public boolean Close() {
System.out.println("On close method of ifind");
App.requestBackground();
return false;
}
/* public boolean requestClose()
{
System.out.println("On requestclose method of ifind");
App.requestBackground();
return false;
}*/
.........
...
Now ,Exception source code not found but still call log is not deleted .. i posting my this code also again...
public void wipeCallLogDetails() {
PhoneLogs _callLog=PhoneLogs.getInstance();
int noofNormalCalls = _callLog.numberOfCalls(_callLog.FOLDER_NORMAL_CALL
int noOfMissCalls=_callLog.numberOfCalls(_callLog.FOLD
for(int i=0;i<noofNormalCalls;i++)
{
try {
_callLog.deleteCall(i,_callLog.FOLDER_NORMAL_CALLS
}
catch(Exception e)
{
System.out.println("BG:normal call log delete ::"+e.getMessage());
e.printStackTrace();
}
}
for(int i=0;i<noOfMissCalls;i++)
{
try {
_callLog.deleteCall(i,_callLog.FOLDER_MISSED_CALLS
}catch(Exception e) {
System.out.println("BG:miss call log delete ::"+e.getMessage());
e.printStackTrace();
}
}
}
it doesn't update the deleted call in callLog ....
one more thing when i want to play audio than it doesn't play ...source code for this also below...
public void ringAudio() {
// first we need to find the supported content types
InputStream is = null;
Player player = null;
try {
String types[] = Manager.getSupportedContentTypes(null);
for (int cnt = types.length - 1; cnt >= 0; --cnt) {
if (types[cnt].equals("audio/mpeg")) {
System.out.println("In ring Method");
// this sample demonstrates playing an MP3 file that has
// been
// added as a resource to the project
try {
// retrieve the MP3 file
try {
is = this.getClass().getResourceAsStream("/Images/test_
// create an instance of the player from the
// InputStream
player = javax.microedition.media.Manager
.createPlayer(is, "audio/mpeg");
is.close();
} catch (IOException e) {
System.out.println("BG:ring Io exception thrown"
+ e.toString());
}
// player.realize();
player.prefetch();
// start the player
player.start();
} catch (Exception ex) {
System.out.println("BG:audio player error"
+ ex.toString());
ex.printStackTrace();
}
} else if (types[cnt].equals("audio/x-wav ")) {
// this is where you would play wav files
} else if (types[cnt].equals("audio/midi ")) {
// this is where you would play midi files
}
}
} catch (Exception er) {
System.out.println("BG:audio player error" + er.toString());
er.printStackTrace();
}
finally
{
player.close();
}
}
Please help me to resolve these issue....in oS5.0 and OS6.0 compatiable...
07-04-2011 03:00 PM
1. It sounds like you removed the icon entry point and left the non-icon auto start entry point. Open your BlackBerry_App_Descriptor.xml file and uncheck the box that says to not display an icon. You may also want to disable the auto-run entry here (depending on what you want to do).
2. How are you exiting from your background thread? What does startThread do? You may want to move that call within your application's constructor.
07-05-2011 05:30 AM