2

I am newbie to android (on mac using eclipse). Please let me know how to create a view dynamically and add it to main view.

Context:

Actually I want to show a view of processing on the main screen when user has performed any action.

1 Answer 1

4

Assuming that your main view is a ViewGroup and you already have an instance of it the code would look something like this:

TextView textView = new TextView(getContext());
textView.setText("Processing...");
mainView.addView(textView);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.