r/AndroidQuestions•
KX4IT

Trying to make a pre-filled text box appear. No luck

I am making a simple hello world app and want to find out what I'm doing wrong here, every time I view the app in the emulator it just shows "large text" instead of the text I want in there where I positioned it. Here's the code. Thanks

package d.d.d;

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

public class TestActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ImageView image = (ImageView) findViewById(R.id.test_image);

    setContentView(R.layout.main);
    TextView text =(TextView)findViewById(R.id.textView1);


    
    
}

}

XML:::

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" >

<TextView
    android:id="@+id/textView1"
    android:layout_width="fill_parent"
    android:layout_height="85dp"
    android:text="What's up Jay? I don't know what to put here! AHHHHHHHH!!!"
    android:textAppearance="?android:attr/textAppearanceLarge" />

<ImageView android:id="@+id/test_image" android:src="@drawable/starrynight" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" />

</LinearLayout>

Posted Jun 23, 2012, 11:49 PM UTC

21
Loading comments…