[Solved] Creating Android UI dynamically in java code


I think you are missing the basic point here 🙁 When you want to update an already-existing layout, you shouldn’t inflate a new one. Instead, you fetch the views you want to update and put the data in them. Like this:

TextView t = myLayout.findViewById(R.id.someTextViewId);
t.setText(newlyObtainedData);

As for the Context, every activity inherits after it, so you can simply pass this.

3

solved Creating Android UI dynamically in java code