我怎样才能添加所有获得的产品?

时间:2016-02-13 17:36:10

标签: java android

这是我的logcat

02-14 01:53:19.385: I/ActivityManager(286): START u0 {cmp=com.example.midterm2ndsem/.Order} from pid 1901
02-14 01:53:19.395: W/WindowManager(286): Failure taking screenshot for (343x201) to layer 21010
02-14 01:53:19.415: I/ActivityManager(286): START u0 {act=com.example.midterm2ndsem} from pid 1901
02-14 01:53:19.435: W/System.err(1901): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.example.midterm2ndsem }
02-14 01:53:19.435: W/System.err(1901):     at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1622)
02-14 01:53:19.435: W/System.err(1901):     at android.app.Instrumentation.execStartActivity(Instrumentation.java:1417)
02-14 01:53:19.445: W/System.err(1901):     at android.app.Activity.startActivityForResult(Activity.java:3370)
02-14 01:53:19.445: W/System.err(1901):     at android.app.Activity.startActivityForResult(Activity.java:3331)
02-14 01:53:19.445: W/System.err(1901):     at android.app.Activity.startActivity(Activity.java:3566)
02-14 01:53:19.445: W/System.err(1901):     at android.app.Activity.startActivity(Activity.java:3534)
02-14 01:53:19.445: W/System.err(1901):     at com.example.midterm2ndsem.Home1$1.onClick(Home1.java:59)
02-14 01:53:19.455: W/System.err(1901):     at android.view.View.performClick(View.java:4202)
02-14 01:53:19.455: W/System.err(1901):     at android.view.View$PerformClick.run(View.java:17340)
02-14 01:53:19.465: W/System.err(1901):     at android.os.Handler.handleCallback(Handler.java:725)
02-14 01:53:19.465: W/System.err(1901):     at android.os.Handler.dispatchMessage(Handler.java:92)
02-14 01:53:19.465: W/System.err(1901):     at android.os.Looper.loop(Looper.java:137)
02-14 01:53:19.475: W/System.err(1901):     at android.app.ActivityThread.main(ActivityThread.java:5039)
02-14 01:53:19.475: W/System.err(1901):     at java.lang.reflect.Method.invokeNative(Native Method)
02-14 01:53:19.475: W/System.err(1901):     at java.lang.reflect.Method.invoke(Method.java:511)
02-14 01:53:19.485: W/System.err(1901):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
02-14 01:53:19.485: W/System.err(1901):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
02-14 01:53:19.485: W/System.err(1901):     at dalvik.system.NativeStart.main(Native Method)
02-14 01:53:20.016: E/SurfaceFlinger(36): ro.sf.lcd_density must be defined as a build property
02-14 01:53:21.735: I/Choreographer(1901): Skipped 280 frames!  The application may be doing too much work on its main thread.
02-14 01:53:23.885: D/dalvikvm(1901): GC_CONCURRENT freed 191K, 10% free 2839K/3144K, paused 12ms+158ms, total 547ms
02-14 01:53:24.055: I/Choreographer(1901): Skipped 94 frames!  The application may be doing too much work on its main thread.
02-14 01:53:25.725: D/dalvikvm(286): GC_CONCURRENT freed 750K, 16% free 6183K/7276K, paused 14ms+52ms, total 1141ms
02-14 01:53:29.565: D/InputEventConsistencyVerifier(1901): KeyEvent: ACTION_UP but key was not down.
02-14 01:53:29.565: D/InputEventConsistencyVerifier(1901):   in android.widget.EditText{40d55bd8 VFED..CL .F....I. 487,103-537,143 #7f080001 app:id/qtytide}
02-14 01:53:29.565: D/InputEventConsistencyVerifier(1901):   0: sent at 5427887000000, KeyEvent { action=ACTION_UP, keyCode=KEYCODE_TAB, scanCode=15, metaState=0, flags=0x8, repeatCount=0, eventTime=5427887, downTime=5427758, deviceId=0, source=0x101 }
02-14 01:53:31.465: D/dalvikvm(487): GC_CONCURRENT freed 423K, 71% free 4009K/13652K, paused 7ms+35ms, total 522msandroid.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
02-14 01:53:58.225: E/ActivityThread(594):  at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
02-14 01:53:58.225: E/ActivityThread(594):  at android.app.ContextImpl.bindService(ContextImpl.java:1418)
02-14 01:53:58.225: E/ActivityThread(594):  at android.app.ContextImpl.bindService(ContextImpl.java:1407)
02-14 01:53:58.225: E/ActivityThread(594):  at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
02-14 01:53:58.225: E/ActivityThread(594):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
02-14 01:53:58.225: E/ActivityThread(594):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
02-14 01:53:58.225: E/ActivityThread(594):  at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:191)
02-14 01:53:58.225: E/ActivityThread(594):  at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1850)
02-14 01:53:58.225: E/ActivityThread(594):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
02-14 01:53:58.225: E/ActivityThread(594):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
02-14 01:53:58.225: E/ActivityThread(594):  at android.os.AsyncTask$2.call(AsyncTask.java:287)
02-14 01:53:58.225: E/ActivityThread(594):  at java.util.concurrent.FutureTask.run(FutureTask.java:234)
02-14 01:53:58.225: E/ActivityThread(594):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
02-14 01:53:58.225: E/ActivityThread(594):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
02-14 01:53:58.225: E/ActivityThread(594):  at java.lang.Thread.run(Thread.java:856)
02-14 01:53:58.235: E/StrictMode(594): null
02-14 01:53:58.235: E/StrictMode(594): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d274b0 that was originally bound here
02-14 01:53:58.235: E/StrictMode(594):  at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
02-14 01:53:58.235: E/StrictMode(594):  at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
02-14 01:53:58.235: E/StrictMode(594):  at android.app.ContextImpl.bindService(ContextImpl.java:1418)
02-14 01:53:58.235: E/StrictMode(594):  at android.app.ContextImpl.bindService(ContextImpl.java:1407)
02-14 01:53:58.235: E/StrictMode(594):  at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
02-14 01:53:58.235: E/StrictMode(594):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
02-14 01:53:58.235: E/StrictMode(594):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
02-14 01:53:58.235: E/StrictMode(594):  at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:191)
02-14 01:53:58.235: E/StrictMode(594):  at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1850)
02-14 01:53:58.235: E/StrictMode(594):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
02-14 01:53:58.235: E/StrictMode(594):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
02-14 01:53:58.235: E/StrictMode(594):  at android.os.AsyncTask$2.call(AsyncTask.java:287)
02-14 01:53:58.235: E/StrictMode(594):  at java.util.concurrent.FutureTask.run(FutureTask.java:234)
02-14 01:53:58.235: E/StrictMode(594):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
02-14 01:53:58.235: E/StrictMode(594):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
02-14 01:53:58.235: E/StrictMode(594):  at java.lang.Thread.run(Thread.java:856)
02-14 01:53:58.235: W/ActivityManager(286): Unbind failed: could not find connection for android.os.BinderProxy@410495b8
02-14 01:53:58.257: E/ActivityThread(594): Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d4fb18 that was originally bound here
02-14 01:53:58.257: E/ActivityThread(594): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d4fb18 that was originally bound here
02-14 01:53:58.257: E/ActivityThread(594):  at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
02-14 01:53:58.257: E/ActivityThread(594):  at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
02-14 01:53:58.257: E/ActivityThread(594):  at android.app.ContextImpl.bindService(ContextImpl.java:1418)
02-14 01:53:58.257: E/ActivityThread(594):  at android.app.ContextImpl.bindService(ContextImpl.java:1407)
02-14 01:53:58.257: E/ActivityThread(594):  at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
02-14 01:53:58.257: E/ActivityThread(594):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
02-14 01:53:58.257: E/ActivityThread(594):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
02-14 01:53:58.257: E/ActivityThread(594):  at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:116)
02-14 01:53:58.257: E/ActivityThread(594):  at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249)
02-14 01:53:58.257: E/ActivityThread(594):  at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856)
02-14 01:53:58.257: E/ActivityThread(594):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
02-14 01:53:58.257: E/ActivityThread(594):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
02-14 01:53:58.257: E/ActivityThread(594):  at android.os.AsyncTask$2.call(AsyncTask.java:287)
02-14 01:53:58.257: E/ActivityThread(594):  at java.util.concurrent.FutureTask.run(FutureTask.java:234)
02-14 01:53:58.257: E/ActivityThread(594):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
02-14 01:53:58.257: E/ActivityThread(594):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
02-14 01:53:58.257: E/ActivityThread(594):  at java.lang.Thread.run(Thread.java:856)
02-14 01:53:58.276: E/StrictMode(594): null
02-14 01:53:58.276: E/StrictMode(594): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d4fb18 that was originally bound here
02-14 01:53:58.276: E/StrictMode(594):  at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
02-14 01:53:58.276: E/StrictMode(594):  at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
02-14 01:53:58.276: E/StrictMode(594):  at android.app.ContextImpl.bindService(ContextImpl.java:1418)
02-14 01:53:58.276: E/StrictMode(594):  at android.app.ContextImpl.bindService(ContextImpl.java:1407)
02-14 01:53:58.276: E/StrictMode(594):  at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
02-14 01:53:58.276: E/StrictMode(594):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
02-14 01:53:58.276: E/StrictMode(594):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
02-14 01:53:58.276: E/StrictMode(594):  at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:116)
02-14 01:53:58.276: E/StrictMode(594):  at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249)
02-14 01:53:58.276: E/StrictMode(594):  at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856)
02-14 01:53:58.276: E/StrictMode(594):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
02-14 01:53:58.276: E/StrictMode(594):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
02-14 01:53:58.276: E/StrictMode(594):  at android.os.AsyncTask$2.call(AsyncTask.java:287)
02-14 01:53:58.276: E/StrictMode(594):  at java.util.concurrent.FutureTask.run(FutureTask.java:234)
02-14 01:53:58.276: E/StrictMode(594):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
02-14 01:53:58.276: E/StrictMode(594):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
02-14 01:53:58.276: E/StrictMode(594):  at java.lang.Thread.run(Thread.java:856)
02-14 01:53:58.285: W/ActivityManager(286): Unbind failed: could not find connection for android.os.BinderProxy@41049d30
nativeGetEnabledTags: 0
02-14 01:54:43.105: D/ExchangeService(594): Received deviceId from Email app: null
02-14 01:54:43.105: D/ExchangeService(594): !!! deviceId unknown; stopping self and retrying
02-14 01:54:48.195: D/ExchangeService(594): !!! EAS ExchangeService, onCreate
02-14 01:54:48.215: W/Trace(594): Unexpected value from nativeGetEnabledTags: 0
02-14 01:54:48.215: W/Trace(594): Unexpected value from nativeGetEnabledTags: 0
02-14 01:54:48.225: D/ExchangeService(594): !!! EAS ExchangeService, onStartCommand, startingUp = false, running = false
02-14 01:54:48.225: W/Trace(594): Unexpected value from nativeGetEnabledTags: 0
02-14 01:54:48.245: W/ActivityManager(286): Unable to start service Intent { act=com.android.email.ACCOUNT_INTENT } U=0: not found
02-14 01:54:48.255: W/Trace(594): Unexpected value from nativeGetEnabledTags: 0
02-14 01:54:48.255: D/ExchangeService(594): !!! EAS ExchangeService, onStartCommand, startingUp = true, running = false
02-14 01:54:48.255: W/Trace(1926): Unexpected value from nativeGetEnabledTags: 0
02-14 01:54:48.265: W/Trace(1926): Unexpected value from nativeGetEnabledTags: 0
02-14 01:54:48.325: W/Trace(1926): Unexpected value from nativeGetEnabledTags: 0
02-14 01:54:48.325: W/Trace(1926): Unexpected value from nativeGetEnabledTags: 0
02-14 01:54:48.357: D/ExchangeService(594): !!! Email application not found; stopping self
02-14 01:54:48.375: W/Trace(594): Unexpected value from nativeGetEnabledTags: 0
02-14 01:54:48.375: W/Trace(594): Unexpected value from nativeGetEnabledTags: 0
02-14 01:54:48.395: W/ActivityManager(286): Unable to start service Intent { act=com.android.email.ACCOUNT_INTENT } U=0: not found
02-14 01:54:48.405: W/Trace(594): Unexpected value from nativeGetEnabledTags: 0
02-14 01:54:48.415: E/ActivityThread(594): Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40ce6300 that was originally bound here
02-14 01:54:48.415: E/ActivityThread(594): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40ce6300 that was originally bound here
02-14 01:54:48.415: E/ActivityThread(594):  at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
02-14 01:54:48.415: E/ActivityThread(594):  at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
02-14 01:54:48.415: E/ActivityThread(594):  at android.app.ContextImpl.bindService(ContextImpl.java:1418)
02-14 01:54:48.415: E/ActivityThread(594):  at android.app.ContextImpl.bindService(ContextImpl.java:1407)
02-14 01:54:48.415: E/ActivityThread(594):  at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
02-14 01:54:48.415: E/ActivityThread(594):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
02-14 01:54:48.415: E/ActivityThread(594):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
02-14 01:54:48.415: E/ActivityThread(594):  at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:116)
02-14 01:54:48.415: E/ActivityThread(594):  at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249)
02-14 01:54:48.415: E/ActivityThread(594):  at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856)
02-14 01:54:48.415: E/ActivityThread(594):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
02-14 01:54:48.415: E/ActivityThread(594):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
02-14 01:54:48.415: E/ActivityThread(594):  at android.os.AsyncTask$2.call(AsyncTask.java:287)
02-14 01:54:48.415: E/ActivityThread(594):  at java.util.concurrent.FutureTask.run(FutureTask.java:234)
02-14 01:54:48.415: E/ActivityThread(594):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
02-14 01:54:48.415: E/ActivityThread(594):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
02-14 01:54:48.415: E/ActivityThread(594):  at java.lang.Thread.run(Thread.java:856)
02-14 01:54:48.527: E/StrictMode(594): null
02-14 01:54:48.527: E/StrictMode(594): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40ce6300 that was originally bound here
02-14 01:54:48.527: E/StrictMode(594):  at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
02-14 01:54:48.527: E/StrictMode(594):  at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
02-14 01:54:48.527: E/StrictMode(594):  at android.app.ContextImpl.bindService(ContextImpl.java:1418)
02-14 01:54:48.527: E/StrictMode(594):  at android.app.ContextImpl.bindService(ContextImpl.java:1407)
02-14 01:54:48.527: E/StrictMode(594):  at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
02-14 01:54:48.527: E/StrictMode(594):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
02-14 01:54:48.527: E/StrictMode(594):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
02-14 01:54:48.527: E/StrictMode(594):  at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:116)
02-14 01:54:48.527: E/StrictMode(594):  at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249)
02-14 01:54:48.527: E/StrictMode(594):  at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856)
02-14 01:54:48.527: E/StrictMode(594):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
02-14 01:54:48.527: E/StrictMode(594):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
02-14 01:54:48.527: E/StrictMode(594):  at android.os.AsyncTask$2.call(AsyncTask.java:287)
02-14 01:54:48.527: E/StrictMode(594):  at java.util.concurrent.FutureTask.run(FutureTask.java:234)
02-14 01:54:48.527: E/StrictMode(594):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
02-14 01:54:48.527: E/StrictMode(594):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
02-14 01:54:48.527: E/StrictMode(594):  at java.lang.Thread.run(Thread.java:856)
02-14 01:54:48.527: W/ActivityManager(286): Unbind failed: could not find connection for android.os.BinderProxy@40fc6168
02-14 01:54:48.546: E/ActivityThread(594): Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40cd0358 that was originally bound here
02-14 01:54:48.546: E/ActivityThread(594): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40cd0358 that was originally bound here
02-14 01:54:48.546: E/ActivityThread(594):  at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
02-14 01:54:48.546: E/ActivityThread(594):  at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
02-14 01:54:48.546: E/ActivityThread(594):  at android.app.ContextImpl.bindService(ContextImpl.java:1418)
02-14 01:54:48.546: E/ActivityThread(594):  at android.app.ContextImpl.bindService(ContextImpl.java:1407)
02-14 01:54:48.546: E/ActivityThread(594):  at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
02-14 01:54:48.546: E/ActivityThread(594):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
02-14 01:54:48.546: E/ActivityThread(594):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
02-14 01:54:48.546: E/ActivityThread(594):  at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:191)
02-14 01:54:48.546: E/ActivityThread(594):  at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1850)
02-14 01:54:48.546: E/ActivityThread(594):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
02-14 01:54:48.546: E/ActivityThread(594):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
02-14 01:54:48.546: E/ActivityThread(594):  at android.os.AsyncTask$2.call(AsyncTask.java:287)
02-14 01:54:48.546: E/ActivityThread(594):  at java.util.concurrent.FutureTask.run(FutureTask.java:234)
02-14 01:54:48.546: E/ActivityThread(594):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
02-14 01:54:48.546: E/ActivityThread(594):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
02-14 01:54:48.546: E/ActivityThread(594):  at java.lang.Thread.run(Thread.java:856)
02-14 01:54:48.595: E/StrictMode(594): null
02-14 01:54:48.595: E/StrictMode(594): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40cd0358 that was originally bound here
02-14 01:54:48.595: E/StrictMode(594):  at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
02-14 01:54:48.595: E/StrictMode(594):  at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
02-14 01:54:48.595: E/StrictMode(594):  at android.app.ContextImpl.bindService(ContextImpl.java:1418)
02-14 01:54:48.595: E/StrictMode(594):  at android.app.ContextImpl.bindService(ContextImpl.java:1407)
02-14 01:54:48.595: E/StrictMode(594):  at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
02-14 01:54:48.595: E/StrictMode(594):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
02-14 01:54:48.595: E/StrictMode(594):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
02-14 01:54:48.595: E/StrictMode(594):  at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:191)
02-14 01:54:48.595: E/StrictMode(594):  at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1850)
02-14 01:54:48.595: E/StrictMode(594):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
02-14 01:54:48.595: E/StrictMode(594):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
02-14 01:54:48.595: E/StrictMode(594):  at android.os.AsyncTask$2.call(AsyncTask.java:287)
02-14 01:54:48.595: E/StrictMode(594):  at java.util.concurrent.FutureTask.run(FutureTask.java:234)
02-14 01:54:48.595: E/StrictMode(594):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
02-14 01:54:48.595: E/StrictMode(594):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
02-14 01:54:48.595: E/StrictMode(594):  at java.lang.Thread.run(Thread.java:856)
02-14 01:54:48.595: W/ActivityManager(286): Unbind failed: could not find connection for android.os.BinderProxy@40fc56d8
02-14 01:54:48.695: D/dalvikvm(594): GC_CONCURRENT freed 476K, 20% free 2472K/3068K, paused 75ms+79ms, total 265ms

代码:

public class Order extends Activity implements OnClickListener {

    EditText qtymilk;
    EditText qtytide;
    EditText qtypaper;
    EditText qtycheese;
    EditText qtypotato;
    TextView milk;
    TextView tide;
    TextView paper;
    TextView cheese;
    TextView potato;
    TextView totalmilk;
    TextView totaltide;
    TextView totalpaper;
    TextView totalcheese;
    TextView totalpotato;
    EditText discount1;


    double num1, num2, prod1;
    double num3, num4, prod2;
    double num5, num6, prod3;
    double num7, num8, prod4;
    double num9, num10, prod5;

    double grandt = prod1 + prod2 + prod3 + prod4 + prod5;


    TextView grandtotal;

    Button total;
    Button summary;
    Button discount;



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_order);

        milk = (TextView) findViewById(R.id.textView6);
        tide = (TextView) findViewById(R.id.textView7);
        paper = (TextView) findViewById(R.id.textView8);
        cheese = (TextView) findViewById(R.id.textView9);
        potato = (TextView) findViewById(R.id.textView10);

        qtymilk = (EditText) findViewById(R.id.qtymilk);
        qtytide = (EditText) findViewById(R.id.qtytide);
        qtypaper = (EditText) findViewById(R.id.qtypaper);
        qtycheese = (EditText) findViewById(R.id.qtycheese);
        qtypotato = (EditText) findViewById(R.id.qtypotato);


        totalmilk = (TextView) findViewById(R.id.totalmilk);
        totaltide = (TextView) findViewById(R.id.totaltide);
        totalpaper = (TextView) findViewById(R.id.totalpaper);
        totalcheese = (TextView) findViewById(R.id.totalcheese);
        totalpotato = (TextView) findViewById(R.id.totalpotato1);

        total = (Button) findViewById(R.id.button1);
        total.setOnClickListener((OnClickListener) this);
        discount = (Button) findViewById(R.id.button2);
        discount.setOnClickListener((OnClickListener) this);
        summary = (Button) findViewById(R.id.button3);
        summary.setOnClickListener((OnClickListener) this);

    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.order, menu);
        return true;
    }

    @Override
    public void onClick(View v) {
        if (v.getId() == R.id.button1) {
            num1 = Double.parseDouble(qtymilk.getText().toString());
            num2 = Double.parseDouble(milk.getText().toString());
            prod1 = num1 * num2;
            totalmilk.setText(Double.toString(prod1));

            num3 = Double.parseDouble(qtytide.getText().toString());
            num4 = Double.parseDouble(tide.getText().toString());
            prod2 = num3 * num4;
            totaltide.setText(Double.toString(prod2));


            num5 = Double.parseDouble(qtypaper.getText().toString());
            num6 = Double.parseDouble(paper.getText().toString());
            prod3 = num5 * num6;
            totalpaper.setText(Double.toString(prod3));


            num7 = Double.parseDouble(qtycheese.getText().toString());
            num8 = Double.parseDouble(cheese.getText().toString());
            prod4 = num7 * num8;
            totalcheese.setText(Double.toString(prod4));

            num9 = Double.parseDouble(qtypotato.getText().toString());
            num10 = Double.parseDouble(potato.getText().toString());
            prod5 = num9 * num10;
            totalpotato.setText(Double.toString(prod5));


            grandtotal.setText(Double.toString(grand4));


        }
    }

}

2 个答案:

答案 0 :(得分:0)

删除您的代码行    double grandt = prod1 + prod2 + prod3 + prod4 + prod5; 你可以只使用一个全局变量(只有你需要它时)。即 双重格兰特;

休息你可以点击按钮

   @Override
    public void onClick(View v) {
        if (v.getId() == R.id.button1) {
            num1 = Double.parseDouble(qtymilk.getText().toString());
            num2 = Double.parseDouble(milk.getText().toString());
            double prod1 = num1 * num2; // <--------------
            totalmilk.setText(Double.toString(prod1));

            num3 = Double.parseDouble(qtytide.getText().toString());
            num4 = Double.parseDouble(tide.getText().toString());
            double prod2 = num3 * num4; 
            totaltide.setText(Double.toString(prod2));


            num5 = Double.parseDouble(qtypaper.getText().toString());
            num6 = Double.parseDouble(paper.getText().toString());
            double prod3 = num5 * num6; // <---------------------
            totalpaper.setText(Double.toString(prod3));


            num7 = Double.parseDouble(qtycheese.getText().toString());
            num8 = Double.parseDouble(cheese.getText().toString());
            double prod4 = num7 * num8;
            totalcheese.setText(Double.toString(prod4));

            num9 = Double.parseDouble(qtypotato.getText().toString());
            num10 = Double.parseDouble(potato.getText().toString());
            double prod5 = num9 * num10; <---------------
            totalpotato.setText(Double.toString(prod5));

            double grndttl = prod1+prod2; // or whatever you want.

答案 1 :(得分:0)

我强烈建议将您的逻辑分解为更小,可读的方法。您也不需要将数字存储为字段。

即。删除整个代码块......

double num1, num2, prod1;
double num3, num4, prod2;
double num5, num6, prod3;
double num7, num8, prod4;
double num9, num10, prod5;

double grandt = prod1 + prod2 + prod3 + prod4 + prod5;

此外,如果您要解析的字符串不是double值,Double.parseDouble将抛出NumberFormatException,因此如果您的应用因此崩溃,请确保这些值是实际数字。

以下是您尝试实现的小样本

private double getTotalMilk() {
    double quantity = Double.parseDouble(qtymilk.getText().toString());
    double amount = Double.parseDouble(milk.getText().toString());
    return quantity * amount;
}

private double getTotalTide() {
    double quantity = Double.parseDouble(qtytide.getText().toString());
    double amount = Double.parseDouble(tide.getText().toString());
    return quantity * amount;
}

@Override
public void onClick(View v) {
    if (v.getId() == R.id.button1) {
        double grandTotal = 0;

        double totalMilk = getTotalMilk();
        grandTotal += totalMilk;
        totalmilk.setText(Double.toString(totalMilk));

        double totalTide = getTotalTide();
        grandTotal += totalTide;
        totaltide.setText(Double.toString(totalTide));

        // Repeat pattern....

        grandtotal.setText(Double.toString(grandTotal));
    }
}