Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DatePicker does not work when trying to use it [duplicate]

Possible Duplicate:
Android CalendarView class cannot be found

I tried putting a Date Picker in my layout but instead of the DatePicker it only shows: DatePicker

and this error: The following classes could not be found: - DatePicker (Change to android.widget.DatePicker, Fix Build Path, Edit XML) I don't know what this is because I already have a DatePicker in my app and it works fine just don't know why this one now isn't working.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:ignore="HardcodedText" >

    <TextView
        android:id="@+id/tvNomeR"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="" />

    <TextView
        android:id="@+id/tvDataR"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="" />

    <TextView
        android:id="@+id/textView3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="" />

    <TextView
        android:id="@+id/tvMensagemR"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="" />

    <DatePicker
        android:id="@+id/datePicker1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <Button
            android:id="@+id/bAdiarR" 
            android:layout_width="0dp" 
            android:layout_height="wrap_content" 
            android:layout_weight="1" 
            android:text="Adiar" />

        <Button
            android:id="@+id/bResponderR"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="Responder" />

    </LinearLayout >

</LinearLayout>
like image 787
baTimá Avatar asked Oct 17 '12 20:10

baTimá


2 Answers

I see what you are talking about in the Graphical Layout, but this won't affect your app. This error simply means Eclipse cannot build a preview of DatePicker for your layout. I bet if you run your app it will display just fine.

screenshot

like image 148
Sam Avatar answered Oct 11 '22 14:10

Sam


(As answered in this similar question)

You should change the api eclipse uses to graphically display your layout. You do this in the graphic view, in the top right, with the button that has the android logo. API 16 might give some problems, so try switching to 15 or 14 instead. (It will take a bit of time to load and refresh)

like image 22
Niels Avatar answered Oct 11 '22 14:10

Niels