当我开始一项活动时,Handler#postDelayed(Runnable, long)
我收到一条错误日志消息(是的,重复了两次):
03-19 18:39:26.628: E/SpannableStringBuilder(11502): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
03-19 18:39:26.628: E/SpannableStringBuilder(11502): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
应用程序不会崩溃,但是总是看到这个错误很烦人。在此示例中,我在 LogCat 中没有得到其他输出。
我的第一个活动:
public class ActivityOne extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
startActivityTwoDelayed();
}
private void startActivityTwoDelayed() {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent captureIntent = new Intent(ActivityOne.this,
ActivityTwo.class);
startActivity(captureIntent);
}
}, 1000);
}
}
我的第二个活动:
public class ActivityTwo extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
}
我的清单:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.test03"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".ActivityOne"
android:label="@string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ActivityTwo"
android:label="@string/title_activity_main" >
</activity>
</application>
</manifest>