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 7888219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:46:39+00:00 2026-06-03T05:46:39+00:00

In my application Two edit boxes are there,when clicking appropriate Editbox it will show

  • 0

In my application Two edit boxes are there,when clicking appropriate Editbox it will show An listview(which is another intent.From that user have to select 1 input,i am assigning these value to the textbox.Myproblem is when i set value for 1 editbox and clicking another textbox to get values the 1st textbox value is not there.

My Code is:

Screen with edittext box:

 public void onCreate(Bundle savedInstanceState) 
    {
        final String fromunit=getIntent().getStringExtra("Fromunit");
        final String tounit=getIntent().getStringExtra("Tounit");
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);       
        EditText medit=(EditText)findViewById(R.id.editText1);
        EditText meditfrom=(EditText)findViewById(R.id.editText2);
        Button b1=(Button)findViewById(R.id.button1);
        EditText meditto=(EditText)findViewById(R.id.editText3);
        meditfrom.setText(fromunit);
        meditto.setText(tounit);
        meditfrom.setOnTouchListener(new View.OnTouchListener() {

            @Override
            public boolean onTouch(View v, MotionEvent arg1) 
Intent  FromIntent= new Intent(v.getContext(),Fromlist.class);
                 startActivity(FromIntent); 
                return false;
            }
        });

  meditto.setOnTouchListener(new View.OnTouchListener() {

            @Override
            public boolean onTouch(View v, MotionEvent arg1) 
            {
                // TODO Auto-generated method stub
                 Intent  ToIntent= new Intent(v.getContext(),Tolist.class);
                 startActivity(ToIntent);   
                return false;
            }
        });

The ListView Screen:

FOR 1st editbox:

  public void onCreate(Bundle savedInstanceState) 
            {
                super.onCreate(savedInstanceState);
                setListAdapter(new ArrayAdapter<String>(this, R.layout.fromunit, FROMUNIT));
                ListView lv = getListView();
                lv.setTextFilterEnabled(true);
                lv.setOnItemClickListener(new OnItemClickListener() 
                {
                  public void onItemClick(AdapterView<?> parent, View view,
                      int position, long id) {
                    // When clicked, show a toast with the TextView text
    //              Toast.makeText(getApplicationContext(), ((TextView) view).getText(),
    //                  Toast.LENGTH_SHORT).show();
                      Intent prev=new Intent(view.getContext(),ServiceExampleActivity.class);
                      prev.putExtra("Fromunit",((TextView) view).getText());
                      startActivity(prev);
                  }
                });        
            }   


For 2nd edittextbox:



 public void onCreate(Bundle savedInstanceState) 
        {
            super.onCreate(savedInstanceState);
            setListAdapter(new ArrayAdapter<String>(this, R.layout.fromunit, TOUNIT));
            ListView lv = getListView();
            lv.setTextFilterEnabled(true);
            lv.setOnItemClickListener(new OnItemClickListener() 
            {
              public void onItemClick(AdapterView<?> parent, View view,
                  int position, long id) {
                // When clicked, show a toast with the TextView text
    //            Toast.makeText(getApplicationContext(), ((TextView) view).getText(),
    //                Toast.LENGTH_SHORT).show();
                  Intent prev=new Intent(view.getContext(),ServiceExampleActivity.class);
                  prev.putExtra("Tounit",((TextView) view).getText());
                  startActivity(prev);
              }
            });        
        }   
  • 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-03T05:46:41+00:00Added an answer on June 3, 2026 at 5:46 am

    You should use startActivityForresult() method to start another Activity

    eg: In FirstActivity

     int REQUEST_CODE= 1;
    
     public boolean onTouch(View v, MotionEvent arg1) 
      Intent  FromIntent= new Intent(v.getContext(),Fromlist.class);
                 startActivityForresult(FromIntent,REQUEST_CODE); 
                return false;
            }
        });
    

    In secondActivity if you want to send back data

    Intent returnIntent = new Intent();
    returnIntent.putExtra("result",result);
    setResult(RESULT_OK,returnIntent);     
    finish();
    

    if you don’t want to return data

    Intent returnIntent = new Intent();
    setResult(RESULT_CANCELED, returnIntent);        
    finish();
    

    Now in your FirstActivity class write following code for onActivityResult() method

    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    
    if (requestCode == REQUEST_CODE) {
    
     if(resultCode == RESULT_OK){
    
      String result=data.getStringExtra("result");
    
    }
    
    if (resultCode == RESULT_CANCELED) {
    
     //Write your code on no result return 
    
    }
    }//onAcrivityResult
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Backdrop: There are two forms, the main application form and a form to edit
In my application I have two queries which will be quite frequently used. The
I'm writing an application which have two modes; one view mode and one edit
In my application i have 3 edit text boxes ,in that in first two
In my application two frame is there. In main frame Server button is there.
My application has two node types: a parent node which can hold recursive child
I have a web application and two class files, First class is MyClass.class which
I am working on the application which has two listboxes.I load the two listboxes
I have a WPF application with two PasswordBoxes, one for the password and another
I have an application which uses two methods of an API. Both these methods

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.