i try to add an appearance animation
to my ListView
. When I search on the internet i finally found this link to start. ListView appearance demo
this is my MainActivity
and onCreateView
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fragment_main);
ArrayList<String> strings = new ArrayList<String>();
strings.add("");
strings.add("");
strings.add("");
strings.add("");
strings.add("");
strings.add("");
MyListAdapter mAdapter = new MyListAdapter(this, strings);
SwingRightInAnimationAdapter swingRightInAnimationAdapter = new SwingRightInAnimationAdapter(mAdapter);
// Assign the ListView to the AnimationAdapter and vice versa
ListView myListView = (ListView) findViewById(R.id.myListView);
swingRightInAnimationAdapter.setAbsListView(myListView);
myListView.setAdapter(swingRightInAnimationAdapter);
}
But when i launch this simple sample project an error rises with this content:
FATAL EXCEPTION: main java.lang.NoClassDefFoundError: com.nineoldandroids.animation.Animator[]
I download the jar lib and use it in build.gradle in android studio
repositories {
mavenCentral()}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/listviewanimations_lib-core_3.1.0.jar')}
help me if it's possible thanks
You miss the NineOldAndroids jar in your project to make this library work. You can download it here: https://github.com/JakeWharton/NineOldAndroids/downloads
And as
Joel
stated in the comments you don't need to add the jars to your compile file sincecompile fileTree(dir: 'libs', include: ['*.jar'])
takes care of that.You can also do this without any jar files. Sync in android studio with an repository like this:
You can check more dependencies to compile for this library on this page: https://github.com/nhaarman/ListViewAnimations