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

  • SEARCH
  • Home
  • 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 5960123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:46:56+00:00 2026-05-22T18:46:56+00:00

I am a long-time, self-taught, amateur VB programmer who is now trying to teach

  • 0

I am a long-time, self-taught, amateur VB programmer who is now trying to teach himself Java and Android simultaneously. I say this so you will know that I don’t speak the lingo well, and am very very new to these two pursuits.

I have developed an Android form that has a series of EditText boxes, the contents of each which I wish to save to an array once the user has filled it in. I have figured out how to do this if the user presses the Enter key. However, people don’t actually do that: they click on the box, type, and then click on the next element.

I VB, I could write code for the lostfocus event. But I can’t find a similar method in Java.

Finally the question: is there a way to capture when an EditText has lost focus, so I can save the typed data at that type without relying on the Enter Key?

public boolean onKey(View v, int keyCode, KeyEvent event) { 
    if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)){ 
        Editable wasted=edittext_asset.getText(); 
        vehdata[vehNo][Integer.parseInt((String) edittext_asset.getTag())]=wasted.toString(); 
        return true; 
    } 
    return false; 
} 

Please remember that I am so new to this that I am often still not sure where to put code snippets to make them work (new file? oncreate method? who knows). Any guidance you can give me will be gratefully and everlastingly appreciated.

  • 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-05-22T18:46:57+00:00Added an answer on May 22, 2026 at 6:46 pm

    I just got done doing something similar to this. I handled it by making a for-loop that just got the contents of each edittext by id and added it’s text to an array. I did this in the onclick method since i did it all after the user clicked a button.

    String ohhai;
    String duh = et.getText().toString();
    int number = Integer.parseInt(duh);
    List<String> myCollection=new ArrayList<String>();
    EditText stuff;
    int editt;
    String loggy;
    for(int z = 0; z < number; z++){
        stuff = (EditText)findViewById(z);
        editt = stuff.getId();
        loggy = Integer.toString(editt);
        Log.e("How Many", loggy);
        ohhai = stuff.getText().toString();
        myCollection.add(ohhai);
    }
    
    String [] arr = myCollection.toArray(new String[myCollection.size()]);
    String separator = "0";
    StringBuffer result = new StringBuffer();
    if (arr.length > 0) 
       result.append(arr[0]);
    for (int h=1; h < arr.length; h++) {
        result.append(separator);
        result.append(arr[h]);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Long time reader never posted until now. Im having some trouble with Android, im
I'm a self-taught programmer who jumped into Python as my first language about 7-8
I have been trying to do this for a long time now. so here
I've been scratching my head for a long time now, trying to solve this
Long story short, I'm making a racing game in Java. I'm self-taught using some
I've been trying to wrap my head around embedded. Since I will be self-taught
I have had this problem for a long time now, I hope stackoverflow can
I'm a long-time web guy who's pretty new to iphone development. I'm finding many
I've been having this problem for a long time now and I cannot solve
I've been studing Rails for a not such a long time up to now

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.