Я пытаюсь заменить тосты в приведенном ниже коде намерениями, но независимо от того, сколько методов я пытаюсь, они не работают.Проблема заключается только в белом экране на эмуляторе при загрузке приложения.Буду признателен за любую помощь.
spinner.setOnItemSelectedListener(new OnItemSelectedListener()
{
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
// TODO Auto-generated method stub
switch (arg2) {
case 0:
Toast.makeText(UsefulToolsActivity.this, "Tool, Countdown. Selected.", Toast.LENGTH_SHORT).show();
break;
case 1:
Toast.makeText(UsefulToolsActivity.this, "Tool, Countdown. Selected.", Toast.LENGTH_SHORT).show();
break;
default :
break;
}
}
public void onNothingSelected(AdapterView<?> arg0) {
// TODO Auto-generated method stub
}
});
}
Вот код, который я пытался использовать для реализации намерений
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
// TODO Auto-generated method stub
switch (arg2) {
case 0:
Intent intent1 = new Intent(UsefulToolsActivity.this, CountdownActivity.class);
startActivity(intent1);
break;
case 1:
Intent intent2 = new Intent(UsefulToolsActivity.this, CountdownActivity.class);
startActivity(intent2);
break;
default :
break;
}
}
public void onNothingSelected(AdapterView<?> arg0) {
// TODO Auto-generated method stub
}
Выход Logcat при выполнении приложения
12-23 13:45:50.637: E/JavaBinder(621): !!! FAILED BINDER TRANSACTION !!!
12-23 13:45:50.957: E/AndroidRuntime(621): FATAL EXCEPTION: main
12-23 13:45:50.957: E/AndroidRuntime(621): java.lang.RuntimeException: Adding window failed
12-23 13:45:50.957: E/AndroidRuntime(621): at android.view.ViewRootImpl.setView(ViewRootImpl.java:491)
12-23 13:45:50.957: E/AndroidRuntime(621): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:301)
12-23 13:45:50.957: E/AndroidRuntime(621): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:215)
12-23 13:45:50.957: E/AndroidRuntime(621): at android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:140)
12-23 13:45:50.957: E/AndroidRuntime(621): at android.view.Window$LocalWindowManager.addView(Window.java:537)
12-23 13:45:50.957: E/AndroidRuntime(621): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2507)
12-23 13:45:50.957: E/AndroidRuntime(621): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1986)
12-23 13:45:50.957: E/AndroidRuntime(621): at android.app.ActivityThread.access$600(ActivityThread.java:123)
12-23 13:45:50.957: E/AndroidRuntime(621): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
12-23 13:45:50.957: E/AndroidRuntime(621): at android.os.Handler.dispatchMessage(Handler.java:99)
12-23 13:45:50.957: E/AndroidRuntime(621): at android.os.Looper.loop(Looper.java:137)
12-23 13:45:50.957: E/AndroidRuntime(621): at android.app.ActivityThread.main(ActivityThread.java:4424)
12-23 13:45:50.957: E/AndroidRuntime(621): at java.lang.reflect.Method.invokeNative(Native Method)
12-23 13:45:50.957: E/AndroidRuntime(621): at java.lang.reflect.Method.invoke(Method.java:511)
12-23 13:45:50.957: E/AndroidRuntime(621): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
12-23 13:45:50.957: E/AndroidRuntime(621): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
12-23 13:45:50.957: E/AndroidRuntime(621): at dalvik.system.NativeStart.main(Native Method)
12-23 13:45:50.957: E/AndroidRuntime(621): Caused by: android.os.TransactionTooLargeException
12-23 13:45:50.957: E/AndroidRuntime(621): at android.os.BinderProxy.transact(Native Method)
12-23 13:45:50.957: E/AndroidRuntime(621): at android.view.IWindowSession$Stub$Proxy.add(IWindowSession.java:516)
12-23 13:45:50.957: E/AndroidRuntime(621): at android.view.ViewRootImpl.setView(ViewRootImpl.java:481)
12-23 13:45:50.957: E/AndroidRuntime(621): ... 16 more