Issue
I'm new to Android and I'm following the Big Nerd Ranch Guide. In the book we are creating a ViewPager to be able to swipe between list-details. For some reason Android Studio doesn't recognise the ViewPager. Look below for the code.
import android.app.Activity;
import android.os.Bundle;
import android.view.ViewPager;
public class CrimePagerActivity extends Activity {
private ViewPager mViewPager;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
}
I don't know what to do or what could be wrong? Has this something to do with the Android SDK?
Solution
Make sure you have downloaded the Android Support Repository using the SDK Manager.
Open the build.gradle file and Add the support library to the dependencies section:
compile 'com.android.support:support-v4:23.0.1'
change your import to this:
import android.support.v4.view.ViewPager;
Answered By - Milad Nouri
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.