我使用以下代码来自
public static void StoreDataonGoogleSheet (String DonName, String Donphnum, String Donemail ) {
final MediaType FORM_DATA_TYPE
= MediaType.parse("application/x-www-form-urlencoded; charset=utf-8");
//URL derived from form URL
final String URL="https://docs.google.com/forms/d/e/1FAIpQLScLsfd71Y_p__QK1YUCYXGWrPmrbENQ8-HhBVlt9w7UoX2HJg/formResponse";
//https://docs.google.com/forms/d/e/1FAIpQLScLsfd71Y_p__QK1YUCYXGWrPmrbENQ8-HhBVlt9w7UoX2HJg/viewform
//input element ids found from the live form page
String postBody = "";
final String NAME_KEY="entry.973164943";
final String PHONE_KEY="entry.262426619";
final String EMAIL_KEY="entry.125658837";
try {
postBody = NAME_KEY+"=" + URLEncoder.encode(DonName,"UTF-8") +
"&" + PHONE_KEY + "=" + URLEncoder.encode(Donphnum,"UTF-8") +
"&" + EMAIL_KEY + "=" + URLEncoder.encode(Donemail,"UTF-8");
} catch (UnsupportedEncodingException ex) {
ex.printStackTrace();
}
try{
//Create OkHttpClient for sending request
OkHttpClient client = new OkHttpClient();
//Create the request body with the help of Media Type
RequestBody body = RequestBody.create(FORM_DATA_TYPE, postBody);
Request request = new Request.Builder()
.url(URL)
.post(body)
.build();
//Send the request
Response response = client.newCall(request).execute();
}catch (IOException exception){
// result=false;
}
//return result;
}
我从
获取了代码http://codesmith.in/post-data-google-drive-sheet-through-mobile-app/
apk的构建不会给出任何错误。但在执行时,它表示" app停止工作"。
你能否对我出错的地方有所了解?
通过将设备附加到控制台来添加跟踪
10-23 10:50:59.675 31647-31647/? D/dalvikvm: Late-enabling CheckJNI
10-23 10:50:59.775 31647-31647/ambika.amruta.pani.bctdonate100 I/System.out: Sending WAIT chunk
10-23 10:50:59.775 31647-31647/ambika.amruta.pani.bctdonate100 W/ActivityThread: Application ambika.amruta.pani.bctdonate100 is waiting for the debugger on port 8100...
10-23 10:51:00.155 31647-31653/ambika.amruta.pani.bctdonate100 I/dalvikvm: Debugger is active
10-23 10:51:00.175 31647-31647/ambika.amruta.pani.bctdonate100 I/System.out: Debugger has connected
10-23 10:51:00.175 31647-31647/ambika.amruta.pani.bctdonate100 I/System.out: waiting for debugger to settle...
10-23 10:51:00.375 31647-31647/ambika.amruta.pani.bctdonate100 I/System.out: waiting for debugger to settle...
10-23 10:51:00.575 31647-31647/ambika.amruta.pani.bctdonate100 I/System.out: waiting for debugger to settle...
10-23 10:51:00.786 31647-31647/ambika.amruta.pani.bctdonate100 I/System.out: waiting for debugger to settle...
10-23 10:51:00.986 31647-31647/ambika.amruta.pani.bctdonate100 I/System.out: waiting for debugger to settle...
10-23 10:51:01.186 31647-31647/ambika.amruta.pani.bctdonate100 I/System.out: waiting for debugger to settle...
10-23 10:51:01.386 31647-31647/ambika.amruta.pani.bctdonate100 I/System.out: waiting for debugger to settle...
10-23 10:51:01.586 31647-31647/ambika.amruta.pani.bctdonate100 I/System.out: waiting for debugger to settle...
10-23 10:51:01.787 31647-31647/ambika.amruta.pani.bctdonate100 I/System.out: waiting for debugger to settle...
10-23 10:51:01.987 31647-31647/ambika.amruta.pani.bctdonate100 I/System.out: debugger has settled (1390)
10-23 10:51:02.037 31647-31647/ambika.amruta.pani.bctdonate100 I/dalvikvm: Could not find method android.view.Window$Callback.onProvideKeyboardShortcuts, referenced from method android.support.v7.view.WindowCallbackWrapper.onProvideKeyboardShortcuts
10-23 10:51:02.037 31647-31647/ambika.amruta.pani.bctdonate100 W/dalvikvm: VFY: unable to resolve interface method 22111: Landroid/view/Window$Callback;.onProvideKeyboardShortcuts (Ljava/util/List;Landroid/view/Menu;I)V
10-23 10:51:02.037 31647-31647/ambika.amruta.pani.bctdonate100 D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
10-23 10:51:02.037 31647-31647/ambika.amruta.pani.bctdonate100 W/dalvikvm: VFY: unable to find class referenced in signature (Landroid/view/SearchEvent;)
10-23 10:51:02.037 31647-31647/ambika.amruta.pani.bctdonate100 I/dalvikvm: Could not find method android.view.Window$Callback.onSearchRequested, referenced from method android.support.v7.view.WindowCallbackWrapper.onSearchRequested
10-23 10:51:02.037 31647-31647/ambika.amruta.pani.bctdonate100 W/dalvikvm: VFY: unable to resolve interface method 22113: Landroid/view/Window$Callback;.onSearchRequested (Landroid/view/SearchEvent;)Z
10-23 10:51:02.037 31647-31647/ambika.amruta.pani.bctdonate100 D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
10-23 10:51:02.037 31647-31647/ambika.amruta.pani.bctdonate100 I/dalvikvm: Could not find method android.view.Window$Callback.onWindowStartingActionMode, referenced from method android.support.v7.view.WindowCallbackWrapper.onWindowStartingActionMode
10-23 10:51:02.037 31647-31647/ambika.amruta.pani.bctdonate100 W/dalvikvm: VFY: unable to resolve interface method 22117: Landroid/view/Window$Callback;.onWindowStartingActionMode (Landroid/view/ActionMode$Callback;I)Landroid/view/ActionMode;
10-23 10:51:02.037 31647-31647/ambika.amruta.pani.bctdonate100 D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
10-23 10:51:02.037 31647-31647/ambika.amruta.pani.bctdonate100 I/dalvikvm: Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.widget.TintTypedArray.getChangingConfigurations
10-23 10:51:02.037 31647-31647/ambika.amruta.pani.bctdonate100 W/dalvikvm: VFY: unable to resolve virtual method 667: Landroid/content/res/TypedArray;.getChangingConfigurations ()I
10-23 10:51:02.037 31647-31647/ambika.amruta.pani.bctdonate100 D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
10-23 10:51:02.037 31647-31647/ambika.amruta.pani.bctdonate100 I/dalvikvm: Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.widget.TintTypedArray.getType
10-23 10:51:02.037 31647-31647/ambika.amruta.pani.bctdonate100 W/dalvikvm: VFY: unable to resolve virtual method 689: Landroid/content/res/TypedArray;.getType (I)I
10-23 10:51:02.037 31647-31647/ambika.amruta.pani.bctdonate100 D/dalvikvm: VFY: replacing opcode 0x6e at 0x0008
10-23 10:51:02.197 31647-31647/ambika.amruta.pani.bctdonate100 I/dalvikvm: Could not find method android.content.Context.getColorStateList, referenced from method android.support.v7.content.res.AppCompatResources.getColorStateList
10-23 10:51:02.197 31647-31647/ambika.amruta.pani.bctdonate100 W/dalvikvm: VFY: unable to resolve virtual method 457: Landroid/content/Context;.getColorStateList (I)Landroid/content/res/ColorStateList;
10-23 10:51:02.197 31647-31647/ambika.amruta.pani.bctdonate100 D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
10-23 10:51:02.237 31647-31647/ambika.amruta.pani.bctdonate100 I/dalvikvm: Could not find method android.content.res.Resources.getDrawable, referenced from method android.support.v7.widget.ResourcesWrapper.getDrawable
10-23 10:51:02.237 31647-31647/ambika.amruta.pani.bctdonate100 W/dalvikvm: VFY: unable to resolve virtual method 630: Landroid/content/res/Resources;.getDrawable (ILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable;
10-23 10:51:02.237 31647-31647/ambika.amruta.pani.bctdonate100 D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
10-23 10:51:02.237 31647-31647/ambika.amruta.pani.bctdonate100 I/dalvikvm: Could not find method android.content.res.Resources.getDrawableForDensity, referenced from method android.support.v7.widget.ResourcesWrapper.getDrawableForDensity
10-23 10:51:02.237 31647-31647/ambika.amruta.pani.bctdonate100 W/dalvikvm: VFY: unable to resolve virtual method 632: Landroid/content/res/Resources;.getDrawableForDensity (IILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable;
10-23 10:51:02.237 31647-31647/ambika.amruta.pani.bctdonate100 D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
10-23 10:51:02.407 31647-31647/ambika.amruta.pani.bctdonate100 I/dalvikvm: Could not find method android.widget.Spinner.getPopupContext, referenced from method android.support.v7.widget.AppCompatSpinner.getPopupContext
10-23 10:51:02.407 31647-31647/ambika.amruta.pani.bctdonate100 W/dalvikvm: VFY: unable to resolve virtual method 22901: Landroid/widget/Spinner;.getPopupContext ()Landroid/content/Context;
10-23 10:51:02.407 31647-31647/ambika.amruta.pani.bctdonate100 D/dalvikvm: VFY: replacing opcode 0x6f at 0x000d
10-23 10:51:02.427 31647-31647/ambika.amruta.pani.bctdonate100 I/ListPopupWindow: Could not find method setEpicenterBounds(Rect) on PopupWindow. Oh well.
10-23 10:51:02.507 31647-31647/ambika.amruta.pani.bctdonate100 E/dalvikvm: Could not find class 'android.graphics.drawable.RippleDrawable', referenced from method android.support.v7.widget.AppCompatImageHelper.hasOverlappingRendering
10-23 10:51:02.507 31647-31647/ambika.amruta.pani.bctdonate100 W/dalvikvm: VFY: unable to resolve instanceof 194 (Landroid/graphics/drawable/RippleDrawable;) in Landroid/support/v7/widget/AppCompatImageHelper;
10-23 10:51:02.507 31647-31647/ambika.amruta.pani.bctdonate100 D/dalvikvm: VFY: replacing opcode 0x20 at 0x000c
10-23 10:51:02.617 31647-31647/ambika.amruta.pani.bctdonate100 E/dalvikvm: Could not find class 'android.widget.ThemedSpinnerAdapter', referenced from method android.support.v7.widget.AppCompatSpinner$DropDownAdapter.<init>
10-23 10:51:02.617 31647-31647/ambika.amruta.pani.bctdonate100 W/dalvikvm: VFY: unable to resolve instanceof 2707 (Landroid/widget/ThemedSpinnerAdapter;) in Landroid/support/v7/widget/AppCompatSpinner$DropDownAdapter;
10-23 10:51:02.617 31647-31647/ambika.amruta.pani.bctdonate100 D/dalvikvm: VFY: replacing opcode 0x20 at 0x0016
10-23 10:51:02.627 31647-31647/ambika.amruta.pani.bctdonate100 I/dalvikvm: Could not find method android.content.pm.PackageManager.getPackageInstaller, referenced from method com.google.android.gms.common.zzo.zzy
10-23 10:51:02.627 31647-31647/ambika.amruta.pani.bctdonate100 W/dalvikvm: VFY: unable to resolve virtual method 587: Landroid/content/pm/PackageManager;.getPackageInstaller ()Landroid/content/pm/PackageInstaller;
10-23 10:51:02.627 31647-31647/ambika.amruta.pani.bctdonate100 D/dalvikvm: VFY: replacing opcode 0x6e at 0x0012
10-23 10:51:02.948 31647-31647/ambika.amruta.pani.bctdonate100 D/GC: <tid=31647> OES20 ===> GC Version : GC Ver rls_pxa988_KK44_GC13.25
10-23 10:51:02.978 31647-31647/ambika.amruta.pani.bctdonate100 D/OpenGLRenderer: Enabling debug mode 0
10-23 10:51:25.970 31647-31647/ambika.amruta.pani.bctdonate100 W/dalvikvm: method Landroid/support/v7/widget/ListViewCompat;.lookForSelectablePosition incorrectly overrides package-private method with same name in Landroid/widget/ListView;
10-23 10:51:25.980 31647-31647/ambika.amruta.pani.bctdonate100 I/dalvikvm: Could not find method android.support.v7.widget.DropDownListView.drawableHotspotChanged, referenced from method android.support.v7.widget.DropDownListView.setPressedItem
10-23 10:51:25.980 31647-31647/ambika.amruta.pani.bctdonate100 W/dalvikvm: VFY: unable to resolve virtual method 18376: Landroid/support/v7/widget/DropDownListView;.drawableHotspotChanged (FF)V
10-23 10:51:25.980 31647-31647/ambika.amruta.pani.bctdonate100 D/dalvikvm: VFY: replacing opcode 0x6e at 0x000a
10-23 10:51:25.980 31647-31647/ambika.amruta.pani.bctdonate100 I/dalvikvm: Could not find method android.view.View.drawableHotspotChanged, referenced from method android.support.v7.widget.DropDownListView.setPressedItem
10-23 10:51:25.980 31647-31647/ambika.amruta.pani.bctdonate100 W/dalvikvm: VFY: unable to resolve virtual method 21696: Landroid/view/View;.drawableHotspotChanged (FF)V
10-23 10:51:25.980 31647-31647/ambika.amruta.pani.bctdonate100 D/dalvikvm: VFY: replacing opcode 0x6e at 0x004a
10-23 10:51:26.020 31647-31647/ambika.amruta.pani.bctdonate100 D/AbsListView: Get MotionRecognitionManager
10-23 10:51:27.632 31647-31647/ambika.amruta.pani.bctdonate100 D/AbsListView: onDetachedFromWindow
10-23 10:51:27.842 31647-31647/ambika.amruta.pani.bctdonate100 E/ViewRootImpl: sendUserActionEvent() mView == null
10-23 10:51:40.855 31647-31647/ambika.amruta.pani.bctdonate100 D/AndroidRuntime: Shutting down VM
10-23 10:51:40.855 31647-31647/ambika.amruta.pani.bctdonate100 W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x41a6ac08)
10-23 10:51:40.865 31647-31647/ambika.amruta.pani.bctdonate100 E/AndroidRuntime: FATAL EXCEPTION: main
Process: ambika.amruta.pani.bctdonate100, PID: 31647
java.lang.NullPointerException
at libcore.net.UriCodec.encode(UriCodec.java:132)
at java.net.URLEncoder.encode(URLEncoder.java:57)
at ambika.amruta.pani.bctdonate100.RecordDonation.StoreDataonGoogleSheet(RecordDonation.java:306)
at ambika.amruta.pani.bctdonate100.RecordDonation.sendData(RecordDonation.java:388)
at ambika.amruta.pani.bctdonate100.RecordDonation$2.onClick(RecordDonation.java:217)
at android.view.View.performClick(View.java:4633)
at android.view.View$PerformClick.run(View.java:19270)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5602)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)
10-23 11:51:01.979 7755-7755/? D/dalvikvm: Late-enabling CheckJNI
10-23 11:51:02.089 7755-7755/ambika.amruta.pani.bctdonate100 I/System.out: Sending WAIT chunk
10-23 11:51:02.089 7755-7755/ambika.amruta.pani.bctdonate100 W/ActivityThread: Application ambika.amruta.pani.bctdonate100 is waiting for the debugger on port 8100...
10-23 11:51:02.219 7755-7761/ambika.amruta.pani.bctdonate100 I/dalvikvm: Debugger is active
10-23 11:51:02.289 7755-7755/ambika.amruta.pani.bctdonate100 I/System.out: Debugger has connected
10-23 11:51:02.289 7755-7755/ambika.amruta.pani.bctdonate100 I/System.out: waiting for debugger to settle...
10-23 11:51:02.490 7755-7755/ambika.amruta.pani.bctdonate100 I/System.out: waiting for debugger to settle...
10-23 11:51:02.690 7755-7755/ambika.amruta.pani.bctdonate100 I/System.out: waiting for debugger to settle...
10-23 11:51:02.890 7755-7755/ambika.amruta.pani.bctdonate100 I/System.out: waiting for debugger to settle...
10-23 11:51:03.100 7755-7755/ambika.amruta.pani.bctdonate100 I/System.out: waiting for debugger to settle...
10-23 11:51:03.300 7755-7755/ambika.amruta.pani.bctdonate100 I/System.out: waiting for debugger to settle...
10-23 11:51:03.501 7755-7755/ambika.amruta.pani.bctdonate100 I/System.out: waiting for debugger to settle...
10-23 11:51:03.691 7755-7755/ambika.amruta.pani.bctdonate100 I/System.out: waiting for debugger to settle...
10-23 11:51:03.891 7755-7755/ambika.amruta.pani.bctdonate100 I/System.out: debugger has settled (1464)
10-23 11:51:03.941 7755-7755/ambika.amruta.pani.bctdonate100 I/dalvikvm: Could not find method android.view.Window$Callback.onProvideKeyboardShortcuts, referenced from method android.support.v7.view.WindowCallbackWrapper.onProvideKeyboardShortcuts
10-23 11:51:03.941 7755-7755/ambika.amruta.pani.bctdonate100 W/dalvikvm: VFY: unable to resolve interface method 22117: Landroid/view/Window$Callback;.onProvideKeyboardShortcuts (Ljava/util/List;Landroid/view/Menu;I)V
10-23 11:51:03.941 7755-7755/ambika.amruta.pani.bctdonate100 D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
10-23 11:51:03.951 7755-7755/ambika.amruta.pani.bctdonate100 W/dalvikvm: VFY: unable to find class referenced in signature (Landroid/view/SearchEvent;)
10-23 11:51:03.951 7755-7755/ambika.amruta.pani.bctdonate100 I/dalvikvm: Could not find method android.view.Window$Callback.onSearchRequested, referenced from method android.support.v7.view.WindowCallbackWrapper.onSearchRequested
10-23 11:51:03.951 7755-7755/ambika.amruta.pani.bctdonate100 W/dalvikvm: VFY: unable to resolve interface method 22119: Landroid/view/Window$Callback;.onSearchRequested (Landroid/view/SearchEvent;)Z
10-23 11:51:03.951 7755-7755/ambika.amruta.pani.bctdonate100 D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
10-23 11:51:03.951 7755-7755/ambika.amruta.pani.bctdonate100 I/dalvikvm: Could not find method android.view.Window$Callback.onWindowStartingActionMode, referenced from method android.support.v7.view.WindowCallbackWrapper.onWindowStartingActionMode
10-23 11:51:03.951 7755-7755/ambika.amruta.pani.bctdonate100 W/dalvikvm: VFY: unable to resolve interface method 22123: Landroid/view/Window$Callback;.onWindowStartingActionMode (Landroid/view/ActionMode$Callback;I)Landroid/view/ActionMode;
10-23 11:51:03.951 7755-7755/ambika.amruta.pani.bctdonate100 D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
10-23 11:51:03.951 7755-7755/ambika.amruta.pani.bctdonate100 I/dalvikvm: Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.widget.TintTypedArray.getChangingConfigurations
10-23 11:51:03.951 7755-7755/ambika.amruta.pani.bctdonate100 W/dalvikvm: VFY: unable to resolve virtual method 673: Landroid/content/res/TypedArray;.getChangingConfigurations ()I
10-23 11:51:03.951 7755-7755/ambika.amruta.pani.bctdonate100 D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
10-23 11:51:03.951 7755-7755/ambika.amruta.pani.bctdonate100 I/dalvikvm: Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.widget.TintTypedArray.getType
10-23 11:51:03.951 7755-7755/ambika.amruta.pani.bctdonate100 W/dalvikvm: VFY: unable to resolve virtual method 695: Landroid/content/res/TypedArray;.getType (I)I
10-23 11:51:03.951 7755-7755/ambika.amruta.pani.bctdonate100 D/dalvikvm: VFY: replacing opcode 0x6e at 0x0008
10-23 11:51:04.091 7755-7755/ambika.amruta.pani.bctdonate100 I/dalvikvm: Could not find method android.content.Context.getColorStateList, referenced from method android.support.v7.content.res.AppCompatResources.getColorStateList
10-23 11:51:04.091 7755-7755/ambika.amruta.pani.bctdonate100 W/dalvikvm: VFY: unable to resolve virtual method 463: Landroid/content/Context;.getColorStateList (I)Landroid/content/res/ColorStateList;
10-23 11:51:04.091 7755-7755/ambika.amruta.pani.bctdonate100 D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
10-23 11:51:04.131 7755-7755/ambika.amruta.pani.bctdonate100 I/dalvikvm: Could not find method android.content.res.Resources.getDrawable, referenced from method android.support.v7.widget.ResourcesWrapper.getDrawable
10-23 11:51:04.131 7755-7755/ambika.amruta.pani.bctdonate100 W/dalvikvm: VFY: unable to resolve virtual method 636: Landroid/content/res/Resources;.getDrawable (ILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable;
10-23 11:51:04.131 7755-7755/ambika.amruta.pani.bctdonate100 D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
10-23 11:51:04.131 7755-7755/ambika.amruta.pani.bctdonate100 I/dalvikvm: Could not find method android.content.res.Resources.getDrawableForDensity, referenced from method android.support.v7.widget.ResourcesWrapper.getDrawableForDensity
10-23 11:51:04.131 7755-7755/ambika.amruta.pani.bctdonate100 W/dalvikvm: VFY: unable to resolve virtual method 638: Landroid/content/res/Resources;.getDrawableForDensity (IILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable;
10-23 11:51:04.131 7755-7755/ambika.amruta.pani.bctdonate100 D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
10-23 11:51:04.301 7755-7755/ambika.amruta.pani.bctdonate100 I/dalvikvm: Could not find method android.widget.Spinner.getPopupContext, referenced from method android.support.v7.widget.AppCompatSpinner.getPopupContext
10-23 11:51:04.301 7755-7755/ambika.amruta.pani.bctdonate100 W/dalvikvm: VFY: unable to resolve virtual method 22907: Landroid/widget/Spinner;.getPopupContext ()Landroid/content/Context;
10-23 11:51:04.301 7755-7755/ambika.amruta.pani.bctdonate100 D/dalvikvm: VFY: replacing opcode 0x6f at 0x000d
10-23 11:51:04.311 7755-7755/ambika.amruta.pani.bctdonate100 I/ListPopupWindow: Could not find method setEpicenterBounds(Rect) on PopupWindow. Oh well.
10-23 11:51:04.391 7755-7755/ambika.amruta.pani.bctdonate100 E/dalvikvm: Could not find class 'android.graphics.drawable.RippleDrawable', referenced from method android.support.v7.widget.AppCompatImageHelper.hasOverlappingRendering
10-23 11:51:04.391 7755-7755/ambika.amruta.pani.bctdonate100 W/dalvikvm: VFY: unable to resolve instanceof 195 (Landroid/graphics/drawable/RippleDrawable;) in Landroid/support/v7/widget/AppCompatImageHelper;
10-23 11:51:04.391 7755-7755/ambika.amruta.pani.bctdonate100 D/dalvikvm: VFY: replacing opcode 0x20 at 0x000c
10-23 11:51:04.501 7755-7755/ambika.amruta.pani.bctdonate100 E/dalvikvm: Could not find class 'android.widget.ThemedSpinnerAdapter', referenced from method android.support.v7.widget.AppCompatSpinner$DropDownAdapter.<init>
10-23 11:51:04.501 7755-7755/ambika.amruta.pani.bctdonate100 W/dalvikvm: VFY: unable to resolve instanceof 2708 (Landroid/widget/ThemedSpinnerAdapter;) in Landroid/support/v7/widget/AppCompatSpinner$DropDownAdapter;
10-23 11:51:04.501 7755-7755/ambika.amruta.pani.bctdonate100 D/dalvikvm: VFY: replacing opcode 0x20 at 0x0016
10-23 11:51:04.511 7755-7755/ambika.amruta.pani.bctdonate100 I/dalvikvm: Could not find method android.content.pm.PackageManager.getPackageInstaller, referenced from method com.google.android.gms.common.zzo.zzy
10-23 11:51:04.511 7755-7755/ambika.amruta.pani.bctdonate100 W/dalvikvm: VFY: unable to resolve virtual method 593: Landroid/content/pm/PackageManager;.getPackageInstaller ()Landroid/content/pm/PackageInstaller;
10-23 11:51:04.511 7755-7755/ambika.amruta.pani.bctdonate100 D/dalvikvm: VFY: replacing opcode 0x6e at 0x0012
10-23 11:51:04.822 7755-7755/ambika.amruta.pani.bctdonate100 D/GC: <tid=7755> OES20 ===> GC Version : GC Ver rls_pxa988_KK44_GC13.25
10-23 11:51:04.852 7755-7755/ambika.amruta.pani.bctdonate100 D/OpenGLRenderer: Enabling debug mode 0
10-23 11:51:08.816 7755-7755/ambika.amruta.pani.bctdonate100 W/IInputConnectionWrapper: showStatusIcon on inactive InputConnection
10-23 11:51:33.610 7755-7755/ambika.amruta.pani.bctdonate100 W/dalvikvm: method Landroid/support/v7/widget/ListViewCompat;.lookForSelectablePosition incorrectly overrides package-private method with same name in Landroid/widget/ListView;
10-23 11:51:33.610 7755-7755/ambika.amruta.pani.bctdonate100 I/dalvikvm: Could not find method android.support.v7.widget.DropDownListView.drawableHotspotChanged, referenced from method android.support.v7.widget.DropDownListView.setPressedItem
10-23 11:51:33.610 7755-7755/ambika.amruta.pani.bctdonate100 W/dalvikvm: VFY: unable to resolve virtual method 18382: Landroid/support/v7/widget/DropDownListView;.drawableHotspotChanged (FF)V
10-23 11:51:33.610 7755-7755/ambika.amruta.pani.bctdonate100 D/dalvikvm: VFY: replacing opcode 0x6e at 0x000a
10-23 11:51:33.610 7755-7755/ambika.amruta.pani.bctdonate100 I/dalvikvm: Could not find method android.view.View.drawableHotspotChanged, referenced from method android.support.v7.widget.DropDownListView.setPressedItem
10-23 11:51:33.610 7755-7755/ambika.amruta.pani.bctdonate100 W/dalvikvm: VFY: unable to resolve virtual method 21702: Landroid/view/View;.drawableHotspotChanged (FF)V
10-23 11:51:33.610 7755-7755/ambika.amruta.pani.bctdonate100 D/dalvikvm: VFY: replacing opcode 0x6e at 0x004a
10-23 11:51:33.650 7755-7755/ambika.amruta.pani.bctdonate100 D/AbsListView: Get MotionRecognitionManager
10-23 11:51:35.111 7755-7755/ambika.amruta.pani.bctdonate100 D/AbsListView: onDetachedFromWindow
10-23 11:51:35.322 7755-7755/ambika.amruta.pani.bctdonate100 E/ViewRootImpl: sendUserActionEvent() mView == null
10-23 11:51:45.341 7755-7755/ambika.amruta.pani.bctdonate100 D/dalvikvm: GC_FOR_ALLOC freed 849K, 23% free 6682K/8588K, paused 20ms, total 20ms
10-23 11:51:45.341 7755-7755/ambika.amruta.pani.bctdonate100 I/dalvikvm-heap: Grow heap (frag case) to 11.460MB for 4096016-byte allocation
10-23 11:51:45.361 7755-7764/ambika.amruta.pani.bctdonate100 D/dalvikvm: GC_FOR_ALLOC freed 0K, 16% free 10682K/12592K, paused 21ms, total 21ms
10-23 11:51:45.491 7755-7755/ambika.amruta.pani.bctdonate100 D/dalvikvm: GC_FOR_ALLOC freed 110K, 16% free 10613K/12592K, paused 17ms, total 18ms
10-23 11:51:45.501 7755-7755/ambika.amruta.pani.bctdonate100 I/dalvikvm-heap: Grow heap (frag case) to 15.299MB for 4096016-byte allocation
10-23 11:51:45.522 7755-7755/ambika.amruta.pani.bctdonate100 D/dalvikvm: GC_FOR_ALLOC freed <1K, 12% free 14613K/16596K, paused 15ms, total 15ms
10-23 11:51:46.502 7755-7755/ambika.amruta.pani.bctdonate100 I/Process: Sending signal. PID: 7755 SIG: 9
This part is red in color:
10-23 11:51:35.322 7755-7755/ambika.amruta.pani.bctdonate100 E/ViewRootImpl: sendUserActionEvent() mView == null
答案 0 :(得分:1)
您在下面的代码中收到错误检查三个参数已正确给出DonName,Donphnum,Donemail
postBody = NAME_KEY+"=" + URLEncoder.encode(DonName,"UTF-8") +
"&" + PHONE_KEY + "=" + URLEncoder.encode(Donphnum,"UTF-8") +
"&" + EMAIL_KEY + "=" + URLEncoder.encode(Donemail,"UTF-8");
并将所有代码放在asynctask中,如下所示
//AsyncTask to send data as a http POST request
private class PostDataTask extends AsyncTask<String, Void, Boolean> {
@Override
protected Boolean doInBackground(String... contactData) {
Boolean result = true;
String url = contactData[0];
String email = contactData[1];
String subject = contactData[2];
String message = contactData[3];
String postBody="";
try {
//all values must be URL encoded to make sure that special characters like & | ",etc.
//do not cause problems
postBody = EMAIL_KEY+"=" + URLEncoder.encode(email,"UTF-8") +
"&" + SUBJECT_KEY + "=" + URLEncoder.encode(subject,"UTF-8") +
"&" + MESSAGE_KEY + "=" + URLEncoder.encode(message,"UTF-8");
} catch (UnsupportedEncodingException ex) {
result=false;
}
/*
//If you want to use HttpRequest class from http://stackoverflow.com/a/2253280/1261816
try {
HttpRequest httpRequest = new HttpRequest();
httpRequest.sendPost(url, postBody);
}catch (Exception exception){
result = false;
}
*/
try{
//Create OkHttpClient for sending request
OkHttpClient client = new OkHttpClient();
//Create the request body with the help of Media Type
RequestBody body = RequestBody.create(FORM_DATA_TYPE, postBody);
Request request = new Request.Builder()
.url(url)
.post(body)
.build();
//Send the request
Response response = client.newCall(request).execute();
}catch (IOException exception){
result=false;
}
return result;
}
@Override
protected void onPostExecute(Boolean result){
//Print Success or failure message accordingly
Toast.makeText(context,result?"Message successfully sent!":"There was some error in sending message. Please try again after some time.",Toast.LENGTH_LONG).show();
}
}
}
当您点击按钮
时PostDataTask postDataTask = new PostDataTask();
//execute asynctask
postDataTask.execute(URL,emailEditText.getText().toString(),
subjectEditText.getText().toString(),
messageEditText.getText().toString());