I found a way to do this. Here's the trick:
private int getTCVMImportance()
{
ActivityManager actvityManager = (ActivityManager)
getSystemService( ACTIVITY_SERVICE );
List<RunningAppProcessInfo> list =
actvityManager.getRunningAppProcesses();
int n = list.size();
for(int j = 0; j < n; j++)
{
RunningAppProcessInfo info = list.get(j);
if (info.processName.equals("totalcross.android"))
return info.importance;
}
return 0;
}
startActivity(intent);
if (getTCVMImportance() == 200) // if the vm was already
running...
{
AndroidUtils.debug("@Stub: tcvm already running, waiting
it die");
do
{
try {Thread.sleep(100);} catch (Exception e) {}
} while (getTCVMImportance() != 0); // wait it die
startActivity(intent); // and call it again
}
This worked for my particular case, you may first dump the importance
for your application during some time to see the results that would
work for your case.
regards
guich
http://www.totalcross.com
TotalCross - The heaven of mobile application development
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en