If my manifest looks like this:
 <activity android:name=".PageTwo"

                  android:label="@string/app_name" >
            <intent-filter>
                <action android:name=".PageTwo" />
                <category android:name="android.intent.category.DEFAULT" />

            </intent-filter>
        </activity>

I would create the intent like this (Bundle not required):
Bundle b = new Bundle();
                            b = new Bundle();
                            Intent i = new Intent();
                            b.putString("Some data","data for this
activity");
                            i = new Intent(".PageTwo");
                            i.putExtras(b);
                            startActivityForResult(i, ACTIVITY_CREATE);

Somewhere in your PageTwo Activity, I would expect to see:

                            setResult(RESULT_OK, i);  // where I is an
intent containing a bundle of data.  of just setResult(RESULT_OK) or
setResult(RESULT_CANCEL)
                            finish();

Somewhere in the calling activity, I would expect to see:
protected void  onActivityResult  (int requestCode, int resultCode, Intent
data){
        if (requestCode==PICK_PHOTO){
            if (resultCode == RESULT_OK) {


On Wed, May 26, 2010 at 5:48 PM, andrew <paran...@gmail.com> wrote:

> Hi,
>
> I can't launch a new activity with startActivityForResult /
> startActivity method.
> Below is the code. Can anyone give my any tips and guidelines? thanks!
>
> /**************************/
> public class Sandbox extends Activity {
>
>        private Button mHHW;
>        private static final int ACTIVITY_CREATE = 0;
>
>        /** Called when the activity is first created. */
>    @Override
>    public void onCreate(Bundle savedInstanceState) {
>        super.onCreate(savedInstanceState);
>        setContentView(R.layout.main);
>
>
>        mHHW = (Button) findViewById(R.id.about_hhw);
>
>        mHHW.setOnClickListener(new View.OnClickListener(){
>                public void onClick(View v){
>                        createNote();
>                }
>        });
>    }
>
>    private void createNote() {
>        Intent i = new Intent(this, PageTwo.class);
>        startActivity(i);
>        //startActivityForResult(i,ACTIVITY_CREATE);
>    }
> }
>
> /**************************/
>
> public class PageTwo extends Activity {
>
>        private Button mGoBack;
>
>        @Override
>        protected void onCreate(Bundle savedInstanceState) {
>                // TODO Auto-generated method stub
>                super.onCreate(savedInstanceState);
>                setContentView(R.layout.page_two);
>
>                /*
>            mGoBack = (Button) findViewById(R.id.go_back);
>
>            mGoBack.setOnClickListener(new View.OnClickListener(){
>                public void onClick(View v){
>                        finish();
>                }
>        });
>        */
>
>        }
>
> }
>
> --
> 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+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en




-- 
Carmen
http://www.twitter.com/CarmenDelessio
http://www.talkingandroid.com
http://www.facebook.com/BFFPhoto
http://www.twitter.com/DroidDrop

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to