Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJennifer Chance
Courses Plus Student 1,424 PointsOnly showing 10 blogpost not 20!!
When i run the application its only showing 10 blog post instead of 20 like in the video. I'm Using Android Studio for this project. All of my source code is exact as the video tutorial Here is my logcat below. anyhelp would be awesome! Thanks
10-14 12:22:41.529 19863-19880/com.jerdeez.blogreader E/MainListActivity﹕ Exception caught:
org.json.JSONException: No value for posts
at org.json.JSONObject.get(JSONObject.java:354)
at org.json.JSONObject.getJSONArray(JSONObject.java:544)
at com.jerdeez.blogreader.MainListActivity$GetBlogPostsTask.doInBackground(MainListActivity.java:94)
at com.jerdeez.blogreader.MainListActivity$GetBlogPostsTask.doInBackground(MainListActivity.java:67)
at android.os.AsyncTask$2.call(AsyncTask.java:287)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
at java.util.concurrent.FutureTask.run(FutureTask.java:137)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)
10-14 12:23:25.329 19939-19939/com.jerdeez.blogreader I/Adreno200-EGLSUB﹕ <ConfigWindowMatch:2087>: Format RGBA_8888.
10-14 12:23:25.419 19939-19939/com.jerdeez.blogreader I/Choreographer﹕ Skipped 32 frames! The application may be doing too much work on its main thread.
10-14 12:23:26.149 19939-19954/com.jerdeez.blogreader V/MainListActivity﹕ ok
10-14 12:23:26.149 19939-19954/com.jerdeez.blogreader V/MainListActivity﹕ posts 0: Cutting-Edge CSS Features You Can Use Today
10-14 12:23:26.149 19939-19954/com.jerdeez.blogreader V/MainListActivity﹕ posts 1: After Just 6 Months Learning Nick is a full-time Web Developer
10-14 12:23:26.149 19939-19954/com.jerdeez.blogreader V/MainListActivity﹕ posts 2: Making a Network Request in Swift
10-14 12:23:26.149 19939-19954/com.jerdeez.blogreader V/MainListActivity﹕ posts 3: New Course: WordPress Theme Development
10-14 12:23:26.149 19939-19954/com.jerdeez.blogreader V/MainListActivity﹕ posts 4: How to Install Node.js and NPM on a Mac
10-14 12:23:26.149 19939-19954/com.jerdeez.blogreader V/MainListActivity﹕ posts 5: Device Mockups
10-14 12:23:26.149 19939-19954/com.jerdeez.blogreader V/MainListActivity﹕ posts 6: Tips to Get Your Child Coding
10-14 12:23:26.149 19939-19954/com.jerdeez.blogreader V/MainListActivity﹕ posts 7: Fun at the Treehouse Company Meet-up 2014
10-14 12:23:26.149 19939-19954/com.jerdeez.blogreader V/MainListActivity﹕ posts 8: New Course: Moving to WordPress.org
10-14 12:23:26.149 19939-19954/com.jerdeez.blogreader V/MainListActivity﹕ posts 9: How to Launch a Mobile App
10-14 12:23:26.149 19939-19954/com.jerdeez.blogreader I/MainListActivity﹕ Code: 200
10-14 12:24:35.969 19939-19939/com.jerdeez.blogreader W/IInputConnectionWrapper﹕ getSelectedText on inactive InputConnection
10-14 12:24:35.969 19939-19939/com.jerdeez.blogreader W/IInputConnectionWrapper﹕ setComposingText on inactive InputConnection
10-14 12:45:46.489 19939-19939/com.jerdeez.blogreader E/SpannableStringBuilder﹕ SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
10-14 12:45:46.489 19939-19939/com.jerdeez.blogreader E/SpannableStringBuilder﹕ SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
2 Answers
Afik Paryente
2,042 PointsURL blogFeedUrl = new URL("http://blog.teamtreehouse.com/api/get_recent_summary/?count=" + NUMBER_OF_POSTS); This should work for sure.
Jennifer Chance
Courses Plus Student 1,424 PointsAfik,
Thanks you are awesome!!! It is working now. I had a space between symbols (count =")
as shown below.
Before with space
URL blogFeedUrl = new URL("http://blog.teamtreehouse.com/api/get_recent_summary/?count =" + NUMBER_OF_POSTS);
No space
("http://blog.teamtreehouse.com/api/get_recent_summary/?count=" + NUMBER_OF_POSTS);
New logcat
10-14 18:32:44.959 2901-2911/com.jerdeez.blogreader V/MainListActivity﹕ ok
10-14 18:32:44.969 2901-2911/com.jerdeez.blogreader V/MainListActivity﹕ posts 0: Responsive Charts
10-14 18:32:44.969 2901-2911/com.jerdeez.blogreader V/MainListActivity﹕ posts 1: Cutting-Edge CSS Features You Can Use Today
10-14 18:32:44.969 2901-2911/com.jerdeez.blogreader V/MainListActivity﹕ posts 2: After Just 6 Months Learning Nick is a full-time Web Developer
10-14 18:32:44.969 2901-2911/com.jerdeez.blogreader V/MainListActivity﹕ posts 3: Making a Network Request in Swift
10-14 18:32:44.969 2901-2911/com.jerdeez.blogreader V/MainListActivity﹕ posts 4: New Course: WordPress Theme Development
10-14 18:32:44.969 2901-2911/com.jerdeez.blogreader V/MainListActivity﹕ posts 5: How to Install Node.js and NPM on a Mac
10-14 18:32:44.969 2901-2911/com.jerdeez.blogreader V/MainListActivity﹕ posts 6: Device Mockups
10-14 18:32:44.969 2901-2911/com.jerdeez.blogreader V/MainListActivity﹕ posts 7: Tips to Get Your Child Coding
10-14 18:32:44.969 2901-2911/com.jerdeez.blogreader V/MainListActivity﹕ posts 8: Fun at the Treehouse Company Meet-up 2014
10-14 18:32:44.969 2901-2911/com.jerdeez.blogreader V/MainListActivity﹕ posts 9: New Course: Moving to WordPress.org
10-14 18:32:44.969 2901-2911/com.jerdeez.blogreader V/MainListActivity﹕ posts 10: How to Launch a Mobile App
10-14 18:32:44.969 2901-2911/com.jerdeez.blogreader V/MainListActivity﹕ posts 11: Why We Decided to Take a Paycut
10-14 18:32:44.969 2901-2911/com.jerdeez.blogreader V/MainListActivity﹕ posts 12: Interview: Type Designer Mattox Shuler
10-14 18:32:44.969 2901-2911/com.jerdeez.blogreader V/MainListActivity﹕ posts 13: How to Install Laravel Homestead on Windows
10-14 18:32:44.969 2901-2911/com.jerdeez.blogreader V/MainListActivity﹕ posts 14: Do You Have a Favorite Treehouse Teacher?
10-14 18:32:44.969 2901-2911/com.jerdeez.blogreader V/MainListActivity﹕ posts 15: CSS Triggers
10-14 18:32:44.969 2901-2911/com.jerdeez.blogreader V/MainListActivity﹕ posts 16: New Course: Object-Orientated Python
10-14 18:32:44.969 2901-2911/com.jerdeez.blogreader V/MainListActivity﹕ posts 17: New Course: Publishing an Android App
10-14 18:32:44.969 2901-2911/com.jerdeez.blogreader V/MainListActivity﹕ posts 18: Learning Swift vs Objective-C
10-14 18:32:44.969 2901-2911/com.jerdeez.blogreader V/MainListActivity﹕ posts 19: New Course: Modular CSS with Sass
10-14 18:32:44.969 2901-2911/com.jerdeez.blogreader I/MainListActivity﹕ Code: 200
Gloria Dwomoh
13,116 PointsYour URL is wrong kind of you have missed the "="... try
new URL("http://blog.teamtreehouse.com/api/get_recent_summary/?count=" //add the rest here
Jennifer Chance
Courses Plus Student 1,424 PointsGloria
I added the symbols =" but still only showing 0-9.
Thanks
Gloria Dwomoh
13,116 PointsDoes it give you the same error?
Jennifer Chance
Courses Plus Student 1,424 PointsJennifer Chance
Courses Plus Student 1,424 PointsHere is my source code.