changes in main.xml are not reflected in the android app in netbeans

Posted by nitish712 on Stack Overflow See other posts from Stack Overflow or by nitish712
Published on 2012-10-09T09:30:10Z Indexed on 2012/10/09 9:37 UTC
Read the original article Hit count: 121

Filed under:
|

I am new to android apps. I am using the netbeans 7.0.1 IDE to develop android apps. I have written the following code in the main java file:

package com.test.helloworld;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;


public class helloworld extends Activity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
     TextView t1=new TextView(this);
    t1.setText("hello world..!!!!");
    setContentView(t1);
}

}

This was working fine. I edited the main.xml file to display a textfield and button as follows:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"

>
    <Button  
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/button_send"/>

    <EditText android:id="@+id/edit_message"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:hint="@string/edit_message"/>

</LinearLayout> 

Of course I have added all the corresponding strings in strings.xml. But when I try to run my app these weren't displaying... :( . I mean the same string that was displayed previously was being displayed.

Can anybody figure out what is the mistake? thanx...

© Stack Overflow or respective owner

Related posts about android

Related posts about netbeans-7