I have created a table row and set its ID. Now i want to find the row so i can put a fragment inside of it. So how can i find this row? Usually when i set the Id in xml i can easily find the row by R.id.tableRow1 . But since i set it programmatically this doesnt work. This is my code:
TableRow tr1 = new TableRow(myView.getContext());
tr1.setId(1);
ChildFragmentIntro cfi = new ChildFragmentIntro();
FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.add(tr1.getId(), cfi); //This is where it goes wrong, tr1.getId()
transaction.commit();
Im i setting the id in a wrong way or is tr1.getId() the wrong method to retrieve it? If i do it in XML i.e. create a table row in the layout, set its id with the usual @+id/xxx, and use transaction.add(R.id.xxx, cfi); than it works fine. But now i want to do it programmatically.