android - Array problems - Source not found -
hey guys have got following problem:
i trying create new array code.
public class minefield { mine[][] mines; public minefield(int cols, int rows) { mines = new mine[cols][rows]; } } so when executing code runs fine of course. when add single line:
mines[0][0].setcoordinates(0,0); the debug perspective opens , gives me "activitythread.performlaunchactivity(activitythread$activityclientrecord, intent) line 2180
and text in red "source not found"
i working on android application.
but not able find out why can't call method of object out of freshly created object array? trying create 2 dimensional array of mines , giving every single mine specific coordinates.
do know solutions or alternatives, let me know!
thanks in advance!
you getting nullpointerexception because mines[0][0] null should initialize mine.
i.e
mines[0][0]=new mine(); and then
mines[0][0].setcoordinates(0,0);
Comments
Post a Comment