• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Activity's Context Problem

 
Hardik Trivedi
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, All genius people

Following is the code which sholud show the circle on screen whenever user touches the screen.
The code for drawing circle is running perfectly that I have tested.



9th line is drawing circle.
But when I touches the screen Exception is fired. and a message is flashed Application stopped unexpectedly"

Exception comes on

The context is coming null.

Please HELP
 
Monu Tripathi
Rancher
Posts: 1369
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any specific reason as to why are you passing a reference of parent Activity in the constructor of the Circle class?
 
Hardik Trivedi
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Monu Tripathi wrote:Any specific reason as to why are you passing a reference of parent Activity in the constructor of the Circle class?



It is mentioned in the tutorial. That is the only reason.I do not know anything more than this.
If you have any solution other then this please post it.
 
Monu Tripathi
Rancher
Posts: 1369
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
check if passing DrawShapes.this helps.
 
Hardik Trivedi
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Monu Tripathi wrote:check if passing DrawShapes.this helps.

Working thanks a lot . Monu
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic