Answer the question
In order to leave comments, you need to log in
Why does an android app crash after adding text.setText("dgds")?
There is an application. At some point, I want to completely replace the current activity with another one. I implemented it like this:
llRepetition.removeAllViews();
tvWord_ROWW = (TextView) findViewById(R.id.tvWord_ROWW);
LayoutInflater ltInflater = getLayoutInflater();
View view = ltInflater.inflate(R.layout.activity_repetition_of_words_writing, llRepetition, true);
ViewGroup.LayoutParams lp = view.getLayoutParams();
tvWord_ROWW.setText("word");
llRepetition.addView(tvWord_ROWW);
Answer the question
In order to leave comments, you need to log in
You have null in tvWord_ROWW because you are assigning/looking for it before adding it.
In general, they don’t usually do this, it’s not very clear what you are trying to achieve with these dances. If they are different screens, use fragments. You don't replace activities, you only change views.
Use normal names: camelCase. Don't mix it with snake_case. Do not use Hungarian notation, in Java and Android this is usually not accepted.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question