I did everything as in the book. Here that in gradle app
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.xverizex.criminalintent"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildToolsVersion '26.0.2'
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
}
activity_fragment.xml
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
lscodex
December 12, 2017, 5:30pm
2
what is the logcat output?
2-13 07:55:02.948 5729-5729/? I/art: Late-enabling -Xcheck:jni
12-13 07:55:04.589 5729-5729/com.example.xverizex.criminalintent I/InstantRun: starting instant run server: is main process
12-13 07:55:04.910 5729-5747/com.example.xverizex.criminalintent W/art: Suspending all threads took: 5.859ms
12-13 07:55:04.910 5729-5747/com.example.xverizex.criminalintent I/art: Background sticky concurrent mark sweep GC freed 1862(130KB) AllocSpace objects, 0(0B) LOS objects, 8% free, 558KB/607KB, paused 7.019ms total 241.790ms
12-13 07:55:05.150 5729-5729/com.example.xverizex.criminalintent W/art: Verification of android.support.v4.app.FragmentManagerImpl$AnimationOrAnimator android.support.v4.app.FragmentManagerImpl.loadAnimation(android.support.v4.app.Fragment, int, boolean, int) took 113.037ms
12-13 07:55:05.180 5729-5747/com.example.xverizex.criminalintent W/art: Suspending all threads took: 251.220ms
12-13 07:55:05.190 5729-5747/com.example.xverizex.criminalintent I/art: Background partial concurrent mark sweep GC freed 158(32KB) AllocSpace objects, 0(0B) LOS objects, 45% free, 612KB/1124KB, paused 252.532ms total 270.904ms
12-13 07:55:05.320 5729-5729/com.example.xverizex.criminalintent V/Activity: calling onCraete for activity: com.example.xverizex.criminalintent
12-13 07:55:05.500 5729-5729/com.example.xverizex.criminalintent W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
12-13 07:55:06.131 5729-5747/com.example.xverizex.criminalintent I/art: Background sticky concurrent mark sweep GC freed 1240(178KB) AllocSpace objects, 0(0B) LOS objects, 19% free, 1209KB/1510KB, paused 10.498ms total 26.275ms
12-13 07:55:06.161 5729-5729/com.example.xverizex.criminalintent V/Activity: calling onResume for activity: com.example.xverizex.criminalintent
12-13 07:55:06.201 5729-5782/com.example.xverizex.criminalintent D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: false
12-13 07:55:06.221 5729-5729/com.example.xverizex.criminalintent D/Atlas: Validating map...
12-13 07:55:06.341 5729-5782/com.example.xverizex.criminalintent I/OpenGLRenderer: Initialized EGL, version 1.4
12-13 07:55:06.341 5729-5782/com.example.xverizex.criminalintent D/OpenGLRenderer: Enabling debug mode 0
12-13 07:55:07.022 5729-5747/com.example.xverizex.criminalintent W/art: Suspending all threads took: 138.275ms
12-13 07:55:07.082 5729-5747/com.example.xverizex.criminalintent I/art: Background sticky concurrent mark sweep GC freed 450(105KB) AllocSpace objects, 0(0B) LOS objects, 14% free, 1293KB/1510KB, paused 199.279ms total 646.057ms
12-13 07:55:07.092 5729-5729/com.example.xverizex.criminalintent W/art: Before Android 4.1, method int android.support.v7.widget.ListViewCompat.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView
12-13 07:55:07.232 5729-5729/com.example.xverizex.criminalintent W/art: Verification of void android.support.v7.view.SupportMenuInflater.inflate(int, android.view.Menu) took 106.353ms
12-13 07:55:07.232 5729-5747/com.example.xverizex.criminalintent W/art: Suspending all threads took: 107.482ms
12-13 07:55:07.232 5729-5747/com.example.xverizex.criminalintent I/art: Background partial concurrent mark sweep GC freed 179(23KB) AllocSpace objects, 0(0B) LOS objects, 27% free, 1321KB/1833KB, paused 108.917ms total 152.069ms
12-13 07:55:07.242 5729-5729/com.example.xverizex.criminalintent I/Choreographer: Skipped 44 frames! The application may be doing too much work on its main thread.
lscodex
December 15, 2017, 6:37am
4
I think, no error in your logcat. So, make sure you called correct fragment in the activity or you can check values that coming to the Recyclerview (Maybe the list is null).And I think, you can check setContenview() too. Because of, You have to be sure to call correct xml.file ( layout).
I already know what the problem is. It was in the definition oncreate, it was necessary from the appcompat
I have the same issue. What do you mean by it was the definition oncreate?
This is actually way off base.