Wednesday, August 8, 2012

Re: [android-developers] open content on click of button

hey parthi, thanks but actually i look forward for where to pass , if u have sample code do share else see the below code is used to achieve is this right , now can you suggest if i have loaded another layout how can i come back to the previous one or the main one , i am now trying with the back button can u suggest.

public class MainActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    
        final Button button = (Button) findViewById(R.id.button1);
        button.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                // Perform action on click
           
            setContentView(R.layout.aboutus);
            }
        });

        final Button buttonhome = (Button) findViewById(R.id.button1);
        buttonhome.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                // Perform action on click
           
            setContentView(R.layout.main);
            }
        });
    }
 
 }

On Wednesday, 8 August 2012 19:18:05 UTC+5:30, parthi wrote:

Hi 
pankajdev,       just pass onclicklistener
use getId values...
and pass resources layout...


On Wed, Aug 8, 2012 at 6:48 PM, pankajdev <panka...@gmail.com> wrote:
Hi , 

i am new to this forums , i have tried a sample android application using MOTODEV studio , i am not able to find few things , like how to setup the action for the button and if i setup an action how do i open the layout while i click over the button , i am having six button ,now i want if i click over one button it should load the layout or should be send to next screen to display content.

Please guide with example or same code so that learning is easy.

with regards

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-d...@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment