what is wrong with this use of goto?

  

I’m using a goto statement to skip a piece of code (as per documentation), just for testing purposes while I debug a block of code. I’m getting an error 1526, “goto into protected scope”. This is totally trivial I know, but I want to know what is wrong with how I’m using the goto code:

#if defined(_PLAT_ANDROID)
_di_JIntent MyIntent;
MyIntent = TJIntent::JavaClass->init(TJIntent::JavaClass->ACTION_VIEW,
TJnet_Uri::JavaClass->parse(StringToJString(“http://relayman.org/papers/2009_FDA_paper.pdf”)));
TAndroidHelper::Activity->startActivity(MyIntent);

goto Skipit;
Androidapi::Jni::Graphicscontentviewtext::_di_JIntent intent = TJIntent::Create();
intent->setDataAndType(StringToJString(“file://” + System::Ioutils::TPath::Combine(System::Ioutils::TPath::GetSharedDownloadsPath(), “sample.pdf”)), StringToJString(L”application/pdf”));
intent->setAction(TJIntent::JavaClass->ACTION_VIEW);
intent->setFlags(TJIntent::JavaClass->FLAG_GRANT_READ_URI_PERMISSION);
if (SharedActivity()->getPackageManager()->queryIntentActivities(intent, TJPackageManager::JavaClass->MATCH_DEFAULT_ONLY)->size() > 0) {
SharedActivity()->startActivity(intent);
} else {
ShowMessage(“PDF viewer not found”);
}
Skipit:
#endif

I’m working in 10.3.2 and building toward Android target.

Comments are closed.