programatically add editText. Is this code ok ?

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

programatically add editText. Is this code ok ?

Postby aneuryzma » Wed Jan 13, 2010 8:16 pm

hi,

I want to programmatically add an editText field only if it doesn't already exist. This code works, but I was wondering if it is correct, or should I implement it differently...

//input area
if (editText==null) {

editText = new EditText(this);
editText.setInputType(InputType.TYPE_TEXT_FLAG_MULTI_LINE);
editText.setText("tag...");
layMain.addView(editText);

}

thanks
aneuryzma
Developer
Developer
 
Posts: 28
Joined: Wed Jan 06, 2010 10:46 am

Top

Postby aneuryzma » Wed Jan 13, 2010 8:22 pm

I have another question: how can I add editText before the button I've previously created ?

thanks
aneuryzma
Developer
Developer
 
Posts: 28
Joined: Wed Jan 06, 2010 10:46 am

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 6 guests