0
我已經開發了RSS閱讀器應用程序,當我執行的應用程序上BB模擬器9900,我能夠成功地顯示列表項,黑莓RSS喂不裝上設備
但是,同樣的應用程序時,我嘗試要在我的真實設備BB Curve 9380上執行,我無法加載我的列表項目。
難道有人告訴我發生了什麼錯嗎?
注:當我跑我的真實設備上的應用,我與顯示* 飼料在屏幕上
這裏我的代碼不能使用*消息:
public class RssScreen extends MainScreen implements ListFieldCallback {
public RssScreen() {
subManager = new VerticalFieldManager(Manager.VERTICAL_SCROLL
| Manager.VERTICAL_SCROLLBAR) {
protected void sublayout(int maxWidth, int maxHeight) {
int displayWidth=Display.getWidth();
int displayHeight = Display.getHeight();
super.sublayout(displayWidth, displayHeight);
setExtent(displayWidth, displayHeight);
}
};
_list = new ListField()
{
protected boolean navigationClick(int status, int time) {
return true;
}
public void paint(Graphics graphics)
{
graphics.setColor((int) mycolor);
super.paint(graphics);
}
};
mycolor = 0x00FFFFFF;
_list.invalidate();
_list.setEmptyString("* Feeds Not Available *", DrawStyle.HCENTER);
_list.setRowHeight(70);
_list.setCallback(this);
//mainManager.add(subManager);
add(subManager);
listElements.removeAllElements();
_connectionthread = new Connection();
_connectionthread.start();
}
/*RssFileReading in a Seperate Thread*/
private class Connection extends Thread {
public Connection() {
super();
}
public void run() {
Document doc;
StreamConnection conn = null;
InputStream is = null;
try {
conn = (StreamConnection) Connector .open("http://toucheradio.com/toneradio/android/toriLite/toriplaylist.xml"
+ ";deviceside=true");
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory
.newInstance();
docBuilderFactory.setIgnoringElementContentWhitespace(true);
docBuilderFactory.setCoalescing(true);
DocumentBuilder docBuilder = docBuilderFactory
.newDocumentBuilder();
docBuilder.isValidating();
is = conn.openInputStream();
doc = docBuilder.parse(is);
doc.getDocumentElement().normalize();
NodeList listImg = doc.getElementsByTagName("title");
for (int i = 0; i < listImg.getLength(); i++) {
Node textNode = listImg.item(i).getFirstChild();
listElements.addElement(textNode.getNodeValue());
}
NodeList list = doc.getElementsByTagName("image");
for (int a = 0; a < list.getLength(); a++) {
Node textNode1 = list.item(a).getFirstChild();
String imageurl = textNode1.getNodeValue();
Bitmap image = GetImage.connectServerForImage(imageurl
.trim() + ";deviceside=true");
listImage.addElement(image);
}
} catch (Exception e) {
System.out.println(e.toString());
} finally {
if (is != null) {
try {
is.close();
} catch (IOException ignored) {
}
}
if (conn != null) {
try {
conn.close();
} catch (IOException ignored) {
}
}
}
UiApplication.getUiApplication().invokeLater(new Runnable() {
public void run() {
_list.setSize(listElements.size());
subManager.add(_list);
invalidate();
}
});
} }
/*This Method is Invoked for Each title on RssFile*/
public void drawListRow(ListField list, Graphics g, int index, int y,
int width) {
String title = (String) listElements.elementAt(index);
Bitmap image = (Bitmap) listImage.elementAt(index);
try {
g.drawBitmap(xpos, ypos, w, h, image, 0, 0);
xpos = w + 20;
g.drawText(title, xpos, ypos);
} catch (Exception e) {
e.printStackTrace();
}
}
}
它在模擬器的工作給予? – Signare 2013-02-23 06:51:41
是在模擬器上完美工作 – String 2013-02-23 06:59:35
我在設備上調試錯誤信息是APN未指定 – String 2013-02-23 07:00:26