我正在開發一個簡單的黑莓應用程序,用於Eclipse的Java Plug-in。在那,我想從外部文本文件讀取數據。我曾搜索過這個,並嘗試了一些技巧,like。但最後失敗了。我會形容我的應用程序...如何從黑莓eclipse中的txt文件讀取?
我的主要文件...
package com.nuc;
import net.rim.device.api.ui.UiApplication;
public class Launcher extends UiApplication
{
public static void main(String[] args)
{
Launcher theApp = new Launcher();
theApp.enterEventDispatcher();
}
public Launcher()
{
pushScreen(new MyScreen());
}
}
然後我的應用程序類就像....
package com.nuc;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.component.BasicEditField;
import net.rim.device.api.ui.component.Dialog;
import net.rim.device.api.ui.component.EditField;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.container.GridFieldManager;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.FieldChangeListener;
public final class MyScreen extends MainScreen implements FieldChangeListener
{
// declared variables...
public MyScreen()
{
//rest codes...
我想展示一些細節我的應用程序之前的文本文件開始,像最終用戶許可協議..即一些東西,卡梅斯作爲一線..
我的第一個問題是,在這裏我需要把該文本文件...我得到了很多來自網絡的指導,但沒有爲月食工作。 其次,然後如何讀取文件並將其內容放入對話框中。
所以PLZ指導我怎樣才能實現呢..示例代碼將是明顯的,因爲我是新來這個環境......
您應該這樣做:'UiApplication.getUiApplication()。invokeLater(new Runnable(){public void run(){ Dialog.inform(e。getMessage +「+」+ e.toString()); } });' – BBdev 2011-12-27 08:16:46
檢查這個http://stackoverflow.com/questions/2525210/pushmodalscreen-called-by-a-non-event-thread-thrown-on-event-thread – Rupak 2011-12-27 08:40:14
我解決了我的問題。 ..感謝ropak。感謝BBDev的幫助... – 2011-12-27 10:33:46