Hi,

Do the setContentView before the findViewById of your different
elements.
What is the error message/ error exception raised?
NullPointerException?

I don't know why you talk about listview in the title of your message
because it seems you don't have any listview in your layout.

On Oct 4, 11:59 am, ravi sharma <rs22...@gmail.com> wrote:
> my layout is
>
> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
> android"
>       android:layout_width="fill_parent"
>       android:layout_height="wrap_content"
>         android:orientation="horizontal"
>         android:id="@+id/country_List"
>         >
>
>       <TextView android:id="@+id/year"
>           android:layout_width="wrap_content"
>                 android:layout_height="wrap_content"
>                 android:textColor="#ff000099"
>     android:background="#ffffff80"
>     android:padding="10dp"
>     android:textSize="16sp"
>     android:text="1964"/>
>
>         <TextView android:id="@+id/country"
>           android:layout_width="fill_parent"
>           android:layout_height="fill_parent"
>           android:textColor="#ffffff80"
>     android:background="#ff000099"
>     android:padding="10dp"
>     android:textSize="16sp"
>     android:text="Sweden"/>
> </LinearLayout>
>
> and i want  to change the color dynamically
>
> but applicaiton  always crashes down
>
> public View mainListLayout;
>
>         private TextView txtcountry ;
>         private TextView txtyear ;
>
>         @Override
>         public void onCreate(Bundle savedInstanceState) {
>                 super.onCreate(savedInstanceState);
>
>                 txtcountry = (TextView)findViewById(R.id.country);
>                 txtyear = (TextView)findViewById(R.id.year);
>                 mainListLayout = findViewById(R.id.country_List);
>         System.out.println("COlors are " + colStr);
>
>         mainListLayout.setBackgroundColor(Color.BLUE);
>
>         txtcountry.setTextColor(-16711936);
>                          txtyear.setTextColor(0xff00ff00);
>
>         Typeface ty = Typeface.create(fontStr, 0);
>          txtcountry.setTypeface(ty);
>          txtyear.setTypeface(ty);

-- 
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