How to fix ftp sync problem in android mobile but it is working fine in emulator
I written program for XML file downloading from ftp it's working fine in emulator but when i installed this application in android(sony ericsson xper开发者_开发知识库ia) mobile it's giving application package error for that i have to do any settings in mobile or we have to install any api in my mobile can anyone please help me.
Thank You in Advance,
In Android Mobile error message
Clean and Rebuild your project in Eclipse / whatever tool you use, and then try transferring the package over again.
Activitiy admin mainmenu(in application com.itwine)is not responding followed by two buttons 1.force close 2.wait
This is likely to happen if you do any networking on the activity's main thread, something you really aren't supposed to do.
On the emulator, using your development machines's network, you might get a response quickly enough to avoid it; on a device using a mobile network you are much more likely to timeout.
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);
}
精彩评论