- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我是 Android 应用开发新手,为此我使用 Eclipse。
我有一个包含多个按钮的类(class)/Activity 。单击这些按钮后,每个按钮都会启动不同的 Activity 。大多数时候,这工作正常 - 我可以单击一个按钮启动 activity1,单击后退按钮终止 activity1,然后单击另一个按钮启动 activity2。
但是,我发现如果我退出 activity1,然后快速(在离开 activity1 后 1 秒内)单击按钮启动 activity2,我的应用程序就会崩溃。我曾尝试在线搜索解决方案,但没有找到任何解决方案。
有什么方法可以避免单击按钮导致应用程序快速崩溃的情况?
谢谢!非常感谢任何帮助。
这是我类(class)的代码:
public class CharPicker extends Activity implements View.OnClickListener {
ImageButton otherHeader;
ImageButton char1, char2, char3, char4, char5, char6, char7, char8, char9, char10;
private boolean clicked; // Determines if a character was selected.
@Override
public void onCreate(Bundle savedInstanceState){
// Sets the view to the character picker screen.
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_charpicker);
// Set audio manager to handle volume changes in music/audio.
this.setVolumeControlStream(AudioManager.STREAM_MUSIC);
otherHeader = (ImageButton) findViewById(R.id.otherHeader); // Other header.
char1 = (ImageButton) findViewById(R.id.first); // Char1 icon.
char2 = (ImageButton) findViewById(R.id.second); // Char2 icon.
char3 = (ImageButton) findViewById(R.id.third); // Char3 icon.
char4 = (ImageButton) findViewById(R.id.fourth); // Char4 icon.
char5 = (ImageButton) findViewById(R.id.fifth); // Char5 icon.
char6 = (ImageButton) findViewById(R.id.sixth); // Char6 icon.
char7 = (ImageButton) findViewById(R.id.seventh); // Char7 icon.
char8 = (ImageButton) findViewById(R.id.eighth); // Char8 icon.
char9 = (ImageButton) findViewById(R.id.ninth); // Char9 icon.
char10 = (ImageButton) findViewById(R.id.tenth); // Char10 icon.
otherHeader.setOnClickListener(this);
char1.setOnClickListener(this);
char2.setOnClickListener(this);
char3.setOnClickListener(this);
char4.setOnClickListener(this);
char5.setOnClickListener(this);
char6.setOnClickListener(this);
char7.setOnClickListener(this);
char8.setOnClickListener(this);
char9.setOnClickListener(this);
char10.setOnClickListener(this);
clicked = false;
}
@Override
protected void onStart(){
// Resets clicked boolean to false so another character can be selected.
super.onStart();
if(clicked == true)
clicked = false;
}
@Override
protected void onResume(){
// Resets clicked boolean to false so another character can be selected.
super.onResume();
if(clicked == true)
clicked = false;
}
@Override
protected void onPause(){
// Sets clicked boolean to true to avoid crashing cases arising from multiple concurrent button clicks.
super.onPause();
if(clicked == false)
clicked = true;
}
@Override
protected void onStop(){
// Sets clicked boolean to true to avoid crashing cases arising from multiple concurrent button clicks.
super.onStop();
if(clicked == false)
clicked = true;
}
public void onClick(View view){
// Determines which instruction screen to load up as an activity.
// Creates a new activity.
switch(view.getId()){
case(R.id.otherHeader):
if(clicked == false){
// Clicking on this returns user to the home page.
// Terminates this activity.
clicked = true;
finish();
}
case(R.id.first):
if(clicked == false){
Intent collection1Char1 = new Intent(this, Collection1Char1.class);
startActivity(collection1Char1);
clicked = true;
}
break;
case(R.id.second):
if(clicked == false){
Intent collection1Char2 = new Intent(this, Collection1Char2.class);
startActivity(collection1Char2);
clicked = true;
}
break;
case(R.id.third):
if(clicked == false){
Intent collection1Char3 = new Intent(this, Collection1Char3.class);
startActivity(collection1Char3);
clicked = true;
}
break;
case(R.id.fourth):
if(clicked == false){
Intent collection1Char4 = new Intent(this, Collection1Char4.class);
startActivity(collection1Char4);
clicked = true;
}
break;
case(R.id.fifth):
if(clicked == false){
Intent collection1Char5 = new Intent(this, Collection1Char5.class);
startActivity(collection1Char5);
clicked = true;
}
break;
case(R.id.sixth):
if(clicked == false){
Intent collection1Char6 = new Intent(this, Collection1Char6.class);
startActivity(collection1Char6);
clicked = true;
}
break;
case(R.id.seventh):
if(clicked == false){
Intent collection1Char7 = new Intent(this, Collection1Char7.class);
startActivity(collection1Char7);
clicked = true;
}
break;
case(R.id.eighth):
if(clicked == false){
Intent collection1Char8 = new Intent(this, Collection1Char8.class);
startActivity(collection1Char8);
clicked = true;
}
break;
case(R.id.ninth):
if(clicked == false){
Intent collection1Char9 = new Intent(this, Collection1Char9.class);
startActivity(collection1Char9);
clicked = true;
}
break;
case(R.id.tenth):
if(clicked == false){
Intent collection1Char10 = new Intent(this, Collection1Char10.class);
startActivity(collection1Char10);
clicked = true;
}
break;
}
}
}
下面是日志:
12-15 17:36:47.698: D/dalvikvm(28552): GC_FOR_ALLOC freed 154K, 9% free 14686K/15971K, paused 17ms
12-15 17:36:47.708: I/dalvikvm-heap(28552): Grow heap (frag case) to 17.289MB for 2406416-byte allocation
12-15 17:36:47.728: D/dalvikvm(28552): GC_FOR_ALLOC freed <1K, 8% free 17036K/18339K, paused 16ms
12-15 17:36:47.778: D/dalvikvm(28552): GC_CONCURRENT freed 589K, 11% free 16465K/18339K, paused 2ms+2ms
12-15 17:36:47.798: D/memalloc(28552): ion: Mapped buffer base:0x5d709000 size:3768320 offset:0 fd:51
12-15 17:36:47.818: D/CLIPBOARD(28552): Hide Clipboard dialog at Starting input: finished by someone else... !
12-15 17:36:49.029: D/dalvikvm(28552): GC_FOR_ALLOC freed 198K, 6% free 17870K/18979K, paused 13ms
12-15 17:36:49.039: I/dalvikvm-heap(28552): Grow heap (frag case) to 20.495MB for 2508016-byte allocation
12-15 17:36:49.059: D/dalvikvm(28552): GC_CONCURRENT freed 1K, 6% free 20318K/21475K, paused 2ms+2ms
12-15 17:36:49.089: D/dalvikvm(28552): GC_FOR_ALLOC freed 612K, 9% free 20319K/22115K, paused 12ms
12-15 17:36:49.099: I/dalvikvm-heap(28552): Grow heap (frag case) to 22.886MB for 2508016-byte allocation
12-15 17:36:49.119: D/dalvikvm(28552): GC_CONCURRENT freed <1K, 8% free 22768K/24611K, paused 2ms+1ms
12-15 17:36:49.149: D/memalloc(28552): ion: Mapped buffer base:0x5dba1000 size:3768320 offset:0 fd:58
12-15 17:36:52.433: D/memalloc(28552): ion: Mapped buffer base:0x5d609000 size:3768320 offset:0 fd:51
12-15 17:36:52.583: D/memalloc(28552): ion: Mapped buffer base:0x5df39000 size:3768320 offset:0 fd:54
12-15 17:36:52.663: D/dalvikvm(28552): GC_FOR_ALLOC freed 3533K, 17% free 22033K/26339K, paused 13ms
12-15 17:36:52.703: D/memalloc(28552): ion: Mapped buffer base:0x5e2d1000 size:3768320 offset:0 fd:64
12-15 17:36:54.174: D/dalvikvm(28552): GC_CONCURRENT freed 557K, 9% free 24190K/26339K, paused 1ms+3ms
12-15 17:36:54.225: D/dalvikvm(28552): GC_FOR_ALLOC freed 577K, 8% free 26392K/28387K, paused 15ms
12-15 17:36:54.265: D/dalvikvm(28552): GC_FOR_ALLOC freed 502K, 7% free 28892K/30947K, paused 15ms
12-15 17:36:54.295: D/dalvikvm(28552): GC_FOR_ALLOC freed 500K, 7% free 30892K/32995K, paused 15ms
12-15 17:36:54.345: D/dalvikvm(28552): GC_FOR_ALLOC freed 1001K, 8% free 34394K/37091K, paused 21ms
12-15 17:36:54.425: D/dalvikvm(28552): GC_FOR_ALLOC freed 1001K, 7% free 38895K/41699K, paused 28ms
12-15 17:36:54.485: D/dalvikvm(28552): GC_FOR_ALLOC freed 1001K, 7% free 42896K/45795K, paused 18ms
12-15 17:36:54.535: D/dalvikvm(28552): GC_FOR_ALLOC freed 1001K, 7% free 46898K/49891K, paused 15ms
12-15 17:36:54.545: V/MediaPlayer(28552): constructor
12-15 17:36:54.545: V/MediaPlayer(28552): setListener
12-15 17:36:54.545: V/MediaPlayer(28552): setDataSource(49, 20974933, 217100)
12-15 17:36:54.565: V/MediaPlayer(28552): setVideoSurfaceTexture
12-15 17:36:54.565: V/MediaPlayer(28552): prepare
12-15 17:36:54.565: V/MediaPlayer(28552): message received msg=5, ext1=0, ext2=0
12-15 17:36:54.565: V/MediaPlayer(28552): New video size 0 x 0
12-15 17:36:54.565: V/MediaPlayer(28552): callback application
12-15 17:36:54.565: V/MediaPlayer(28552): back from callback
12-15 17:36:54.565: V/MediaPlayer(28552): message received msg=1, ext1=0, ext2=0
12-15 17:36:54.565: V/MediaPlayer(28552): prepared
12-15 17:36:54.565: V/MediaPlayer(28552): signal application thread
12-15 17:36:54.565: V/MediaPlayer(28552): callback application
12-15 17:36:54.565: V/MediaPlayer(28552): back from callback
12-15 17:36:54.565: V/MediaPlayer(28552): prepare complete - status=0
12-15 17:36:54.565: V/MediaPlayer(28552): start
12-15 17:36:54.575: E/MediaPlayer(28552): mOnVideoSizeChangedListener is null. Failed to send MEDIA_SET_VIDEO_SIZE message.
12-15 17:36:54.575: I/MediaPlayer(28552): Don't send intent. msg.arg1 = 0, msg.arg2 = 0
12-15 17:36:54.575: E/MediaPlayer(28552): mOnPreparedListener is null. Failed to send MEDIA_PREPARED message.
12-15 17:36:54.605: D/memalloc(28552): ion: Mapped buffer base:0x5d609000 size:3768320 offset:0 fd:51
12-15 17:36:55.826: D/memalloc(28552): ion: Mapped buffer base:0x5dba1000 size:3768320 offset:0 fd:58
12-15 17:36:55.866: D/memalloc(28552): ion: Mapped buffer base:0x5df39000 size:3768320 offset:0 fd:64
12-15 17:36:55.916: D/memalloc(28552): ion: Mapped buffer base:0x5e2d1000 size:3768320 offset:0 fd:70
12-15 17:36:56.167: V/MediaPlayer(28552): stop
12-15 17:36:56.357: W/MediaPlayer-JNI(28552): MediaPlayer finalized without being released
12-15 17:36:56.357: V/MediaPlayer(28552): setListener
12-15 17:36:56.357: V/MediaPlayer(28552): disconnect
12-15 17:36:56.367: V/MediaPlayer(28552): destructor
12-15 17:36:56.367: V/MediaPlayer(28552): disconnect
12-15 17:36:56.367: D/dalvikvm(28552): GC_FOR_ALLOC freed 1018K, 6% free 50943K/53987K, paused 18ms
12-15 17:36:56.417: D/dalvikvm(28552): GC_FOR_ALLOC freed 25044K, 47% free 30901K/58083K, paused 15ms
12-15 17:36:56.457: D/dalvikvm(28552): GC_FOR_ALLOC freed 1001K, 40% free 34902K/58083K, paused 16ms
12-15 17:36:56.537: D/dalvikvm(28552): GC_CONCURRENT freed 1001K, 30% free 40904K/58083K, paused 1ms+6ms
12-15 17:36:56.597: D/dalvikvm(28552): GC_FOR_ALLOC freed 1501K, 23% free 44905K/58083K, paused 15ms
12-15 17:36:56.617: V/MediaPlayer(28552): constructor
12-15 17:36:56.617: V/MediaPlayer(28552): setListener
12-15 17:36:56.617: V/MediaPlayer(28552): setDataSource(49, 17037044, 211255)
12-15 17:36:56.627: V/MediaPlayer(28552): setVideoSurfaceTexture
12-15 17:36:56.627: V/MediaPlayer(28552): prepare
12-15 17:36:56.627: V/MediaPlayer(28552): message received msg=5, ext1=0, ext2=0
12-15 17:36:56.627: V/MediaPlayer(28552): New video size 0 x 0
12-15 17:36:56.627: V/MediaPlayer(28552): callback application
12-15 17:36:56.627: V/MediaPlayer(28552): back from callback
12-15 17:36:56.627: V/MediaPlayer(28552): message received msg=1, ext1=0, ext2=0
12-15 17:36:56.627: V/MediaPlayer(28552): prepared
12-15 17:36:56.627: V/MediaPlayer(28552): signal application thread
12-15 17:36:56.627: V/MediaPlayer(28552): callback application
12-15 17:36:56.627: V/MediaPlayer(28552): back from callback
12-15 17:36:56.627: V/MediaPlayer(28552): prepare complete - status=0
12-15 17:36:56.627: V/MediaPlayer(28552): start
12-15 17:36:56.637: E/MediaPlayer(28552): mOnVideoSizeChangedListener is null. Failed to send MEDIA_SET_VIDEO_SIZE message.
12-15 17:36:56.637: I/MediaPlayer(28552): Don't send intent. msg.arg1 = 0, msg.arg2 = 0
12-15 17:36:56.637: E/MediaPlayer(28552): mOnPreparedListener is null. Failed to send MEDIA_PREPARED message.
12-15 17:36:56.657: D/memalloc(28552): ion: Mapped buffer base:0x5d609000 size:3768320 offset:0 fd:51
12-15 17:36:57.478: D/memalloc(28552): ion: Mapped buffer base:0x5dba1000 size:3768320 offset:0 fd:58
12-15 17:36:57.738: V/MediaPlayer(28552): stop
12-15 17:36:57.878: D/dalvikvm(28552): GC_FOR_ALLOC freed 1515K, 14% free 50456K/58083K, paused 16ms
12-15 17:36:57.908: D/dalvikvm(28552): GC_FOR_ALLOC freed 506K, 9% free 52951K/58083K, paused 17ms
12-15 17:36:57.948: D/dalvikvm(28552): GC_FOR_ALLOC freed 500K, 9% free 54951K/60131K, paused 16ms
12-15 17:36:57.979: D/dalvikvm(28552): GC_FOR_ALLOC freed 500K, 9% free 56952K/62179K, paused 16ms
12-15 17:36:58.019: I/dalvikvm-heap(28552): Clamp target GC heap from 65.421MB to 64.000MB
12-15 17:36:58.019: D/dalvikvm(28552): GC_FOR_ALLOC freed 500K, 9% free 58952K/64227K, paused 16ms
12-15 17:36:58.019: I/dalvikvm-heap(28552): Forcing collection of SoftReferences for 2048016-byte allocation
12-15 17:36:58.049: I/dalvikvm-heap(28552): Clamp target GC heap from 65.414MB to 64.000MB
12-15 17:36:58.049: D/dalvikvm(28552): GC_BEFORE_OOM freed 9K, 9% free 58942K/64227K, paused 27ms
12-15 17:36:58.049: E/dalvikvm-heap(28552): Out of memory on a 2048016-byte allocation.
12-15 17:36:58.049: I/dalvikvm(28552): "main" prio=5 tid=1 RUNNABLE
12-15 17:36:58.049: I/dalvikvm(28552): | group="main" sCount=0 dsCount=0 obj=0x40c5ccd0 self=0x15d0f60
12-15 17:36:58.049: I/dalvikvm(28552): | sysTid=28552 nice=0 sched=0/0 cgrp=default handle=1075107208
12-15 17:36:58.049: I/dalvikvm(28552): | schedstat=( 0 0 0 ) utm=99 stm=31 core=0
12-15 17:36:58.049: I/dalvikvm(28552): at android.graphics.Bitmap.nativeCreate(Native Method)
12-15 17:36:58.049: I/dalvikvm(28552): at android.graphics.Bitmap.createBitmap(Bitmap.java:605)
12-15 17:36:58.049: I/dalvikvm(28552): at android.graphics.Bitmap.createBitmap(Bitmap.java:551)
12-15 17:36:58.049: I/dalvikvm(28552): at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:437)
12-15 17:36:58.049: I/dalvikvm(28552): at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:618)
12-15 17:36:58.049: I/dalvikvm(28552): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:593)
12-15 17:36:58.049: I/dalvikvm(28552): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:445)
12-15 17:36:58.049: I/dalvikvm(28552): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:775)
12-15 17:36:58.049: I/dalvikvm(28552): at android.content.res.Resources.loadDrawable(Resources.java:1968)
12-15 17:36:58.049: I/dalvikvm(28552): at android.content.res.Resources.getDrawable(Resources.java:677)
12-15 17:36:58.049: I/dalvikvm(28552): at android.graphics.drawable.LevelListDrawable.inflate(LevelListDrawable.java:127)
12-15 17:36:58.049: I/dalvikvm(28552): at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:869)
12-15 17:36:58.049: I/dalvikvm(28552): at android.graphics.drawable.Drawable.createFromXml(Drawable.java:806)
12-15 17:36:58.049: I/dalvikvm(28552): at android.content.res.Resources.loadDrawable(Resources.java:1953)
12-15 17:36:58.049: I/dalvikvm(28552): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
12-15 17:36:58.049: I/dalvikvm(28552): at android.widget.ImageView.<init>(ImageView.java:119)
12-15 17:36:58.049: I/dalvikvm(28552): at android.widget.ImageView.<init>(ImageView.java:109)
12-15 17:36:58.049: I/dalvikvm(28552): at java.lang.reflect.Constructor.constructNative(Native Method)
12-15 17:36:58.049: I/dalvikvm(28552): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
12-15 17:36:58.049: I/dalvikvm(28552): at android.view.LayoutInflater.createView(LayoutInflater.java:586)
12-15 17:36:58.049: I/dalvikvm(28552): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
12-15 17:36:58.049: I/dalvikvm(28552): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:653)
12-15 17:36:58.049: I/dalvikvm(28552): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:678)
12-15 17:36:58.049: I/dalvikvm(28552): at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
12-15 17:36:58.049: I/dalvikvm(28552): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
12-15 17:36:58.049: I/dalvikvm(28552): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
12-15 17:36:58.049: I/dalvikvm(28552): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
12-15 17:36:58.049: I/dalvikvm(28552): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:278)
12-15 17:36:58.049: I/dalvikvm(28552): at android.app.Activity.setContentView(Activity.java:1835)
12-15 17:36:58.049: I/dalvikvm(28552): at com.fun2draw.Collection1Char1.onCreate(Collection1Char1.java:39)
12-15 17:36:58.049: I/dalvikvm(28552): at android.app.Activity.performCreate(Activity.java:4470)
12-15 17:36:58.049: I/dalvikvm(28552): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053)
12-15 17:36:58.049: I/dalvikvm(28552): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934)
12-15 17:36:58.049: I/dalvikvm(28552): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)
12-15 17:36:58.049: I/dalvikvm(28552): at android.app.ActivityThread.access$600(ActivityThread.java:128)
12-15 17:36:58.049: I/dalvikvm(28552): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
12-15 17:36:58.049: I/dalvikvm(28552): at android.os.Handler.dispatchMessage(Handler.java:99)
12-15 17:36:58.059: I/dalvikvm(28552): at android.os.Looper.loop(Looper.java:137)
12-15 17:36:58.059: I/dalvikvm(28552): at android.app.ActivityThread.main(ActivityThread.java:4517)
12-15 17:36:58.059: I/dalvikvm(28552): at java.lang.reflect.Method.invokeNative(Native Method)
12-15 17:36:58.059: I/dalvikvm(28552): at java.lang.reflect.Method.invoke(Method.java:511)
12-15 17:36:58.059: I/dalvikvm(28552): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980)
12-15 17:36:58.059: I/dalvikvm(28552): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747)
12-15 17:36:58.059: I/dalvikvm(28552): at dalvik.system.NativeStart.main(Native Method)
12-15 17:36:58.059: D/AndroidRuntime(28552): Shutting down VM
12-15 17:36:58.059: W/dalvikvm(28552): threadid=1: thread exiting with uncaught exception (group=0x40c5ba68)
12-15 17:36:58.069: E/AndroidRuntime(28552): FATAL EXCEPTION: main
12-15 17:36:58.069: E/AndroidRuntime(28552): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.fun2draw/com.fun2draw.Collection1Char1}: android.view.InflateException: Binary XML file line #133: Error inflating class <unknown>
12-15 17:36:58.069: E/AndroidRuntime(28552): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1970)
12-15 17:36:58.069: E/AndroidRuntime(28552): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)
12-15 17:36:58.069: E/AndroidRuntime(28552): at android.app.ActivityThread.access$600(ActivityThread.java:128)
12-15 17:36:58.069: E/AndroidRuntime(28552): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
12-15 17:36:58.069: E/AndroidRuntime(28552): at android.os.Handler.dispatchMessage(Handler.java:99)
12-15 17:36:58.069: E/AndroidRuntime(28552): at android.os.Looper.loop(Looper.java:137)
12-15 17:36:58.069: E/AndroidRuntime(28552): at android.app.ActivityThread.main(ActivityThread.java:4517)
12-15 17:36:58.069: E/AndroidRuntime(28552): at java.lang.reflect.Method.invokeNative(Native Method)
12-15 17:36:58.069: E/AndroidRuntime(28552): at java.lang.reflect.Method.invoke(Method.java:511)
12-15 17:36:58.069: E/AndroidRuntime(28552): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980)
12-15 17:36:58.069: E/AndroidRuntime(28552): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747)
12-15 17:36:58.069: E/AndroidRuntime(28552): at dalvik.system.NativeStart.main(Native Method)
12-15 17:36:58.069: E/AndroidRuntime(28552): Caused by: android.view.InflateException: Binary XML file line #133: Error inflating class <unknown>
12-15 17:36:58.069: E/AndroidRuntime(28552): at android.view.LayoutInflater.createView(LayoutInflater.java:606)
12-15 17:36:58.069: E/AndroidRuntime(28552): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
12-15 17:36:58.069: E/AndroidRuntime(28552): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:653)
12-15 17:36:58.069: E/AndroidRuntime(28552): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:678)
12-15 17:36:58.069: E/AndroidRuntime(28552): at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
12-15 17:36:58.069: E/AndroidRuntime(28552): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
12-15 17:36:58.069: E/AndroidRuntime(28552): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
12-15 17:36:58.069: E/AndroidRuntime(28552): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
12-15 17:36:58.069: E/AndroidRuntime(28552): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:278)
12-15 17:36:58.069: E/AndroidRuntime(28552): at android.app.Activity.setContentView(Activity.java:1835)
12-15 17:36:58.069: E/AndroidRuntime(28552): at com.fun2draw.Collection1Char1.onCreate(Collection1Char1.java:39)
12-15 17:36:58.069: E/AndroidRuntime(28552): at android.app.Activity.performCreate(Activity.java:4470)
12-15 17:36:58.069: E/AndroidRuntime(28552): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053)
12-15 17:36:58.069: E/AndroidRuntime(28552): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934)
12-15 17:36:58.069: E/AndroidRuntime(28552): ... 11 more
12-15 17:36:58.069: E/AndroidRuntime(28552): Caused by: java.lang.reflect.InvocationTargetException
12-15 17:36:58.069: E/AndroidRuntime(28552): at java.lang.reflect.Constructor.constructNative(Native Method)
12-15 17:36:58.069: E/AndroidRuntime(28552): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
12-15 17:36:58.069: E/AndroidRuntime(28552): at android.view.LayoutInflater.createView(LayoutInflater.java:586)
12-15 17:36:58.069: E/AndroidRuntime(28552): ... 24 more
12-15 17:36:58.069: E/AndroidRuntime(28552): Caused by: java.lang.OutOfMemoryError
12-15 17:36:58.069: E/AndroidRuntime(28552): at android.graphics.Bitmap.nativeCreate(Native Method)
12-15 17:36:58.069: E/AndroidRuntime(28552): at android.graphics.Bitmap.createBitmap(Bitmap.java:605)
12-15 17:36:58.069: E/AndroidRuntime(28552): at android.graphics.Bitmap.createBitmap(Bitmap.java:551)
12-15 17:36:58.069: E/AndroidRuntime(28552): at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:437)
12-15 17:36:58.069: E/AndroidRuntime(28552): at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:618)
12-15 17:36:58.069: E/AndroidRuntime(28552): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:593)
12-15 17:36:58.069: E/AndroidRuntime(28552): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:445)
12-15 17:36:58.069: E/AndroidRuntime(28552): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:775)
12-15 17:36:58.069: E/AndroidRuntime(28552): at android.content.res.Resources.loadDrawable(Resources.java:1968)
12-15 17:36:58.069: E/AndroidRuntime(28552): at android.content.res.Resources.getDrawable(Resources.java:677)
12-15 17:36:58.069: E/AndroidRuntime(28552): at android.graphics.drawable.LevelListDrawable.inflate(LevelListDrawable.java:127)
12-15 17:36:58.069: E/AndroidRuntime(28552): at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:869)
12-15 17:36:58.069: E/AndroidRuntime(28552): at android.graphics.drawable.Drawable.createFromXml(Drawable.java:806)
12-15 17:36:58.069: E/AndroidRuntime(28552): at android.content.res.Resources.loadDrawable(Resources.java:1953)
12-15 17:36:58.069: E/AndroidRuntime(28552): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
12-15 17:36:58.069: E/AndroidRuntime(28552): at android.widget.ImageView.<init>(ImageView.java:119)
12-15 17:36:58.069: E/AndroidRuntime(28552): at android.widget.ImageView.<init>(ImageView.java:109)
12-15 17:36:58.069: E/AndroidRuntime(28552): ... 27 more
12-15 17:37:09.571: I/Process(28552): Sending signal. PID: 28552 SIG: 9
最佳答案
看起来您的 collection1Char1 Activity 中存在某种内存压力。您应该等待几秒钟,然后再启动下一个 Activity ,让系统有时间恢复资源。
关于Android Eclipse - 单击多个按钮会使我的应用程序快速崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13897953/
我最近在/ drawable中添加了一些.gifs,以便可以将它们与按钮一起使用。这个工作正常(没有错误)。现在,当我重建/运行我的应用程序时,出现以下错误: Error: Gradle: Execu
Android 中有返回内部存储数据路径的方法吗? 我有 2 部 Android 智能手机(Samsung s2 和 s7 edge),我在其中安装了一个应用程序。我想使用位于这条路径中的 sqlit
这个问题在这里已经有了答案: What's the difference between "?android:" and "@android:" in an android layout xml f
我只想知道 android 开发手机、android 普通手机和 android root 手机之间的实际区别。 我们不能从实体店或除 android marketplace 以外的其他地方购买开发手
自Gradle更新以来,我正在努力使这个项目达到标准。这是一个团队项目,它使用的是android-apt插件。我已经进行了必要的语法更改(编译->实现和apt->注释处理器),但是编译器仍在告诉我存在
我是android和kotlin的新手,所以请原谅要解决的一个非常简单的问题! 我已经使用导航体系结构组件创建了一个基本应用程序,使用了底部的导航栏和三个导航选项。每个导航选项都指向一个专用片段,该片
我目前正在使用 Facebook official SDK for Android . 我现在正在使用高级示例应用程序,但我不知道如何让它获取应用程序墙/流/状态而不是登录的用户。 这可能吗?在那种情
我在下载文件时遇到问题, 我可以在模拟器中下载文件,但无法在手机上使用。我已经定义了上网和写入 SD 卡的权限。 我在服务器上有一个 doc 文件,如果用户单击下载。它下载文件。这在模拟器中工作正常但
这个问题在这里已经有了答案: What is the difference between gravity and layout_gravity in Android? (22 个答案) 关闭 9
任何人都可以告诉我什么是 android 缓存和应用程序缓存,因为当我们谈论缓存清理应用程序时,它的作用是,缓存清理概念是清理应用程序缓存还是像内存管理一样主存储、RAM、缓存是不同的并且据我所知,缓
假设应用程序 Foo 和 Eggs 在同一台 Android 设备上。任一应用程序都可以获取设备上所有应用程序的列表。一个应用程序是否有可能知道另一个应用程序是否已经运行以及运行了多长时间? 最佳答案
我有点困惑,我只看到了从 android 到 pc 或者从 android 到 pc 的例子。我需要制作一个从两部手机 (android) 连接的 android 应用程序进行视频聊天。我在想,我知道
用于使用 Android 以编程方式锁定屏幕。我从 Stackoverflow 之前关于此的问题中得到了一些好主意,并且我做得很好,但是当我运行该代码时,没有异常和错误。而且,屏幕没有锁定。请在这段代
文档说: android:layout_alignParentStart If true, makes the start edge of this view match the start edge
我不知道这两个属性和高度之间的区别。 以一个TextView为例,如果我将它的layout_width设置为wrap_content,并将它的width设置为50 dip,会发生什么情况? 最佳答案
这两个属性有什么关系?如果我有 android:noHistory="true",那么有 android:finishOnTaskLaunch="true" 有什么意义吗? 最佳答案 假设您的应用中有
我是新手,正在尝试理解以下 XML 代码: 查看 developer.android.com 上的文档,它说“starStyle”是 R.attr 中的常量, public static final
在下面的代码中,为什么当我设置时单选按钮的外观会发生变化 android:layout_width="fill_parent" 和 android:width="fill_parent" 我说的是
很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visit the help center . 关闭 9
假设我有一个函数 fun myFunction(name:String, email:String){},当我调用这个函数时 myFunction('Ali', 'ali@test.com ') 如何
我是一名优秀的程序员,十分优秀!