I am trying to pass an object to an activity through Intent, and as I'm debugging, I noticed that apparently I never even get into the onCreate()
method of the activity. Even though the activity starts, I have the layout and everything, I don't get a chance to debug, because the breakpoint inside the onCreate()
method is never reached. How is this possible, what am I not understanding here? Help :)
listView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
String selection = itemsArray[groupPosition][childPosition];
Class calc = null;
switch (selection) {
case "Calc1":
calc = Calc1.class;
break;
case "Calc2":
calc = Calc2.class;
break;
}
Intent intent = new Intent(Main.this, calc);
intent.putExtra("controller", getController());
startActivity(intent);
return false;
}
});
The activity is started on a OnChildClick event, the object I'm trying to pass is the controller (returned by getController()
method)
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.calc1);
controller = (Controller) getIntent().getSerializableExtra("controller");
setController(controller);
editA = (EditText) findViewById(R.id.editA);
editB = (EditText) findViewById(R.id.editB);
}
This is the onCreate()
, I set the breakpoint at setContentView()
, and like I said, apparently I never get there... I feel like I'm missing something here.
Btw. I'm brand new to android ;)
Thanks for reading!