当按下调用跟随侦听器的两个按钮之一时
OnClickListener mSportiveListener = new OnClickListener() {
public void onClick(View v) {
String title = getResources().getString(
R.string.function_sport_i);
String category="SPORT";
startFunctionSelector(title, category);
}
};
OnClickListener mClassicListener = new OnClickListener() {
public void onClick(View v) {
String title = getResources().getString(
R.string.function_classic_i);
String category="CLASSIC";
startFunctionSelector(title, category);
}
};
应用程序经常崩溃,其中包含有关恰好在线发生的错误的任何详细信息
startActivity(selector);
方法的
public void startFunctionSelector(String title, String functionCategory) {
Intent selector = new Intent(Home.this, FunctionSelector.class);
selector.putExtra("Title", title);
selector.putExtra("FunctionCategory", functionCategory);
try {
startActivity(selector);
} catch (RuntimeException e) {
e.printStackTrace();
}
}
该错误与我输入的任何内容无关FunctionSelector.class
,因此行为完全相同(我也尝试过使用 Hello World)
不幸的是,由于一些奇怪的原因,Eclipse 没有给我任何关于错误的细节,只有一个通用的 SourceNotFound
// Compiled from Handler.java (version 1.5 : 49.0, super bit)
public class android.os.Handler {
// Method descriptor #11 ()V
// Stack: 3, Locals: 1
public Handler();
0 aload_0 [this]
1 invokespecial java.lang.Object() [1]
4 new java.lang.RuntimeException [2]
7 dup
8 ldc <String "Stub!"> [3]
10 invokespecial java.lang.RuntimeException(java.lang.String) [4]
13 athrow
Line numbers:
[pc: 0, line: 8]
Local variable table:
[pc: 0, pc: 14] local: this index: 0 type: android.os.Handler
但没有具体说明这个问题。
更多细节
FunctionSelector 的 onCreate,但正如我所说的,如果我在这个 Activity 中只留下一个 helloWorld,也会崩溃
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
.permitAll().build();
StrictMode.setThreadPolicy(policy);
setContentView(R.layout.selector_gui);
selectorTitle = getIntent().getStringExtra("Title");
functionCategory = getIntent().getStringExtra("FunctionCategory");
buttonBack = (ImageButton) findViewById(R.id.btBack);
buttonBack.setOnClickListener(mBackListener);
txtTitle = (TextView) findViewById(R.id.txtTitle);
txtTitle.setText(selectorTitle);
list = (ListView) findViewById(R.id.listaFunzioni);
}
如果我尝试使用模拟器并进入 AllMessage(每个应用程序未过滤),我可以看到
07-11 14:25:51.139: E/ActivityThread(1550): Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@b2f46948 that was originally bound here
07-11 14:25:51.139: E/ActivityThread(1550): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@b2f46948 that was originally bound here
07-11 14:25:51.139: E/ActivityThread(1550): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
07-11 14:25:51.139: E/ActivityThread(1550): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
07-11 14:25:51.139: E/ActivityThread(1550): at android.app.ContextImpl.bindService(ContextImpl.java:1418)
07-11 14:25:51.139: E/ActivityThread(1550): at android.app.ContextImpl.bindService(ContextImpl.java:1407)
07-11 14:25:51.139: E/ActivityThread(1550): at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
07-11 14:25:51.139: E/ActivityThread(1550): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
07-11 14:25:51.139: E/ActivityThread(1550): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
07-11 14:25:51.139: E/ActivityThread(1550): at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:116)
07-11 14:25:51.139: E/ActivityThread(1550): at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249)
07-11 14:25:51.139: E/ActivityThread(1550): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856)
07-11 14:25:51.139: E/ActivityThread(1550): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
07-11 14:25:51.139: E/ActivityThread(1550): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
07-11 14:25:51.139: E/ActivityThread(1550): at android.os.AsyncTask$2.call(AsyncTask.java:287)
07-11 14:25:51.139: E/ActivityThread(1550): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
07-11 14:25:51.139: E/ActivityThread(1550): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
07-11 14:25:51.139: E/ActivityThread(1550): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
07-11 14:25:51.139: E/ActivityThread(1550): at java.lang.Thread.run(Thread.java:856)
07-11 14:25:51.139: E/StrictMode(1550): null
07-11 14:25:51.139: E/StrictMode(1550): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@b2f46948 that was originally bound here
07-11 14:25:51.139: E/StrictMode(1550): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
07-11 14:25:51.139: E/StrictMode(1550): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
07-11 14:25:51.139: E/StrictMode(1550): at android.app.ContextImpl.bindService(ContextImpl.java:1418)
07-11 14:25:51.139: E/StrictMode(1550): at android.app.ContextImpl.bindService(ContextImpl.java:1407)
07-11 14:25:51.139: E/StrictMode(1550): at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
07-11 14:25:51.139: E/StrictMode(1550): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
07-11 14:25:51.139: E/StrictMode(1550): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
07-11 14:25:51.139: E/StrictMode(1550): at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:116)
07-11 14:25:51.139: E/StrictMode(1550): at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249)
07-11 14:25:51.139: E/StrictMode(1550): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856)
07-11 14:25:51.139: E/StrictMode(1550): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
07-11 14:25:51.139: E/StrictMode(1550): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
07-11 14:25:51.139: E/StrictMode(1550): at android.os.AsyncTask$2.call(AsyncTask.java:287)
07-11 14:25:51.139: E/StrictMode(1550): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
07-11 14:25:51.139: E/StrictMode(1550): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
07-11 14:25:51.139: E/StrictMode(1550): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
07-11 14:25:51.139: E/StrictMode(1550): at java.lang.Thread.run(Thread.java:856)
07-11 14:25:51.139: W/ActivityManager(1201): Unbind failed: could not find connection for android.os.BinderProxy@b3149200
07-11 14:25:51.139: E/ActivityThread(1550): Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@b2f7f7c0 that was originally bound here
07-11 14:25:51.139: E/ActivityThread(1550): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@b2f7f7c0 that was originally bound here
07-11 14:25:51.139: E/ActivityThread(1550): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
07-11 14:25:51.139: E/ActivityThread(1550): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
07-11 14:25:51.139: E/ActivityThread(1550): at android.app.ContextImpl.bindService(ContextImpl.java:1418)
07-11 14:25:51.139: E/ActivityThread(1550): at android.app.ContextImpl.bindService(ContextImpl.java:1407)
07-11 14:25:51.139: E/ActivityThread(1550): at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
07-11 14:25:51.139: E/ActivityThread(1550): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
07-11 14:25:51.139: E/ActivityThread(1550): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
07-11 14:25:51.139: E/ActivityThread(1550): at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:191)
07-11 14:25:51.139: E/ActivityThread(1550): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1850)
07-11 14:25:51.139: E/ActivityThread(1550): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
07-11 14:25:51.139: E/ActivityThread(1550): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
07-11 14:25:51.139: E/ActivityThread(1550): at android.os.AsyncTask$2.call(AsyncTask.java:287)
07-11 14:25:51.139: E/ActivityThread(1550): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
07-11 14:25:51.139: E/ActivityThread(1550): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
07-11 14:25:51.139: E/ActivityThread(1550): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
07-11 14:25:51.139: E/ActivityThread(1550): at java.lang.Thread.run(Thread.java:856)
07-11 14:25:51.139: E/StrictMode(1550): null
07-11 14:25:51.139: E/StrictMode(1550): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@b2f7f7c0 that was originally bound here
07-11 14:25:51.139: E/StrictMode(1550): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
07-11 14:25:51.139: E/StrictMode(1550): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
07-11 14:25:51.139: E/StrictMode(1550): at android.app.ContextImpl.bindService(ContextImpl.java:1418)
07-11 14:25:51.139: E/StrictMode(1550): at android.app.ContextImpl.bindService(ContextImpl.java:1407)
07-11 14:25:51.139: E/StrictMode(1550): at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
07-11 14:25:51.139: E/StrictMode(1550): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
07-11 14:25:51.139: E/StrictMode(1550): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
07-11 14:25:51.139: E/StrictMode(1550): at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:191)
07-11 14:25:51.139: E/StrictMode(1550): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1850)
07-11 14:25:51.139: E/StrictMode(1550): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
07-11 14:25:51.139: E/StrictMode(1550): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
07-11 14:25:51.139: E/StrictMode(1550): at android.os.AsyncTask$2.call(AsyncTask.java:287)
07-11 14:25:51.139: E/StrictMode(1550): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
07-11 14:25:51.139: E/StrictMode(1550): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
07-11 14:25:51.139: E/StrictMode(1550): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
07-11 14:25:51.139: E/StrictMode(1550): at java.lang.Thread.run(Thread.java:856)