开发者

Android Code Enhancement

I am having a Common "Signin" page that contains "Username" and "Password" Field..

And i am having two Tab Bars namely 1. Deals 2.Account..and user can login through either Deals or Account..

If i login from Deals after successful login the pa开发者_如何学JAVAge must be redirected to the Deals page and if Login in account page after succesful login the page must be redirected to Account page.

The logic i used is simply "FLAG CONCEPT"..

If user Login in Deals page i set initial "flag_deal=0" to say "flag_deal=1".. and in SignIn page i will check

       if(flag_deal==1){
          flag_deal=0;
           Redirect to Deal page..
       }else{
           Redirect to Account Page..
       }

Now its works properly, I want to know that whether this way of writing Coding is Efficient or any way available to handle such a situation..

Please suggest me better alternative if you people knows..

Thanks in Advance..


The logic is nothing wrong, and too simple to harm efficiency.

But why you reset the flag "flag_deal=0" after entering the if branch? you may use this afterward.

I think all you should do is to carefully manage this flag variable.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜