*> Do this*
*> Intent myIntent = new Intent(androidGallery.this, helloAndroid.class);
*
*> startActivity(myIntent);*

I may be wrong but I think that your suggestion and the method already being
used are logically equivalent.

If just using startActivity without qualifiers doesn't work:
Force close problems always have more information in the logcat output.
Look at that first.  You might be able to figure it out.  If not, post the
relevant portion of the output and someone can probably help figure it out.

Thanks,
Justin
----------------------------------------------------------------------
There are only 10 types of people in the world...
Those who know binary and those who don't.
----------------------------------------------------------------------


On Mon, Dec 14, 2009 at 1:56 AM, Lynn Ooi <lynnooi....@gmail.com> wrote:

> hi,
>
> I had 2 activity (called androidGallery and HelloAndroid). i try to
> call helloAndroid from the androidGallery when user click on the
> button. basically, androidGallery is just to get the onclick event.
> The helloAndroid activity will set the text of a textview. however, i
> cant get it working. Once i click the button, a dialog box pop up
> saying that the application has been stopped unexpectedly with a force
> close button. Can anyone help me with it?
>
> androidGallery.java :
>
> package testt.android.androidgallery;
>
> import android.app.Activity;
> import android.content.Intent;
> import android.os.Bundle;
> import android.view.View;
> import android.widget.Button;
>
> public class androidGallery extends Activity {
>        private Button btnclickme;
>
>        /** 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.button_id);
>        button.setOnClickListener(new View.OnClickListener() {
>            public void onClick(View v) {
>                // Perform action on click
>                Intent myIntent = new Intent(androidGallery.this,
> helloAndroid.class);
>                androidGallery.this.startActivity(myIntent);
>            }
>        });
>
>        }
> }
>
> helloAndroid.java :
>
> package test.android.androidgallery;
>
> import java.io.BufferedInputStream;
> import java.io.InputStream;
> import java.net.URL;
> import java.net.URLConnection;
> import java.util.ArrayList;
> import java.util.List;
>
> import org.apache.http.util.ByteArrayBuffer;
>
> import android.app.Activity;
> import android.os.Bundle;
> import android.util.Log;
> import android.widget.TextView;
>
> public class helloAndroid extends Activity{
>        /** Called when the activity is first created. */
>        public void onCreate(Bundle savedInstanceState) {
>                // super.onCreate(savedInstanceState);
>                // setContentView(R.layout.main);
>                String a = "hello Lynn";
>                super.onCreate(savedInstanceState);
>                TextView tv = new TextView(this);
>                tv.setText(a);
>                setContentView(tv);
>        }
> }
>
> --
> 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<android-beginners%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/android-beginners?hl=en

-- 
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