请高手帮忙看看,实在是搞不定了.谢谢拉
问题1:
我用了ECLIPSE+ECLIPSEME进行开发,下载了一个Nokia_Prototype_SDK_4_0,又安装了一个S40_SDK_3rd_Edition_Feature_Pack_2,我用device management的导入功能能够从C:\Nokia\Devices\Nokia_Prototype_SDK_4_0导入模拟器,也能直接运行.但是从C:\Nokia\Devices\S40_SDK_3rd_Edition_Feature_Pack_2就导入不了了.按refresh就根本找不到任何模拟器.另外7210也是一样.
问题2:
我想使用fileconnection来读写文件,然后写了一个拷贝程序如下:
import java.io.InputStream;
import java.io.OutputStream;
import javax.microedition.io.Connector;
import javax.microedition.io.file.FileConnection;
public class FileOperation
{
final public static void CopyFile(String srcUrl,String destUrl) throws Exception
{
FileConnection fcSrc=null;
FileConnection fcDest=null;
InputStream is=null;
OutputStream os=null;
byte[] buffer=new byte[1024];
try
{
System.out.println( "begin ");
fcSrc=(FileConnection)Connector.open(srcUrl);
if(!fcSrc.exists())
{
System.out.println( "source file not found ");
return;
}
System.out.println( "Source file found ");
fcSrc.setReadable(true);
fcDest=(FileConnection)Connector.open(destUrl);
if(!fcDest.exists())
{
fcDest.create();
fcDest.setWritable(true);
}
System.out.println( "Dest file Created ");
is=fcSrc.openInputStream();
os=fcDest.openOutputStream();
int i=0;
int j=-1;
while(-1!=(j=is.read(buffer)))
{
os.write(buffer,0,j-1);
System.out.println( "Writing "+String.valueOf(j)+ " byte ");
}
} catch (Exception e)
{
System.out.println(e.getMessage());
}
finally
{
if(is!=null) is.close();
if(os!=null) os.close();
}
}
}
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
public class storetest extends MIDlet
{
protected void startApp() throws MIDletStateChangeException
{
String srcUrl= "file://localhost/D:/demo/test/text1.txt ";
String destUrl= "file://localhost/D:/demo/test/text2.txt ";
FileOperation fo=new FileOperation();
try
{
fo.CopyFile(srcUrl,destUrl);
} catch (Exception e)
{
System.out.println( "file copy failed ");
}
}
protected void pauseApp()
{
}
protected void destroyApp(boolean arg0) throws MIDletStateChangeException
{
}
}
然后用nokia S40_SDK_3rd_Edition_Feature_Pack_2的模拟器运行,每次都在打印出begin后说access denied,use untrusted simulator domain,我已经把那个模拟器的permission改成trusted了。还是不行。
上面的问题很急,请大哥大姐帮忙。
------解决方案--------------------帮楼主顶吧
------解决方案--------------------我也不会, 纯顶
支持楼主, 搞手机开发前途无量啊...
------解决方案--------------------顶个.
------解决方案--------------------建议LZ使用Url的时候用系统变量,如System.getProperty( "fileconn.dir.memorycard ")+FileName来实现。以下是我收集的一些,希望对你有用: