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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T12:07:32+00:00 2026-06-01T12:07:32+00:00

I can fetch the item names from a database and append them to an

  • 0

I can fetch the item names from a database and append them to an edit text. How do I store changed values in an edit text? I want them stored in a string array.

          public class EditMainMenulistview extends BaseAdapter {
protected static Context Context = null;
int i;
public String editnewmainmenu, menuname,edittext;
String qrimage;
Bitmap bmp, resizedbitmap;
Bitmap[] bmps;
Activity activity = null;
private LayoutInflater inflater;

private ImageView[] mImages;
String[] itemimage;
TextView[] tv;
String itemname, itemcode;
public String[] itemnames, itemcodes;
HashMap<String, String> map = new HashMap<String, String>();

public EditMainMenulistview(Context context, JSONArray imageArrayJson) {
    Context = context;
    // inflater =
    // (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    // imageLoader=new ImageLoader(activity);
    inflater = LayoutInflater.from(context);
    this.mImages = new ImageView[imageArrayJson.length()];
    this.bmps = new Bitmap[imageArrayJson.length()];
    this.itemnames = new String[imageArrayJson.length()];
    this.itemcodes = new String[imageArrayJson.length()];

    try {

        for (i = 0; i < imageArrayJson.length(); i++) {
            JSONObject image = imageArrayJson.getJSONObject(i);
            qrimage = image.getString("menuimage");
            itemname = image.getString("menuname");
            itemcode = image.getString("menucode");
            itemnames[i] = itemname;
            itemcodes[i] = itemcode;

            byte[] qrimageBytes = Base64.decode(qrimage.getBytes());

            bmp = BitmapFactory.decodeByteArray(qrimageBytes, 0,
                    qrimageBytes.length);
            int width = 100;
            int height = 100;
            resizedbitmap = Bitmap.createScaledBitmap(bmp, width, height,
                    true);
            bmps[i] = bmp;

            mImages[i] = new ImageView(context);
            mImages[i].setImageBitmap(resizedbitmap);

            mImages[i].setScaleType(ImageView.ScaleType.FIT_START);

            // tv[i].setText(itemname);
        }
        System.out.println(itemnames[i]);


    } catch (Exception e) {
        // TODO: handle exception
    }
}

public int getCount() {
    return mImages.length;
}

public Object getItem(int position) {
    return position;
}

public long getItemId(int position) {
    return position;
}

public View getView(final int position, View convertView, ViewGroup parent) {
    final HashMap<String, String> map=new HashMap<String, String>();
    View vi = convertView;

    vi = inflater.inflate(R.layout.editmainmenulist, null);

    EditText text = (EditText) vi.findViewById(R.id.editmaimenu);
    ImageView image = (ImageView) vi.findViewById(R.id.menuimage);


    image.setImageBitmap(bmps[position]);
    text.append(itemnames[position]);
    String edittext=text.toString();
    text.addTextChangedListener(new TextWatcher() {            
        public void onTextChanged(CharSequence s, int start, int before, int count) {

        }

        public void beforeTextChanged(CharSequence s, int start, int count, int after) {

        }

        public void afterTextChanged(Editable s) {
            if(text.length() > 0) {
                String newName = text.getText().toString();
            } else if(text.length() == 0) {

            }
        }
      });            
    //Toast.makeText(Context, edittext, Toast.LENGTH_LONG).show();
    return vi;
}   

}

I take all item names from my MySql database on android mobile and append them to the editext. The admin can change item names (more than one) and on change, it shall replace the previous item names. I want to update them.

  • 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-01T12:07:33+00:00Added an answer on June 1, 2026 at 12:07 pm

    you have to do somethin like dis

    myEditText.addTextChangedListener(new TextWatcher() {            
            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
    
            }
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
    
            }
            @Override
            public void afterTextChanged(Editable s) {
                if(myEditText.length() > 0) {
                    String newName = myEditText.getText().toString();
                } else if(myEditText.length() == 0) {
    
                }
            }
          });
    

    after this event update your database…

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

Sidebar

Related Questions

I can fetch the menucode from database i can print inside for loop means
I want fetch last record using hibernate criteria Can u help me?
for testing purpose I wrote a VBscript which will fetch values from Sybase by
I would like to know if we can select data from the database using
I want to display four (4) items'name from these id: Can I do like
I want to fetch data from MySQL without creating object from class Normally I
Using a query like below you can fetch rows in which the color of
How can I access the array to fetch the email address? I tried something
I can't seem to find the resolution for this. I have modified the Fetch
How can i return my output in ArrayCollection? values = array(); while($row = mysql_fetch_array($result))

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.