应用程序不适用于平板电脑

时间:2013-07-04 10:22:42

标签: android tablet

当我尝试在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;
}

}

1 个答案:

答案 0 :(得分: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" />