0

当我尝试在具有 android 版本 4 的平板电脑上运行我的应用程序时,它将无法正常工作并在 log cat 中出现此错误

07-04 13:16:28.029: E/AndroidRuntime(688): FATAL EXCEPTION: Thread-94
07-04 13:16:28.029: E/AndroidRuntime(688): java.lang.UnsupportedOperationException
07-04 13:16:28.029: E/AndroidRuntime(688):  at java.lang.Thread.stop(Thread.java:1076)
07-04 13:16:28.029: E/AndroidRuntime(688):  at java.lang.Thread.stop(Thread.java:1063)
07-04 13:16:28.029: E/AndroidRuntime(688):  at com.henanet.dalel.SplashScreen$1.run(SplashScreen.java:48)
07-04 13:16:28.499: I/dalvikvm(688): threadid=3: reacting to signal 3
07-04 13:16:29.121: D/dalvikvm(688): GC_FOR_ALLOC freed 680K, 13% free 6869K/7815K, paused 408ms
07-04 13:16:29.139: E/dalvikvm(688): Unable to open stack trace file '/data/anr/traces.txt': Is a directory
07-04 13:16:29.139: I/dalvikvm(688): threadid=3: reacting to signal 3
07-04 13:16:29.370: E/dalvikvm(688): Unable to open stack trace file '/data/anr/traces.txt': Is a directory
07-04 13:16:30.569: D/dalvikvm(688): GC_CONCURRENT freed 262K, 11% free 7016K/7815K, paused 3ms+4ms
07-04 13:16:31.900: W/dalvikvm(688): threadid=13: thread exiting with uncaught exception (group=0x409c01f8)
07-04 13:16:31.900: I/Process(688): Sending signal. PID: 688 SIG: 9

如您所见,这个 Splash.java 非常简单,请告诉我如何使图像适合平板电脑

公共类 SplashScreen 扩展 Activity {

//how long until we go to the next activity
protected int _splashTime = 5000; 

private Thread splashTread;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.splash);

    final SplashScreen sPlashScreen = this; 

    // thread for displaying the SplashScreen
    splashTread = new Thread() {
        @Override
        public void run() {
            try {
                synchronized(this){

                        //wait 5 sec
                        wait(_splashTime);
                }

            } catch(InterruptedException e) {}
            finally {
                finish();

                //start a new activity
                Intent i = new Intent();
                i.setClass(sPlashScreen, MainActivity.class);
                        startActivity(i);

                stop();
            }
        }
    };

    splashTread.start();
}

//Function that will handle the touch
@Override
public boolean onTouchEvent(MotionEvent event) {
    if (event.getAction() == MotionEvent.ACTION_DOWN) {
        synchronized(splashTread){
                splashTread.notifyAll();
        }
    }
    return true;
}

}

4

1 回答 1

0

在合适的可绘制文件夹中找不到启动画面图像。

用于 7 英寸平板电脑的 drawable-large-mdpi 或 hdpi 文件夹。

用于 10 英寸平板电脑的 drawable-xlarge-mdpi 或 hdpi 文件夹。

使用正确的图像。

并签入清单文件中的标签

<supports-screens
        android:anyDensity="true"
        android:largeScreens="true"
        android:normalScreens="true"
        android:smallScreens="true"
        android:xlargeScreens="true" />
于 2013-07-04T10:27:36.863 回答