And how can I call a non-void arguments activity? Is there a way to do
that? (i.e. select an item from a ListView and pass that as argument
to the new Action).

Thanks

On Jul 23, 6:32 am, janardhan <vuruvakilina...@gmail.com> wrote:
> package com.elegos.test;
>
> import android.app.Activity;
> import android.os.Bundle;
> import android.view.View;
> import android.view.View.OnClickListener;
> import android.widget.Button;
> import android.widget.TextView;
>
> public class ListViewTest extends Activity {
>     /** Called when the activity is first created. */
>     @Override
>     public void onCreate(Bundle savedInstanceState) {
>         super.onCreate(savedInstanceState);
>         setContentView(R.layout.main);
>
>         TextView myText = (TextView)findViewById(R.id.myTextView);
>
>         Button nextButton = (Button)findViewById(R.id.ButtonNext);
>
> nextButton.setOnClickListener(new Button.OnClickListener() {
>         public void onClick (View v){
>                 Intent nextIntent=new Intent
> (ListViewTes.this,ExmpActivity.class);
> startActivity(nextIntent);
>
> });
> }}
>
> U will create another activity by name ExmpActivity as follows
>
> package com.elegos.test;
>
> import android.app.Activity;
> import android.os.Bundle;
> import android.view.View;
> import android.view.View.OnClickListener;
> import android.widget.Button;
> import android.widget.TextView;
>
> public class  ExmpActivity extends Activity {
>     /** Called when the activity is first created. */
>     @Override
>     public void onCreate(Bundle savedInstanceState) {
>         super.onCreate(savedInstanceState);
>         setContentView(R.layout.xyz);
>   Button backButton = (Button)findViewById(R.id.ButtonBack);
> backButton.setOnClickListener(new Button.OnClickListener() {
>         public void onClick (View v){
>                 Intent backIntent=new Intent
> (ExmpActivity.this,ListViewTes.class);
> startActivity(backIntent);
>
> });
> }
> }
>
> On Jul 22, 2:27 pm, elegos <furlan.giac...@gmail.com> wrote:
>
> > Hello there!
>
> > I'm a newbie in Android programming, and was exploring the possibility
> > to switch between more than - one - layouts (i.e. more pages?).
>
> > So I've created a new XML layout page (called second.xml) and created
> > some things in there. At least I've created a button to switch back to
> > the first layout, but a NullPointerException fires up when the
> > application starts, and that only for the "back" button, while the
> > "next" button just works great.
>
> > Any suggestion?
> > Thanks :)
>
> > package com.elegos.test;
>
> > import android.app.Activity;
> > import android.os.Bundle;
> > import android.view.View;
> > import android.view.View.OnClickListener;
> > import android.widget.Button;
> > import android.widget.TextView;
>
> > public class ListViewTest extends Activity {
> >     /** Called when the activity is first created. */
> >     @Override
> >     public void onCreate(Bundle savedInstanceState) {
> >         super.onCreate(savedInstanceState);
> >         setContentView(R.layout.main);
>
> >         TextView myText = (TextView)findViewById(R.id.myTextView);
>
> >         Button nextButton = (Button)findViewById(R.id.ButtonNext);
> >         Button backButton = (Button)findViewById(R.id.ButtonBack);
>
> >         nextButton.setOnClickListener(getCListener(R.layout.second));
> >         try {backButton.setOnClickListener(getCListener
> > (R.layout.main));} catch(Exception e) {myText.append("\n"+e.toString
> > ());}
> >     }
>
> >     final private OnClickListener getCListener(final int layout) {
> >         return new Button.OnClickListener() {
> >                 public void onClick(View v) {
> >                         setContentView(layout);
> >                 }
> >         };
> >     }
>
> > }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to