如何解决android mobile中的ftp同步问题,但它在emulator中运行良好
我编写了从ftp下载XML文件的程序,它在emulator中运行良好,但当我在android(sony ericsson xperia)mobile中安装此应用程序时,它给出了应用程序包错误,因为我必须在mobile中进行任何设置,或者我们必须在我的mobile中安装任何api。有人可以帮助我吗 提前谢谢大家,如何解决android mobile中的ftp同步问题,但它在emulator中运行良好,android,android-emulator,Android,Android Emulator,我编写了从ftp下载XML文件的程序,它在emulator中运行良好,但当我在android(sony ericsson xperia)mobile中安装此应用程序时,它给出了应用程序包错误,因为我必须在mobile中进行任何设置,或者我们必须在我的mobile中安装任何api。有人可以帮助我吗 提前谢谢大家, 在Android Mobile错误消息中在Eclipse/任何您使用的工具中清理并重建您的项目,然后再次尝试传输包 Activitiy admin主菜单(应用程序com.itwine中)
在Android Mobile错误消息中在Eclipse/任何您使用的工具中清理并重建您的项目,然后再次尝试传输包 Activitiy admin主菜单(应用程序com.itwine中)没有响应,后面有两个按钮1.强制关闭2.等待 如果您在活动的主线程上进行任何联网,这很可能会发生,而这是您实际上不应该做的 在emulator上,使用开发机器的网络,您可能会得到足够快的响应以避免它;在使用移动网络的设备上,您更有可能超时。
活动管理主菜单(在应用程序com.itwine中)没有响应,后面有两个按钮1.强制关闭2.等待
Activitiy admin mainmenu(in application com.itwine)is not responding followed by two buttons 1.force close 2.wait
imgBtnSyncQues = (ImageButton) findViewById(R.id.imgBtnSyncQuestions);
imgBtnSyncQues.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
viewOrders = new Runnable(){
public void run() {
ftpQuesSync();
}
};
Thread thread = new Thread(null, viewOrders, "MagentoBackground");
thread.start();
m_ProgressDialog = ProgressDialog.show(AdminMainMenu.this,
"Please wait...", "Syncing Questions ...", true);
}
});
private void ftpQuesSync()
{
FTPClient ObjFtpCon = new FTPClient();
try
{
ObjFtpCon.connect(strIp);
if (ObjFtpCon.login(strFtpUser, strFtpPwd))
{
ObjFtpCon.enterLocalPassiveMode(); // important!
ObjFtpCon.cwd("/QIA/Questions/Hotel/");
String[] strArrQuesFiles=ObjFtpCon.listNames();
int intcnt=0;
boolean blnresult = false;
File objfile=new File(getFilesDir().getAbsolutePath()+ "/Questions");
if(!objfile.exists())objfile.mkdirs();
objfile=null;
for(intcnt=0;intcnt<strArrQuesFiles.length;intcnt++)
{
objfile=new File(getFilesDir().getAbsolutePath()+ File.separator + "/Questions/" + strArrQuesFiles[intcnt]);
objfile.createNewFile();
//ByteArrayInputStream in = new ByteArrayInputStream(data.getBytes());
FileOutputStream objFos=new FileOutputStream(objfile);
blnresult=ObjFtpCon.retrieveFile(strArrQuesFiles[intcnt] , objFos);
objFos.close();
}
ObjFtpCon.logout();
ObjFtpCon.disconnect();
if(blnresult) runOnUiThread(returnRes);return;
// boolean result = con.storeFile("/QIA/Response/test/Responses.xml", in);
}
}
catch (Exception e)
{
e.printStackTrace();
runOnUiThread(returnnone);
return;
}
runOnUiThread(returnnone);
}
imgBtnSyncQues=(ImageButton)findViewById(R.id.imgBtnSyncQuestions);
imgBtnSyncQues.setOnClickListener(新视图.OnClickListener(){
公共void onClick(视图v){
viewOrders=new Runnable(){
公开募捐{
ftpQuesSync();
}
};
线程线程=新线程(null,viewOrders,“MagentoBackground”);
thread.start();
m_ProgressDialog=ProgressDialog.show(AdminMainMenu.this,
“请稍候…”,“同步问题…”,正确);
}
});
私有void ftpQuesSync()
{
FTPClient ObjFtpCon=新的FTPClient();
尝试
{
ObjFtpCon.连接(带);
if(ObjFtpCon.login(strFtpUser,strFtpPwd))
{
ObjFtpCon.enterLocalPassiveMode();//重要!
ObjFtpCon.cwd(“/QIA/Questions/Hotel/”);
字符串[]strArrQuesFiles=ObjFtpCon.listNames();
int=0;
布尔blnresult=false;
File objfile=新文件(getFilesDir().getAbsolutePath()+“/Questions”);
如果(!objfile.exists())objfile.mkdirs();
objfile=null;
对于(intcnt=0;intcntI尝试了上述步骤,现在也出现了相同的错误,请检查错误消息,如上所示