0

Description:

I have a register screen. In order to make it easier for inputting info , I'm planing to renewal this screen by decrease input field. I also want to collect user feedback by doing A/B test. Therefore , I have to keep current register screen and make new one.

I suppose the current register screen has 10 input fields.
And a new one I will make has 4 input fields + a little change about style.

Confusing:

So,I'm wondering about the best way implementation:

  • Should I use same RegisterActivity and just separate XML layout ?
  • Or I will make a new Activity like RenewalRegisterActivity ( of course new XML layout is created ?

Project structure looks like that :
Case 1:

RegisterActivity.kt   
    regsiter_activity.xml  
    renewal_register_activity.xml

Case 2:

RegsiterActivity.kt  
    register_activity.xml

RenewalRegsiterActivity.kt  
    renewal_register_activity.xml
Bulma
  • 990
  • 3
  • 16
  • 35

1 Answers1

-1

use same xml file.

but if you intent put some validation. for example

    abtn= findViewById(R.id.abtn);
    abtn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(Main.this, a.class);
            intent.putExtra("xmltype",1);
            startActivity(intent);

        }
    });

    bBTN= findViewById(R.id.bBTN);
    bBTN.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(Main.this, a.class);
            intent.putExtra("xmltype",2);
            startActivity(intent);

In you a.class:

Bundle extras = getIntent().getExtras();
if(extras != null){
    xmltype= extras.getInt("xmltype",-1);
    System.out.println("ticketType::::"+xmltype);
}
if(xmltype== 1){
  //show all fields
  //hide all feilds that dont needed by using Fields.SetVisibility(View.GOne)
}else{
              //show all fields
  //hide all feilds that dont needed by using Fields.SetVisibility(View.GOne)
}
jhayjhay
  • 78
  • 8