Hi,

 Put the line "setContentView(R.layout.main); " after line
"super.onCreate(savedInstanceState);"

On May 26, 6:15 am, Somebodyconfused <til...@jcs.k12.oh.us> wrote:
> All,
> I'm trying to get the following code to work. It should just be a
> textview with a listview underneath it. What is going wrong?
>
> MAIN.xml
>
> <?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"
>     >
> <TextView
>     android:layout_width="fill_parent"
>     android:layout_height="wrap_content"
>     android:text="@string/hello"
>     />
>   <ListView android:id="@+id/lista"
>         android:layout_width="wrap_content"
>         android:layout_height="wrap_content"/>
>     </LinearLayout>
>
> public class TestApp extends Activity {
>     /** Called when the activity is first created. */
>
>         @Override
>     public void onCreate(Bundle savedInstanceState) {
>         super.onCreate(savedInstanceState);
>         TextView meh = new TextView(this);
>         ListView ls = (ListView) findViewById(R.id.lista);
>         String[] COUNTRIES = {"Afghanistan", "Albania", "Algeria"};
>         meh.setText("HI THERE");
>         setContentView(R.layout.main);
>         ls.setAdapter(new
> ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,
> COUNTRIES));
>
>     }

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to