And what's the error the application generates?
instead of:
Using java Syntax Highlighting
if(result.getCount() > 0)
{
result.moveToFirst();
return result;
}
else
{
SwapCard s = new SwapCard();
s.showAlert("Error printing");
return null;
}
Parsed in 0.033 seconds, using
GeSHi 1.0.8.4
you should do:
Using java Syntax Highlighting
if(result.moveToFirst())
{
return result;
}
else
{
SwapCard s = new SwapCard();
s.showAlert("Error printing");
return null;
}
Parsed in 0.031 seconds, using
GeSHi 1.0.8.4
Well, you _SHOULDN'T_ do this, but as it has the same effect you are probably doing less operations (this means more speed, wooot

).
As far as my eye can see for now, I'd say there are a lot of 'bad' coding practises (well, they aren't really bad, they just cost a lot of overhead). For example: in fetchProfile() you findViewById() all views you need, which costs a lot, while you could/should do this in the onCreate, as the views don't change in you application. So you only should find them once!
2nd, I'm not sure if this is needed, but as you test against result != null, you could also start managing the cursor if it isn't null, because a null cursor never can be closed (maybe this even throws an exception).
But now I see your mistake (well the real probematic one

: in DB.fetch() you define String[] columns as {"KEY_NAME", ... wheras this should be {KEY_NAME, KEY_COMPANY, ... because you want the DB constants to be used and not the literals! This will make you fetchProfile throw as you use result.getColumnIndexOrThrow(SwapCardDB.KEY_COMPANY))) which would be working if you were defining the column names correctly. Now I think about it , the result.getColumnIndexOrThrow(SwapCardDB.KEY_COMPANY))) will not generate the exception but the mDb.query() in DB.fetch() will, because you want to fetch columns which don't exist.
I guess that if you had looked in your log, you would have see the exception and found this problem by yourself, as this would have thrown some exceptions a long the line of "column not found" or something like that.