last day (15 days later) » 

10:14 AM
1
A: on back button previous activity won't get updated with new data

J Rameshstart activity by using Intent intent = new Intent(mActivity, Edit_Profile_activity.class); startActivityForResult(intent, REQUEST_CODE); @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, dat...

 
What is REQUEST_CODE
 
@VikasGodiyal It's Constant define in your activity
 
getting error on REQUEST_CODE
 
@VikasGodiyal define public final int REQUEST_CODE =1; In your activity
 
And what is data
 
10:14 AM
@VikasGodiyal data is return intent that you are putting values
 
error on this line (startActivityForResult(intent, REQUEST_CODE);)
Invalid method declaration
 
Let discuss on chat
 
package com.devbhoomimedia.maangal;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.SpinnerAdapter;
this is my file please check it thanku
 
ok checking...
I think you are not write Intent i = new Intent(EditDetails.this, EditProfile.class);
startActivityForResult(i, REQUEST_CODE); this code in any method
write this code in clicklistener of button that you want to open EditProfile activity
 
Okey let me check
But sir there is only one button which is update button and I want it on back button of mobile
 
10:23 AM
First I want to know where to start EditProfile this activity for edit profile info?
 
There is another activity EditProfile
And am using
JSONObject jsonObject = new JSONObject(response);
JSONArray result = jsonObject.getJSONArray(Config.JSON_ARRAY);
JSONObject userData = result.getJSONObject(0);
to fetch the data from Config.java file
package com.devbhoomimedia.maangal;

import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
Please check this one if you have time
 
You are not understanding what i am asking
i want to know which button you are clicking to open above screen/activity
Any where you are showing edit button in EditDetails activity whan edit click write startActivityForResult code
 
10:44 AM
back button on mobile (at the bottom of every mobile)
 
on back button click you are edit user profile?
Tell me one thing where to edit user profile EditDetails or EditProfile?
Intent i = new Intent(EditProfile.this, EditDetails.class);
startActivityForResult(i, REQUEST_CODE);
write code like this
In this activity after updating User info set to return intent and also setResult (given in my answer) only not add finish();
 
on EditDetails
 
In EditProfile write this code

Intent i = new Intent(EditProfile.this, EditDetails.class);
startActivityForResult(i, REQUEST_CODE);


@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case REQUEST_CODE:
if (resultCode == Activity.RESULT_OK && data!=null) {
String abc=data.getStringExtra("data_key") ;
//write your code for update info
}
break;
}
}
And In EditDetails write this code
After save data to server
Intent intent=new Intent();
intent.putExtra("data_key",value);// your value that you want to updated in EditDetails
setResult(Activity.RESULT_OK, intent);
When you click back it automatically gives values in EditProfile's onActivityResult()
 
11:18 AM
Okey thanku sir it's working now thanks for helping me
 
11:32 AM
welcome
well delete your comment in stackoverflow so that i will delete my comments
 
Which Comment tell me
yep I have deleted my comment
 
ok thank
i will delete my comments
Dome
sorry done
 
11:54 AM
But why we r deleting this comment
 
This showing you have problem in understand code
 
Okey thank you
 

last day (15 days later) »