So I have a snippet of code where I create a textView on a user's click on a button. Since it was created after runtime I'm unsure what the ID is. But what I'm trying to do is have the option of deleting the last textView that is added and also clear all of the TextViews that were added. Thank you
private TextView createNewTextView(String text)
{
ArraySize++;
final LinearLayout mLayout=findViewById(R.id.linearLayout);
String newLine=System.getProperty("line.separator");
final LinearLayout.LayoutParams lparams =new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
ViewGroup.LayoutParams params=(RelativeLayout.LayoutParams) mLayout.getLayoutParams();
final TextView textView=new TextView(this);
textView.setLayoutParams(lparams);
textView.setText("New texT:: "+text+newLine);
listOfNames.add(text);
return textView;
}