I want to populate a ListView based on two tables, one called category and the other subcategory, and I would like it to look something like this:
When I typed a Category name in EditText and clicked the Add button, I added it to the category table and it already appeared dynamically as a table item, and when I clicked the button to add a subcategory open a dialog to enter a Subcategory name and then, when I clicked a button to add it, I inserted it into the subcategory table and dynamically appeared below the related category.
OnCreate of the CategoryActivity
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_categoria_list);
CategoriaDAO categoria = new CategoriaDAO(this);
List<Categoria> list = categoria.getLista();
ListView listView = (ListView) findViewById(android.R.id.list);
listView.setAdapter(new CategoriaAdapter(this, list, listView));
}