LWUIT未捕获的异常:java.lang.OutOfMemoryError(堆栈跟踪不完整)(LW

2019-10-17 06:33发布

我开发使用LWUIT标签,我想显示我的LWUIT标签屏幕上的RSS频道的标题和图像的RSS应用程序,但是当我跑我的应用程序,我能够显示三甲之列的项目成功地(含图片标题),在那之后我面临java.lang.OutOfMemoryError(堆栈跟踪不完全)Eventhough不存在列表中的项目?任何一个可以帮助......感谢...

在这里我的代码:

public class Process {
     protected XMLMidlet midlet;

     Form form1;
     Image image;
     Tabs tabs;
     private List myNewsList;
    private Vector topnews;
    private Vector topstory;
    private Command cmdExit;
    private Command m_backCommand;
      private List newsList;
        private Form form2;
    Process(XMLMidlet midlet) throws IOException {
           this.midlet=midlet;
           topnews = new Vector();
        topstory = new Vector();
       tabs = new Tabs();
        form1 = new Form();
        form2=new Form();
           try {
            newsList = new List(topnews);
            newsList.setScrollVisible(false);
            newsList.setRenderer(new NewsListCellRenderer());   
         m_backCommand = new Command("Back");
        cmdExit = new Command("EXIT");
           tabs.addTab("Topstory", newsList); 
            form1.addComponent(BorderLayout.CENTER, tabs);                           
}
catch(Exception e){
    e.printStackTrace();
}           }

   public void process() {
       try{
   String url = "http://www.teluguone.com/news/tonefeeds/news/news-1.rss";

       form1.show();
       ParseThread myThread = new ParseThread(this);
       myThread.getXMLFeed(url);

        } catch (Exception e) {

        }

    }
   public void addNews(News newsItem) {

try{
            topnews.addElement(newsItem);
            newsList.addActionListener(new ActionListener() {

                public void actionPerformed(ActionEvent ae) {

                    List source = (List) ae.getSource();
                    News selectedNewsItem = (News) source.getSelectedItem();
                    if (selectedNewsItem != null) {
                        displayCompleteNewsScreen(selectedNewsItem);

                    }

                }


            });
}
catch(OutOfMemoryError r){

}
        form1.show();


    }


    private void displayCompleteNewsScreen(News detailNews) {

       try{ 
        form2.removeAll();
        form2.repaint();
        form2.addCommand(m_backCommand);
        form2.addCommandListener(new ActionListener() {

            public void actionPerformed(ActionEvent ae) {
                form1.show();
            }
        });

        HTMLComponent com=new HTMLComponent();
        com.setPreferredSize(new Dimension(300,300));
com.setShowImages(false);

       com.setBodyText(detailNews.getDescription());
       form2.addComponent(com);
        //form2.addComponent(big);
        }
       catch(OutOfMemoryError e){

       }
        form2.show();

    }



}

Answer 1:

有多大的图像? 我们在谈论什么手机约在这里?

我打赌你得到的图像没有被缩小显示之前。 我相信有在LWUIT的方法来缩小图像的大小。 记住图像添加到您的表格后处置创建临时图像。



文章来源: LWUIT Uncaught exception: java.lang.OutOfMemoryError(stack trace incomplete)