• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to avoid app from crashed when no image is inserted?  RSS feed

 
Ranch Foreman
Posts: 463
3
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wonder how to avoid the app from crashing if no image is inserted into SQLite ?

In Activity B, there has one save button, one open camera button and imageView.

save button used to return the image to A, open camera button used for user to select picture and imageView placed the selected image.

In Activity A , it has a submit button, used to save the image which was returned from B to SQLite.


Activity B




Activity A



LogCat Error




The logCat shows that I didn't insert any image to SQLite. How can I write an if-else condition so that the app will not crashed when no image is inserted ?


StaffAP




Thanks

 
Ranch Foreman
Posts: 3129
37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check for whether there is an image (that is, is it null).
What you do at that point if it is is something you will have to decide.
 
John Joe
Ranch Foreman
Posts: 463
3
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Dave Tolls wrote:Check for whether there is an image (that is, is it null).
What you do at that point if it is is something you will have to decide.



If I have select an image, it will not crashed. If not, it will crashed. So I have to make
an if-else statement?
 
Saloon Keeper
Posts: 4084
98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes.
 
John Joe
Ranch Foreman
Posts: 463
3
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!