I've created one splash screen with android studio 0.1, but when I test it on my phone(nexus s) in debugging mode with usb the image isn't show.. why?
this is the MainActivity
package com.example.splash;
import android.content.Intent;
import android.os.Bundle;
import android.app.Activity;
import android.os.Handler;
import android.view.Menu;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
Handler x = new Handler();
x.postDelayed(new SplashHandler(), 7000);
}
class SplashHandler implements Runnable{
public void run(){
startActivity(new Intent(getApplication(), Main.class));
MainActivity.this.finish();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
this is Main
package com.example.splash;
import android.app.Activity;
public class Main extends Activity {
}
this is Splash.xml
< ?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent" android:background="@drawable/splash">
</LinearLayout>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…