Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8153907
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:10:05+00:00 2026-06-06T16:10:05+00:00

i create dynamic textviews in an activity with some fields returned by a webservice.

  • 0

i create dynamic textviews in an activity with some fields returned by a webservice. When the user wants to edit some data, he is sent to another activity. When he clicks on the “back” button i want to update data in the previous activity but i don’t know the right way to do. I use the onRestart method instead of onResume

here is my code :

My first activity which display data :

public class QueryActivity extends Activity {

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.query);

        new WSData() {
        @Override
        public void onPostExecute(final ArrayList<ArrayList<String>> result) {  int nbTextView = result.size();
            TextView[] textViewArray = new TextView[nbTextView];

            for (int i = 0; i < nbTextView; i++) {

                // Horizontal Layout to have the accountName and a button to
                // edit on the same line
                LinearLayout editLayout = new LinearLayout(
                        QueryActivity.this);
                Button edit = new Button(QueryActivity.this);
                edit.setBackgroundDrawable(getResources().getDrawable(
                        R.drawable.editer));

                editLayout.removeAllViewsInLayout();
                editLayout.setOrientation(LinearLayout.HORIZONTAL);
                dynamicWindow.addView(editLayout,
                        new LinearLayout.LayoutParams(
                                LinearLayout.LayoutParams.FILL_PARENT,
                                LinearLayout.LayoutParams.WRAP_CONTENT));

                textViewArray[i] = new TextView(QueryActivity.this);

                // retrieve every field from the result
                final String accountId = result.get(i).get(0);
                final String accountName = result.get(i).get(1);
                final String phone = result.get(i).get(2);
                final String industry = result.get(i).get(3);
                final String website = result.get(i).get(4);

// display only the accountName
                textViewArray[i].setText(accountName);
                textViewArray[i].setTextColor(0xFFFFFFFF);
                textViewArray[i].setGravity(Gravity.CENTER_VERTICAL);
                textViewArray[i].setVisibility(View.VISIBLE);

                edit.setOnClickListener(new OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        Intent intent = new Intent(QueryActivity.this,
                                EditAccountActivity.class);
                                            startActivity(intent);
                    }
                });
}.execute(sessionName, null, "getAccountInfo"); 
}


@Override
public void onRestart() {
    super.onRestart();

}

my other activity, i want to update my data when i click on “back” :

public class EditAccountActivity extends Activity {                 
back.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
             finish();
            }
    });
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T16:10:08+00:00Added an answer on June 6, 2026 at 4:10 pm
    When he clicks on the "back" button i want to update data in the previous activity
    

    1- Start Activity 2 using startActivityForResult().

    2 override the back key event in 2nd Activity and set the intent and Result_OK

    3- get data in onActivityForResult in 1st Activity

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to get the data from the webservice and create dynamic custom
I am trying to create an ajax request to a WebService that returns data
I'm trying to create dynamic balls by using a for loop. For some reason
I have issue where i want to create Dynamic function which will do some
In my application i am going to create everything dynamic based on the some
How do you create dynamic fields in a SQL Server table? I'd like to
I have some codes to create dynamic button as below: - (void)viewDidLoad { for
I'm trying to create dynamic multi level menus fetching the data from a MySQL
Project: To create dynamic multi page form that populates the fields in different ways
I create dynamic LinkButton and I add LinkButton's Click Trigger to UpdatePanel. Now, When

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.