how can i create dynamic variables in a function using a functions parameter?

i created this app fully functional as a web app (js). Its time to convert to java. my java understanding is minimal so please, explain answers as you would a 5th grader ;). Squint your eyes at the myfunction function, then at the abutton2 click listener. Then look at all the media player calls. The Dilemma is apparent. Without drastic changes i would like to learn to replace all media player variables to be created (inside the function) using the first parameter in myFunction. so “a” would create mediaplayer as, mediaplayer aw1, mediaplayer aw2, etc. and respectively call the R.raw.a, R.raw.aw1, R.raw.aw2 respectively.
This would help also to eliminate all the other parameters i’ve set so the 3rd and 4th parameters could be dynamically created so “a” would also create bpage, and bs. of course the b would be created dynamically by moving to the next character in the alphabet. now inside the myFunction, rightsound.start() would be replaced with ar.start which was created dynamically with the string “a” parameter.

public class StartActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.startpage);

        Button startbutton = findViewById(R.id.StartButton);

        ImageView aimg = findViewById(R.id.Aimg);
        Button abutton1 = findViewById(R.id.AButton1);
        Button abutton2 = findViewById(R.id.AButton2);
        Button abutton3 = findViewById(R.id.AButton3);

        ImageView bimg = findViewById(R.id.Bimg);
        Button bbutton1 = findViewById(R.id.BButton1);
        Button bbutton2 = findViewById(R.id.BButton2);
        Button bbutton3 = findViewById(R.id.BButton3);


        RelativeLayout startpage = findViewById(R.id.StartContainer);
        LinearLayout apage = findViewById(R.id.AContainer);
        LinearLayout bpage = findViewById(R.id.BContainer);

        MediaPlayer as = MediaPlayer.create(getApplicationContext(),R.raw.a);
        MediaPlayer aw1 = MediaPlayer.create(getApplicationContext(),R.raw.aw1);
        MediaPlayer aw2 = MediaPlayer.create(getApplicationContext(),R.raw.aw2);
        MediaPlayer ar = MediaPlayer.create(getApplicationContext(),R.raw.ar);

        MediaPlayer bs = MediaPlayer.create(getApplicationContext(),R.raw.b);
        MediaPlayer bw1 = MediaPlayer.create(getApplicationContext(),R.raw.bw1);
        MediaPlayer bw2 = MediaPlayer.create(getApplicationContext(),R.raw.bw2);
        MediaPlayer br = MediaPlayer.create(getApplicationContext(),R.raw.br);

        aimg.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v){
                as.start();
            }
        });
        abutton1.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v){
                aw1.start();
            }
        });
        abutton2.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v){
                myFunction("a", ar, apage, bpage, bs);
            }
        });
        abutton3.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v){
                aw2.start();
            }
        });


        bimg.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v){
                bs.start();
            }
        });
        bbutton1.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v){
                bw1.start();
            }
        });
        bbutton2.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v){
                bw2.start();
            }
        });
        bbutton3.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v){
                br.start();
            }
        });

        
        startbutton.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v){
                startpage.setVisibility(View.INVISIBLE);
                apage.setVisibility(View.VISIBLE);
                as.start();
            }
        });

        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
            Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
            return insets;
        });

    }
    public void myFunction(String alphabet, MediaPlayer rightsound, LinearLayout pagehide, LinearLayout pageshow, MediaPlayer nextsound){
        rightsound.start();
        new android.os.Handler(Looper.getMainLooper()).postDelayed(
                new Runnable() {
                    public void run() {
                        pagehide.setVisibility(View.INVISIBLE);
                        pageshow.setVisibility(View.VISIBLE);
                        nextsound.start();
                    }
                },
                5000);
    }
}

so if its web development, the string would just be added to static code
${param}r.start();
${param}page.setVisibility(View.Visible);
whats the equivalent here in java?

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật