1
需要通過我的應用程序顯示瀏覽器。 我的應用程序應該放在後臺,瀏覽器應該在前臺。以編程方式調用瀏覽器
int moduleHandle =
CodeModuleManager.getModuleHandle("net_rim_bb_browser_daemon");
if (moduleHandle > 0)
{
// Use the default browser application descriptor as the
// model descriptor.
ApplicationDescriptor[] browserDescriptors =
CodeModuleManager.getApplicationDescriptors(moduleHandle);
// Create the new application descriptor.
String[] args = {"url", url, null};
// Turn off auto restart (the original descriptor has it
// turned on) so we don't end up in a never ending loop of
// restarting the browser.
int flags = browserDescriptors[0].getFlags()^
ApplicationDescriptor.FLAG_AUTO_RESTART;
ApplicationDescriptor newDescriptor =
new ApplicationDescriptor
(
browserDescriptors[0],
"BrowserPS",
args,
null,
-1,
null,
-1,
flags
);
// Run the application.
try
{
ApplicationManager.getApplicationManager().
runApplication(newDescriptor);
}
catch (ApplicationManagerException ame)
{
System.err.println(ame.toString());
}
}
這是我的代碼它的正常工作在模擬器,而不是實際的設備上。 任何幫助。
你在'net.rim.blackberry.api.browser.Browser'和'net.rim.blackberry.api.browser.BrowserSession'類看了沒有? –