Hi I need help to know where to put these code
button = (Button) findViewById(R.id.button3);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(Splash.this, Gallery.class));
}
});
on my android studio code.
Here is my Android studio Code:
public class Splash extends AppCompatActivity {
private Button button;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
Thread logoTimer = new Thread() {
public void run() {
try {
int logoTimer = 0;
while (logoTimer < 3000) {
sleep(100);
logoTimer = logoTimer + 100;
}
;
startActivity(new Intent(Splash.this, MainActivity.class));
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
finish();
}
}
};
logoTimer.start();
}
}
I tried putting the code after the codes for the splash screen but it ain't working, I also tried putting it before the code for the splash screen but my app ain't running. There is no error found but the app when I play it on the AVD, the app is not running (My App)