开发者

if the IF statement is true view new activity

开发者 https://www.devze.com 2023-03-20 02:06 出处:网络
if(res.equals(\"5510\")) checkback.setText(\"Correct version\"); // else 开发者_如何学JAVAcheckback.setText(\"Incorrect version, please update. \\n Your current version is \" + getString(R.string.vers
                   if(res.equals("5510"))
                    checkback.setText("Correct version");
               //
                else
                    开发者_如何学JAVAcheckback.setText("Incorrect version, please update. \n Your current version is " + getString(R.string.versioncode)); 

How do i get it so that if the IF statement is true then it'll start and view mainactivity.class?

I put intent in but when i did it showed up with a bunch of errors


Try this, but replace "CurrentActivity.this" with the name of the activity your calling it from.

if(res.equals("5510")){
    checkback.setText("Correct version");
    Intent i = new Intent(CurrentActiviy.this, mainactivity.class);
        startActivity(i);
}else{
    checkback.setText("Incorrect version, please update. \n Your current version is " + getString(R.string.versioncode));
}

If you still get errors then post the errors you get - it makes it a million times easier to work out where the issue is!

0

精彩评论

暂无评论...
验证码 换一张
取 消