Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8459163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:15:56+00:00 2026-06-10T13:15:56+00:00

In android app development wanted to create a EditText from java code without using

  • 0

In android app development wanted to create a EditText from java code without using XML,
So i wrote this

 import android.os.Bundle;
    import android.app.Activity;
    import android.view.Menu;
    import android.widget.EditText;
    public class MainActivity extends Activity {
        private static final String initMess="Hello Arun";
        private static final int VISIBLE = 0;
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            EditText editText = new EditText(this);
            editText.setText(initMess.toString());
            editText.setVisibility(VISIBLE);
        }

        @Override
        public boolean onCreateOptionsMenu(Menu menu) {
            getMenuInflater().inflate(R.menu.activity_main, menu);
            return true;
        }
    }

But while running the app in emulator EditText was not visible.

How to create an EditText using java only ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T13:15:57+00:00Added an answer on June 10, 2026 at 1:15 pm
    ScrollView sv = new ScrollView(this);
    
    LinearLayout ll = new LinearLayout(this);
    
    ll.setOrientation(LinearLayout.VERTICAL);
    sv.addView(ll);
    
    EditText et = new EditText(this);
    
    et.setText("weeeeeeeeeee~!");
    
    ll.addView(et);
    
    
    this.setContentView(sv);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to android app development. this is my xml layout file. <?xml
Ok, so I just recently got into this Android app development using Eclipse for
I am pretty new to android app development and java and I encountered the
I am trying to learn Android app development and wrote a very simple app
I'm currently stuck with using Atom CPU desktop for my Android app development. What
I've got some basic Java experience and very basic Android app development experience (currently
I have been using Eclipse to compile and run my development Android app. Now
In Android Development, I can simply start another Android App with data from my
For my android app development, I am trying to get logcat messages from my
I am trying to learn android app development .I am using IntelliJ Idea 10.When

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.