• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Ftp doesnt work on phone but works on emulator

 
David Lakatos
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i wrote this ftp upload method...it works great on the emulator but doesnt on my phone...

can someone tell me why not?









i wrote this ftp upload method...it works great on the emulator but doesnt on my telephone...my phone feeze when it runs. I cant have log from the phone sorry that's why i ask to try it please!

can someone tell me why not?

please help i'm trying to do this ftp almost 3 days:S
 
Paul Clapham
Sheriff
Posts: 21588
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you say "doesn't work", what does that mean? Read our FAQ entry ItDoesntWorkIsUseless, which should tell you what kind of information would be useful to somebody who wanted to help you out.

(And in particular, does this line of code run:



and what does it output?)
 
David Lakatos
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:When you say "doesn't work", what does that mean? Read our FAQ entry ItDoesntWorkIsUseless, which should tell you what kind of information would be useful to somebody who wanted to help you out.

(And in particular, does this line of code run:



and what does it output?)


update my post...please try it on phonecause i cant have log from phone
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Lakatos wrote:please try it on phonecause i cant have log from phone

Why not? That's what "adb logcat" is for if you connect your phone via USB to your computer.

But more importantly, I don't think you can construct a FileInputStream that way in Android. You need to obtain it from other API methods. See "Internal Storage" and "External Storage" in http://developer.android.com/guide/topics/data/data-storage.html
 
David Lakatos
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:Why not? That's what "adb logcat" is for if you connect your phone via USB to your computer.

because i cant connect the phone to eclipse.
Thats why i ask for test it to me and give me a log :) please
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your code is incomplete - it would take anyone of us a long time to make an app out of it to install on the phone. Nobody is going to do that. But I already told you what to look for.

Also, I'm certain that Eclipse can connect to your phone. And even if it can't for some reason, the command line version of adb can, so you can proceed on your own.
 
David Lakatos
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:Your code is incomplete - it would take anyone of us a long time to make an app out of it to install on the phone. Nobody is going to do that. But I already told you what to look for.

Also, I'm certain that Eclipse can connect to your phone. And even if it can't for some reason, the command line version of adb can, so you can proceed on your own.


got the error log: android.os.NetworkOnMainThreadException

any idea?
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On Android, any network activity must be done in a background thread, not the main event handling thread. The reason being that network activity generally takes longer than you can afford to block the main thread. Search for "AsyncTask" for a solution.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic