open new activity using android studio

Опубликовано: 24 Октябрь 2024
на канале: Fast Programming
1,342
51

open new activity using android studio #android #development #python #coding #short #easy #how

package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {
private Button button ;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
button = findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
cadeauhommepage();
}
});
}
public void cadeauhommepage(){
Intent intent = new Intent(this,cadeauHomme.class);
startActivity(intent);

}
}