0

I have download this custom datepicker: https://github.com/flavienlaurent/datetimepicker

I'm new to Eclipse and Android.

How should I use this?

When I import, I get an error at res folder. https://i.stack.imgur.com/Dh7df.jpg

Please help me. Sorry for asking a noob question.

Thanks

Szymon
  • 42,577
  • 16
  • 96
  • 114
Caal Saal VI
  • 192
  • 2
  • 12

2 Answers2

1

I've imported the datepicker to my Eclipse and I can to build it without any error.

Have you downloaded all the necessary Android SDK files using the Android SDK Manager? I see your 'MainActivity' is having compile error too.

Edit: From the errors, seems like the attributes buttonBarStyle were only defined starting in API Level 11.

There are a few ways to solve this.

1) Set your app and the library project minSdkVersion in AndroidManifest.xml file to "11", this will make your app not be able to use on older Android versions though.

2) Move this particular layout file to res/layout-v11/ folder, and create another version of the same layout file in res/layout folder, but doesn't use the buttonBarStyle.

3) Seems like there's a way to create a attr.xml file in res/layout, and define the attributes manually. I have not tried it personally though you might want to try.. refer to error: Error: No resource found that matches the given name: attr 'buttonBarButtonStyle'

Good luck

Edit2: Changing android:minSdkVersion="11" and android:targetSdkVersion="17" in your datetimepicker AndroidManifest.xml file should work! From your screenshot, I saw that it doesn't recognize "HONEYCOMB", seems like your ADT version is not the latest, please try update it to the latest first. After that right click your datetimepicker-library project in Eclipse, click 'Properties', then go to 'Android' tab, you should see API 15 or above checked, for mine I have API 17 checked as shown here https://i.stack.imgur.com/3vMk2.png I think your eclipse is not configured properly

Community
  • 1
  • 1
Bruce
  • 2,357
  • 5
  • 29
  • 50
  • File > New > Project... > Android Project from Existing Code, then browse to datetimepicker and check 'Copy projects into workspace' What errors are you getting in the res folder? – Bruce Nov 03 '13 at 02:04
  • Still no luck . I already found them and tested them all . still fail . sigh – Caal Saal VI Nov 03 '13 at 13:01
  • Please read this post and follow the advice.. should work: http://stackoverflow.com/questions/14297309/android-button-bar-in-holo – Bruce Nov 03 '13 at 13:08
  • Updated my answer with more info. Remember to mark as answer if it works for you :) – Bruce Nov 03 '13 at 13:25
  • But how do you fix the error at MainActivity ? Its about import error . Sorry i really noob to this – Caal Saal VI Nov 03 '13 at 14:29
  • Have you added datetimepicker library in your MainActivity project? Right click your MainActivity project > Properties > Android > under 'Library' section click 'Add' and add your datetimepicker. – Bruce Nov 10 '13 at 08:33
  • I'm done with this project , thanks for your effort :) may god bless u – Caal Saal VI Nov 11 '13 at 15:34
  • Cheers, if you're new to android and eclipse, you may want to go through the official getting started tutorials, they are very useful: http://developer.android.com/training/index.html – Bruce Nov 11 '13 at 23:57
0

Just ran in the same problem. In order to use this library make sure that:

  • Datetimepicker-library references NineOld Androids
  • Project properties, Java build path, Libraries contains android-support-v4 and order and export has this jar checked
  • Project properties, Android, project target build is set to API 19 for example

The last one was causing most of the problems. If you set it to a higher target build, that does not mean that it will not run on lower API levels.

peterkodermac
  • 318
  • 5
  • 13