Multiple intent depends on radio button selected









up vote
-1
down vote

favorite












It is possible to go to specific class base on what radio button selected?
And it is possible to make an if-else statement in onClick for the new intent?



For example,



Circle, Square, Triangle radio group button.
Circle has been selected.



In "onClick"
There is a if-else statement that has "circle.class", "square.class", "triangle.class"
The intent will go to "circle.class"










share|improve this question

























    up vote
    -1
    down vote

    favorite












    It is possible to go to specific class base on what radio button selected?
    And it is possible to make an if-else statement in onClick for the new intent?



    For example,



    Circle, Square, Triangle radio group button.
    Circle has been selected.



    In "onClick"
    There is a if-else statement that has "circle.class", "square.class", "triangle.class"
    The intent will go to "circle.class"










    share|improve this question























      up vote
      -1
      down vote

      favorite









      up vote
      -1
      down vote

      favorite











      It is possible to go to specific class base on what radio button selected?
      And it is possible to make an if-else statement in onClick for the new intent?



      For example,



      Circle, Square, Triangle radio group button.
      Circle has been selected.



      In "onClick"
      There is a if-else statement that has "circle.class", "square.class", "triangle.class"
      The intent will go to "circle.class"










      share|improve this question













      It is possible to go to specific class base on what radio button selected?
      And it is possible to make an if-else statement in onClick for the new intent?



      For example,



      Circle, Square, Triangle radio group button.
      Circle has been selected.



      In "onClick"
      There is a if-else statement that has "circle.class", "square.class", "triangle.class"
      The intent will go to "circle.class"







      java android if-statement






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 17 hours ago









      Skiwmish

      135




      135






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          Yes it is very much possible!
          All ya gotta do is call the mainn method of the required class(or any other method)
          If the method is static,call it directly through class reference, it it is non-static then use an object of that class(take care of the NullPointerException though)



          1)Make sure your circle or triangle(or whatever) classes are created



          Either you can :
          Under the ActionPerformed() event for jRadioButton1



           // should be the name of your button, say CircleActionPerformed() 
          private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt)


          if(jRadioButton.isSelected() == true)

          circle.main() //







          share|improve this answer




















          • By the Way, is OnClick a Button or what?
            – Siddharth Bhat
            13 hours ago










          • OnClick a button sir. I tried like this "if ("Circle".equals(radioButton.getText().toString()))" but the error "Attempt to invoke virtual method 'java.lang.CharSequence android.widget.TextView.getText()' on a null object reference at com.example.locator.myapplication.MainActivity$3.onClick(MainActivity.java:87)"
            – Skiwmish
            7 hours ago










          • Try using the isSelected()== true instead of getText().
            – Siddharth Bhat
            7 hours ago











          • Also check if your button name is correct
            – Siddharth Bhat
            7 hours ago










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53237307%2fmultiple-intent-depends-on-radio-button-selected%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote













          Yes it is very much possible!
          All ya gotta do is call the mainn method of the required class(or any other method)
          If the method is static,call it directly through class reference, it it is non-static then use an object of that class(take care of the NullPointerException though)



          1)Make sure your circle or triangle(or whatever) classes are created



          Either you can :
          Under the ActionPerformed() event for jRadioButton1



           // should be the name of your button, say CircleActionPerformed() 
          private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt)


          if(jRadioButton.isSelected() == true)

          circle.main() //







          share|improve this answer




















          • By the Way, is OnClick a Button or what?
            – Siddharth Bhat
            13 hours ago










          • OnClick a button sir. I tried like this "if ("Circle".equals(radioButton.getText().toString()))" but the error "Attempt to invoke virtual method 'java.lang.CharSequence android.widget.TextView.getText()' on a null object reference at com.example.locator.myapplication.MainActivity$3.onClick(MainActivity.java:87)"
            – Skiwmish
            7 hours ago










          • Try using the isSelected()== true instead of getText().
            – Siddharth Bhat
            7 hours ago











          • Also check if your button name is correct
            – Siddharth Bhat
            7 hours ago














          up vote
          0
          down vote













          Yes it is very much possible!
          All ya gotta do is call the mainn method of the required class(or any other method)
          If the method is static,call it directly through class reference, it it is non-static then use an object of that class(take care of the NullPointerException though)



          1)Make sure your circle or triangle(or whatever) classes are created



          Either you can :
          Under the ActionPerformed() event for jRadioButton1



           // should be the name of your button, say CircleActionPerformed() 
          private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt)


          if(jRadioButton.isSelected() == true)

          circle.main() //







          share|improve this answer




















          • By the Way, is OnClick a Button or what?
            – Siddharth Bhat
            13 hours ago










          • OnClick a button sir. I tried like this "if ("Circle".equals(radioButton.getText().toString()))" but the error "Attempt to invoke virtual method 'java.lang.CharSequence android.widget.TextView.getText()' on a null object reference at com.example.locator.myapplication.MainActivity$3.onClick(MainActivity.java:87)"
            – Skiwmish
            7 hours ago










          • Try using the isSelected()== true instead of getText().
            – Siddharth Bhat
            7 hours ago











          • Also check if your button name is correct
            – Siddharth Bhat
            7 hours ago












          up vote
          0
          down vote










          up vote
          0
          down vote









          Yes it is very much possible!
          All ya gotta do is call the mainn method of the required class(or any other method)
          If the method is static,call it directly through class reference, it it is non-static then use an object of that class(take care of the NullPointerException though)



          1)Make sure your circle or triangle(or whatever) classes are created



          Either you can :
          Under the ActionPerformed() event for jRadioButton1



           // should be the name of your button, say CircleActionPerformed() 
          private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt)


          if(jRadioButton.isSelected() == true)

          circle.main() //







          share|improve this answer












          Yes it is very much possible!
          All ya gotta do is call the mainn method of the required class(or any other method)
          If the method is static,call it directly through class reference, it it is non-static then use an object of that class(take care of the NullPointerException though)



          1)Make sure your circle or triangle(or whatever) classes are created



          Either you can :
          Under the ActionPerformed() event for jRadioButton1



           // should be the name of your button, say CircleActionPerformed() 
          private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt)


          if(jRadioButton.isSelected() == true)

          circle.main() //








          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 13 hours ago









          Siddharth Bhat

          25




          25











          • By the Way, is OnClick a Button or what?
            – Siddharth Bhat
            13 hours ago










          • OnClick a button sir. I tried like this "if ("Circle".equals(radioButton.getText().toString()))" but the error "Attempt to invoke virtual method 'java.lang.CharSequence android.widget.TextView.getText()' on a null object reference at com.example.locator.myapplication.MainActivity$3.onClick(MainActivity.java:87)"
            – Skiwmish
            7 hours ago










          • Try using the isSelected()== true instead of getText().
            – Siddharth Bhat
            7 hours ago











          • Also check if your button name is correct
            – Siddharth Bhat
            7 hours ago
















          • By the Way, is OnClick a Button or what?
            – Siddharth Bhat
            13 hours ago










          • OnClick a button sir. I tried like this "if ("Circle".equals(radioButton.getText().toString()))" but the error "Attempt to invoke virtual method 'java.lang.CharSequence android.widget.TextView.getText()' on a null object reference at com.example.locator.myapplication.MainActivity$3.onClick(MainActivity.java:87)"
            – Skiwmish
            7 hours ago










          • Try using the isSelected()== true instead of getText().
            – Siddharth Bhat
            7 hours ago











          • Also check if your button name is correct
            – Siddharth Bhat
            7 hours ago















          By the Way, is OnClick a Button or what?
          – Siddharth Bhat
          13 hours ago




          By the Way, is OnClick a Button or what?
          – Siddharth Bhat
          13 hours ago












          OnClick a button sir. I tried like this "if ("Circle".equals(radioButton.getText().toString()))" but the error "Attempt to invoke virtual method 'java.lang.CharSequence android.widget.TextView.getText()' on a null object reference at com.example.locator.myapplication.MainActivity$3.onClick(MainActivity.java:87)"
          – Skiwmish
          7 hours ago




          OnClick a button sir. I tried like this "if ("Circle".equals(radioButton.getText().toString()))" but the error "Attempt to invoke virtual method 'java.lang.CharSequence android.widget.TextView.getText()' on a null object reference at com.example.locator.myapplication.MainActivity$3.onClick(MainActivity.java:87)"
          – Skiwmish
          7 hours ago












          Try using the isSelected()== true instead of getText().
          – Siddharth Bhat
          7 hours ago





          Try using the isSelected()== true instead of getText().
          – Siddharth Bhat
          7 hours ago













          Also check if your button name is correct
          – Siddharth Bhat
          7 hours ago




          Also check if your button name is correct
          – Siddharth Bhat
          7 hours ago

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53237307%2fmultiple-intent-depends-on-radio-button-selected%23new-answer', 'question_page');

          );

          Post as a guest














































































          Popular posts from this blog

          27

          Top Tejano songwriter Luis Silva dead of heart attack at 64

          Category:Rhetoric