任何人都知道为什么这个意图会失败
这是日志猫中的日志
04-08 10:52:51.782: E/SpannableStringBuilder(10411): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
04-08 10:52:51.782: E/SpannableStringBuilder(10411): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
04-08 10:52:52.542: E/SpannableStringBuilder(10411): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
04-08 10:52:52.542: E/SpannableStringBuilder(10411): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
04-08 10:52:53.797: E/AndroidRuntime(10411): FATAL EXCEPTION: main
04-08 10:52:53.797: E/AndroidRuntime(10411): java.lang.RuntimeException: Unable to start activity ComponentInfo {com.better.work.learning.letters.and.more.awesome/com.better.work.learning.letters.and.more.awesome.spellingLevel1}: android.content.res.Resources$NotFoundException: Resource ID #0x16
04-08 10:52:53.797: E/AndroidRuntime(10411): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2100)
04-08 10:52:53.797: E/AndroidRuntime(10411): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
04-08 10:52:53.797: E/AndroidRuntime(10411): at android.app.ActivityThread.access$600(ActivityThread.java:140)
04-08 10:52:53.797: E/AndroidRuntime(10411): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
04-08 10:52:53.797: E/AndroidRuntime(10411): at android.os.Handler.dispatchMessage(Handler.java:99)
04-08 10:52:53.797: E/AndroidRuntime(10411): at android.os.Looper.loop(Looper.java:137)
04-08 10:52:53.797: E/AndroidRuntime(10411): at android.app.ActivityThread.main(ActivityThread.java:4898)
04-08 10:52:53.797: E/AndroidRuntime(10411): at java.lang.reflect.Method.invokeNative(Native Method)
04-08 10:52:53.797: E/AndroidRuntime(10411): at java.lang.reflect.Method.invoke(Method.java:511)
04-08 10:52:53.797: E/AndroidRuntime(10411): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1008)
04-08 10:52:53.797: E/AndroidRuntime(10411): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:775)
04-08 10:52:53.797: E/AndroidRuntime(10411): at dalvik.system.NativeStart.main(Native Method)
04-08 10:52:53.797: E/AndroidRuntime(10411): Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x16
04-08 10:52:53.797: E/AndroidRuntime(10411): at android.content.res.Resources.getValue(Resources.java:1026)
04-08 10:52:53.797: E/AndroidRuntime(10411): at android.content.res.Resources.getDrawable(Resources.java:671)
04-08 10:52:53.797: E/AndroidRuntime(10411): at android.view.View.setBackgroundResource(View.java:14494)
04-08 10:52:53.797: E/AndroidRuntime(10411): at com.better.work.learning.letters.and.more.awesome.spellingLevel1.onCreate(spellingLevel1.java:72)
04-08 10:52:53.797: E/AndroidRuntime(10411): at android.app.Activity.performCreate(Activity.java:5206)
04-08 10:52:53.797: E/AndroidRuntime(10411): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
04-08 10:52:53.797: E/AndroidRuntime(10411): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2064)
04-08 10:52:53.797: E/AndroidRuntime(10411): ... 11 more
代码在这里一直失败是清单文件
这不是完整的代码,但基本上没有错误,当我尝试加载扩展活动并导入的 sellLevel1 类时,它只是失败了。它也与其他所有内容一样包含在包装中。当我单击 spellingLevelPicker 类上的按钮 1 时,应用程序也会运行但不会失败
编辑
好的,这里失败了
公共类 spellingLevel1 扩展 Activity {
Context mContext = null;
private RelativeLayout mCanvasContainer;
private SCanvasView mSCanvas;
private ImageView mImageView1,mImageView2,mImageView3,mImageView4,mImageView5,mImageView6,mImageView7,mImageView8;
public int currentLetter;
private int rando;
int[] myImageList = {
R.drawable.lettersa, R.drawable.lettersb,
R.drawable.lettersc, R.drawable.lettersd,
R.drawable.letterse, R.drawable.lettersf, R.drawable.lettersg,
R.drawable.lettersh, R.drawable.lettersi, R.drawable.lettersj,
R.drawable.lettersk, R.drawable.lettersl, R.drawable.lettersm,
R.drawable.lettersn, R.drawable.letterso, R.drawable.lettersp,
R.drawable.lettersq, R.drawable.lettersr, R.drawable.letterss, R.drawable.letterst,
R.drawable.lettersu, R.drawable.lettersv, R.drawable.lettersw,
R.drawable.lettersx, R.drawable.lettersy, R.drawable.lettersz};
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.spelling);
mContext = this;
mCanvasContainer = (RelativeLayout) findViewById(R.id.canvas_container);
mSCanvas = new SCanvasView(mContext);
ImageView mImageView01 = (ImageView) findViewById(R.id.imageView1);
ImageView mImageView02 = (ImageView) findViewById(R.id.imageView2);
ImageView mImageView03 = (ImageView) findViewById(R.id.imageView3);
ImageView mImageView04 = (ImageView) findViewById(R.id.imageView4);
ImageView mImageView05 = (ImageView) findViewById(R.id.imageView5);
ImageView mImageView06 = (ImageView) findViewById(R.id.imageView6);
ImageView mImageView07 = (ImageView) findViewById(R.id.imageView7);
ImageView mImageView08 = (ImageView) findViewById(R.id.imageView8);
Random rando = new Random();
currentLetter = rando.nextInt(myImageList.length);
mImageView01.setBackgroundResource(currentLetter);
mImageView02.setBackgroundResource(currentLetter);
mImageView03.setBackgroundResource(currentLetter);
mImageView04.setBackgroundResource(currentLetter);
}
}
下面的销毁有一个公共无效,但如果我评论 imageview 设置背景资源它不会失败