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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:18:17+00:00 2026-06-01T16:18:17+00:00

listview jArray = new JSONObject(result); json = jArray.getJSONArray(mainmenu); list = (ListView) findViewById(R.id.mainmenulist); adapter =

  • 0
        listview
       jArray = new JSONObject(result);
         json = jArray.getJSONArray("mainmenu");
        list = (ListView) findViewById(R.id.mainmenulist);
        adapter = new EditMainMenulistview(this, json);
        list.setAdapter(adapter);
         EditMainMenulistview

        public class EditMainMenulistview extends BaseAdapter {
public final ArrayList<String> arr=new ArrayList<String>();
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(int position, View convertView, ViewGroup parent) {
    final ViewHolder holder;


    if (convertView == null) {
        holder = new ViewHolder();
        convertView = inflater.inflate(R.layout.editmainmenulist, null);
        holder.caption = (EditText) convertView
                .findViewById(R.id.editmaimenu);
        holder.caption1=(ImageView) convertView.findViewById(R.id.menuimage);
        convertView.setTag(holder);
    } else {
        holder = (ViewHolder) convertView.getTag();
    }
    //Fill EditText with the value you have in data source
    holder.caption.setText(itemnames[position]);
    holder.caption.setId(position);
    holder.caption1.setImageBitmap(bmps[position]);

    //we need to update adapter once we finish with editing
    holder.caption.setOnFocusChangeListener(new OnFocusChangeListener() {
        public void onFocusChange(View v, boolean hasFocus) {
        if(!hasFocus)
        {
                final int position = v.getId();
                final EditText Caption = (EditText) v;

                holder.caption.setFocusable(true);

                arr.add(holder.caption.getText().toString());


        }
            }

    });  



    return convertView;
}
 }

     class ViewHolder {
EditText caption;
ImageView caption1;
    }

     class ListItem {
String caption;
 }

if i can change all ediitext values and send to mysql database i can replace old menunames. if i cange 2 menunames i cannot update ..please tell me…………………………………………………….

  • 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-01T16:18:18+00:00Added an answer on June 1, 2026 at 4:18 pm

    use getText() method.. get All those values and then update your database (But i don’t think this is what you are looking for… but your question is not clear ) ..

    here are the steps you need to follow..

    get references for all thos EditTexts using findViewByID() and then use getText method to get all those texts and then just update database with those values..

    Instead of ArrayList use HashMap.. and make these changes in your code..

    public class EditMainMenulistview extends BaseAdapter {
    public final HashMap<String, String> arr=new HashMap<String, String>;
    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(int position, View convertView, ViewGroup parent) {
        final ViewHolder holder;
    
    
        if (convertView == null) {
            holder = new ViewHolder();
            convertView = inflater.inflate(R.layout.editmainmenulist, null);
            holder.caption = (EditText) convertView
                    .findViewById(R.id.editmaimenu);
            holder.caption1=(ImageView) convertView.findViewById(R.id.menuimage);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }
        //Fill EditText with the value you have in data source
        holder.caption.setText(itemnames[position]);
        holder.caption.setId(position);
        arr.add(position,itemnames[position]);
        holder.caption1.setImageBitmap(bmps[position]);
    
        //we need to update adapter once we finish with editing
        holder.caption.setOnFocusChangeListener(new OnFocusChangeListener() {
            public void onFocusChange(View v, boolean hasFocus) {
            if(!hasFocus)
            {
                    final int position = v.getId();
                    final EditText Caption = (EditText) v;
    
                    holder.caption.setFocusable(true);
                    arr.remove(holder.caption.getId());
                    arr.add(holder.caption.getId(),holder.caption.getText().toString());
    
    
            }
                }
    
        });  
    
    
    
        return convertView;
    }
     }
    
         class ViewHolder {
    EditText caption;
    ImageView caption1;
        }
    
         class ListItem {
    String caption;
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

ListView menuList = (ListView) findViewById(R.id.ListView_Menu); String[] items = {getResources().getString(R.string.menu_item_NxtInc)}; ArrayAdapter<String> adapt = new ArrayAdapter<String>(this,R.layout.menu_item,items);
final ListView lv= (ListView)findViewById(R.id.list); String[] from = new String[] {a, b,c}; int[] to =
The ListView shows nothing when I want to set the adapter to display the
$(#listView object.modal).click(function(){ // Get the ID of the clicked link: var link = $(this).closest(h2).attr(title);
For my ListView I'm using listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL); listView.setMultiChoiceModeListener(new ModeCallback()); private class ModeCallback implements ListView.MultiChoiceModeListener {
here is my listview <ListView android:layout_width=match_parent android:layout_height=match_parent android:id=@+id/ListView android:fastScrollEnabled=true android:divider=@null style=@drawable/listviewfastscrollstyle ></ListView> This is
I have been trying to parse Json into A ListView but when i do
listView.setOnItemClickListener(new OnItemClickListener(){ @Override public void onItemClick(AdapterView<?> parent, View viewItem, int position, long arg3) {
I've got some ListView . Each list element is constructed using layout looking like
ListView has this nice feature where you can set an overscroll header or footer.

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.