Monday, February 13, 2012

Re: [android-developers] onActivityResult Does not works

I had similar problem before. My second activity (The one which was supposed to return result) was single task in the Androidmanifest.xml. I changed to standard and it worked. I hope that it resolves your issue as well

On 14 Feb 2012 07:32, "yogesh.rb@acusis.com" <yogesh.rb@acusis.com> wrote:
hello,
i have two activites, i.e
currentDate.setOnClickListener(new View.OnClickListener() {
               static final int PICK_DATE_REQUEST =1;
           @Override
           public void onClick(View v) {
                 String result1=null;
                 Intent intent = new
Intent(appointmentSchedule.this,CalendarView.class);
               intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                 intent.putExtra("date",currentDate.getText());
                Log.i("in OnActivityResult", "in OnActivityResult");
                       startActivityForResult(intent, PICK_DATE_REQUEST);


           }
       });

 protected void onActivityResult(int requestCode, int resultCode,
Intent data) {
         Log.i("in OnActivityResult", "in OnActivityResult");
               super.onActivityResult(requestCode, resultCode, data);
               if (requestCode == PICK_DATE_REQUEST) {
           if (resultCode == RESULT_OK) {
        //     Toast.makeText(getApplicationContext(),
data.getStringExtra("date"), Toast.LENGTH_SHORT).show();
               //EditText et =(EditText)findViewById(R.id.editText1);
               currentDate.setText(data.getStringExtra("date"));
                String result1=null;


               //String[] dateArr =
data.getStringExtra("date").split("-");
               //DatePicker dp =
(DatePicker)findViewById(R.id.datePicker1);
               //dp.updateDate(Integer.parseInt(dateArr[0]),
Integer.parseInt(dateArr[1]), Integer.parseInt(dateArr[2]));
           }

               }
       }

in CalendarView.java
Intent intent = new Intent();
                               String day = date.getText().toString();
                               if(day.length()==1) {
                                       day = "0"+day;
                               }
                               // return chosen date as string format

                               intent.putExtra("date",
android.text.format.DateFormat.format("yyyy-MM", month)+"-"+day);
                               Toast.makeText(getApplicationContext(),
android.text.format.DateFormat.format("yyyy-MM", month)+"-"+day,
Toast.LENGTH_SHORT).show();
                               //setResult(0);
                               setResult(RESULT_OK, intent);
                               Toast.makeText(getApplicationContext(),
Integer.toString(RESULT_OK), Toast.LENGTH_SHORT).show();
                               Log.i(TAG, "Unbinding and finishing");
                               finish();


after finish the compiler is not executing onActivityresult...
i gone through each and every forum.... but no help...

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

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate