• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

An error occurred while executing doInBackground()  RSS feed

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello i am following Udacity android data storage course.But just hit the wall. We are making pets app in witch user can add,update and delete a pet. In one segment we had to use floating button,and with intent go to another activity, from Catalog Activity to Edit ACtivity. But when i click on floating buton got an error:An error occurred while executing doInBackground() .I do not use AsyncTask doInBackground() method,but understand that my Loader using a AsyncTask class.I also fnd that problem might be that i am trying to display something on doInBackground(). I can't do any GUI work on a background thread,i get this.but i didn't use doInBackground() method directly si how can i change something that i haven't use?I simply don't konow how to fix this

CatalogActivity:

my logcat:
FATAL EXCEPTION: ModernAsyncTask #2
                                                                         Process: com.example.android.pets, PID: 24569
                                                                         java.lang.RuntimeException: An error occurred while executing doInBackground()
                                                                             at android.support.v4.content.ModernAsyncTask$3.done(ModernAsyncTask.java:143)
                                                                             at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
                                                                             at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
                                                                             at java.util.concurrent.FutureTask.run(FutureTask.java:271)
                                                                             at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
                                                                             at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
                                                                             at java.lang.Thread.run(Thread.java:764)
                                                                          Caused by: java.lang.NullPointerException: uri
                                                                             at com.android.internal.util.Preconditions.checkNotNull(Preconditions.java:128)
                                                                             at android.content.ContentResolver.query(ContentResolver.java:787)
                                                                             at android.content.ContentResolver.query(ContentResolver.java:753)
                                                                             at android.support.v4.content.ContentResolverCompatJellybean.query(ContentResolverCompatJellybean.java:29)
                                                                             at android.support.v4.content.ContentResolverCompat$ContentResolverCompatImplJB.query(ContentResolverCompat.java:57)
                                                                             at android.support.v4.content.ContentResolverCompat.query(ContentResolverCompat.java:125)
                                                                             at android.support.v4.content.CursorLoader.loadInBackground(CursorLoader.java:59)
                                                                             at android.support.v4.content.CursorLoader.loadInBackground(CursorLoader.java:37)
                                                                             at android.support.v4.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:296)
                                                                             at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:54)
                                                                             at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:42)
                                                                             at android.support.v4.content.ModernAsyncTask$2.call(ModernAsyncTask.java:128)
                                                                             at java.util.concurrent.FutureTask.run(FutureTask.java:266)
 
Ranch Hand
Posts: 201
2
Android Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this
 
Milos Gojic
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Randy Tong wrote:Try this



I already have this lines of code on line 61
 
Randy Tong
Ranch Hand
Posts: 201
2
Android Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, you don't have getApplication() in front.
 
Milos Gojic
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Randy Tong wrote:No, you don't have getApplication() in front.



Sry,you are right but i added this and the same problem persist. Maybe problem is in my provider class,but can't rememer changing anyhing in it.
thanks for effort
 
Randy Tong
Ranch Hand
Posts: 201
2
Android Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which tutorial you are referring ?
 
Milos Gojic
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Randy Tong wrote:Which tutorial you are referring ?


Udacity android data storage

Udacity data storage
 
You have to be odd to be #1 - Seuss. An odd little ad:
Create Edit Print & Convert PDF Using Free API with Java
https://coderanch.com/wiki/703735/Create-Convert-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!