0

I am trying to run the WiFi Direct Demo example from the Google API 14 and when I try to share any file from one phone to another via the demo app, I am only able to share photos(jpg) files...anything else, the app force closes. I am using a Motorola RAZR HD and a Samsung Galaxy S3 for testing. Any assistance please? Thanks!

The following error appears in LogCat:

04-28 21:25:19.632: E/AndroidRuntime(23515): FATAL EXCEPTION: main
04-28 21:25:19.632: E/AndroidRuntime(23515): untimeException: Failure delivering result ResultInfo{who=android:fragment:1, request=20, result=0, data=null}java.lang.R to activity {com.classroom_app/com.classroom_app.WiFiDirectActivity}: java.lang.NullPointerException
04-28 21:25:19.632: E/AndroidRuntime(23515):    at android.app.ActivityThread.deliverResults(ActivityThread.java:3304)
04-28 21:25:19.632: E/AndroidRuntime(23515):    at android.app.ActivityThread.handleSendResult(ActivityThread.java:3347)
04-28 21:25:19.632: E/AndroidRuntime(23515):    at android.app.ActivityThread.access$1100(ActivityThread.java:139)
04-28 21:25:19.632: E/AndroidRuntime(23515):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1296)
04-28 21:25:19.632: E/AndroidRuntime(23515):    at android.os.Handler.dispatchMessage(Handler.java:99)
04-28 21:25:19.632: E/AndroidRuntime(23515):    at android.os.Looper.loop(Looper.java:137)
04-28 21:25:19.632: E/AndroidRuntime(23515):    at android.app.ActivityThread.main(ActivityThread.java:5070)
04-28 21:25:19.632: E/AndroidRuntime(23515):    at java.lang.reflect.Method.invokeNative(Native Method)
04-28 21:25:19.632: E/AndroidRuntime(23515):    at java.lang.reflect.Method.invoke(Method.java:511)
04-28 21:25:19.632: E/AndroidRuntime(23515):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
04-28 21:25:19.632: E/AndroidRuntime(23515):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:558)
04-28 21:25:19.632: E/AndroidRuntime(23515):    at dalvik.system.NativeStart.main(Native Method)
04-28 21:25:19.632: E/AndroidRuntime(23515): Caused by: java.lang.NullPointerException
04-28 21:25:19.632: E/AndroidRuntime(23515):    at com.classroom_app.DeviceDetailFragment.onActivityResult(DeviceDetailFragment.java:109)
04-28 21:25:19.632: E/AndroidRuntime(23515):    at android.app.Activity.dispatchActivityResult(Activity.java:5261)
04-28 21:25:19.632: E/AndroidRuntime(23515):    at android.app.ActivityThread.deliverResults(ActivityThread.java:3300)
04-28 21:25:19.632: E/AndroidRuntime(23515):    ... 11 more
laalto
  • 150,114
  • 66
  • 286
  • 303
lucky88shp
  • 61
  • 1
  • 2
  • 11

1 Answers1

0

In the onclick of the 'LaunchGallery' button change the type of file to be selected form image/* to / this shall enable you to select any file .. also on the 'Fileserverasynctask' remove the intent which opens the file for view as it expects an image and hence the program will crash if any other file is received, by doing this you shall be able to send any file from client to GO . it will be stored in the folder specified in the Fileserverasynctask

user2458228
  • 221
  • 1
  • 5