lundi 9 avril 2018

';' Expression expected | public boolean in if else

)

[...]

else if (id == R.id.nav_videovorschlag) {

            public boolean isOnline() {
                ConnectivityManager conMgr = (ConnectivityManager) getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE);
                NetworkInfo netInfo = conMgr.getActiveNetworkInfo();

                if(netInfo == null || !netInfo.isConnected() || !netInfo.isAvailable()){
                    return false;

                    ImageButton internetok;
                    offlineDialog.setContentView(R.layout.onlinepopup);
                    internetok = (ImageButton) offlineDialog.findViewById(R.id.internetok);
                    internetok.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            offlineDialog.dismiss();
                        }
                    });
                }
                return true;

                setTitle("Videovorschlag");
                Fragment5_vorschlag fragment = new Fragment5_vorschlag();
                FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
                fragmentTransaction.replace(R.id.frag_home, fragment, "Videovorschlag");
                fragmentTransaction.commit();
            }

[...]

AndroidStudio says that there public boolean isOnline() { is an expression expected (;). But that's wrong... Can anybody help me to fix this problem... I stuck on it since one hour :-(.

Best regards

Aucun commentaire:

Enregistrer un commentaire