バックグラウンド スレッドから ListField に画像を表示する方法を探しています。最初に drawListRow でこれを試します
path = (String) imagePaths.elementAt(index);
bit = connectServerForImage(path);
g.drawBitmap(xText, y + yText, 80, 200, bit, 0, 0);
しかし、リスト全体をスムーズにスクロールすることはできず、UI でネットワークやその他のブロック操作を行わないと彼らは言います。しかし、私もこれを試します
private class imgConnection extends Thread
{
public imgConnection() {
super();
}
public void run() {
try {
for (int i = 0; i < imagePaths.size(); i++)
{
final int index = i;
String path = imagePaths.elementAt(index).toString();
bit = connectServerForImage(path);
image.addElement(bit);
}
}
catch (Exception e)
{
System.out.println(e.toString());
}
UiApplication.getUiApplication().invokeLater(new Runnable() {
public void run() {
_list.setSize(image.size());
subManager.add(_list);
screen.invalidate();
}
});
}
}
public void drawListRow(ListField list, Graphics g, int index, int y, int w) {
bit = (Bitmap) image.elementAt(index);
g.drawBitmap(xText, y + yText, 80, 200, bit, 0, 0);
}
しかし、何も起こりません。任意のアイデア、コメント。
そうです、私は2週間前にJava開発、特にBB開発を始めたばかりで、このリンクを試しています。JSONリターンからパスURLを取得した後、画像をダウンロードするためのバックグラウンドスレッドを追加したいと思います。
最初のスレッド:
_connectionthread = new Connection();
_connectionthread.start();
private class Connection extends Thread
{
public Connection()
{
super();
}
public void run() {
try {}
catch (Exception e) {}
}
}
2番目のスレッド:
_imgConnectionThread = new ImgConnection();
_imgConnectionThread.start();
private class ImgConnection extends Thread
{
public ImgConnection() {
super();
}
public void run() {
try {
}
catch (Exception e)
{
}
}
}
ListField の画像を更新するには?