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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:14:06+00:00 2026-06-05T01:14:06+00:00

I have displayed itemimage and itemname in custom listview using base adapter class. I

  • 0

I have displayed itemimage and itemname in custom listview using base adapter class. I am select one itemimage from listview means at that time the screen divided into two halfs.

One of half for all listview items another half window I want show selected item. How can I do this?

for display itemimage,itemname,itemdesc,rate in custom listview code

public class Appetizerlist extends BaseAdapter {
public static ArrayList<String> arr = new ArrayList<String>();
public static ArrayList<String> itemprice = new ArrayList<String>();
public static ArrayList<Bitmap> image = new ArrayList<Bitmap>();

public Context Context;
String qrimage;
Bitmap bmp, resizedbitmap;
Bitmap[] bmps;
Activity activity = null;
private LayoutInflater inflater;

private ImageView[] mImages;
String[] itemimage;
TextView[] tv;
String itemname, price, desc, itemno;
String[] itemnames, checkeditems, itemnos;
String[] prices;
String[] descs;
HashMap<String, String> map = new HashMap<String, String>();

public Appetizerlist(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.prices = new String[imageArrayJson.length()];
    this.descs = new String[imageArrayJson.length()];
    this.itemnos = new String[imageArrayJson.length()];
    try {

        for (int i = 0; i < imageArrayJson.length(); i++) {
            JSONObject image = imageArrayJson.getJSONObject(i);
            qrimage = image.getString("itemimage");
            itemname = image.getString("itemname");
            itemno = new Integer(i + 1).toString();
            price = image.getString("price");
            desc = image.getString("itemdesc");
            System.out.println(price);
            itemnames[i] = itemname;
            prices[i] = price;
            descs[i] = desc;
            itemnos[i] = itemno;

            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(map);

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

public Appetizerlist() {
    // TODO Auto-generated constructor stub
}

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) {
    View view = convertView;
    final ViewHolder viewHolder;
    if (view == null) {
        view = inflater.inflate(R.layout.appetiserlistview, null);
        viewHolder = new ViewHolder();
        viewHolder.image = (ImageView) view
                .findViewById(R.id.appetiserimage);
        viewHolder.text = (TextView) view.findViewById(R.id.appetisertext);
        viewHolder.desc = (TextView) view.findViewById(R.id.appetiserdesc);
        viewHolder.price = (TextView) view
                .findViewById(R.id.appetiserprice);
        viewHolder.appitemnum = (TextView) view
                .findViewById(R.id.appitemno);
        // viewHolder.checkbox = (CheckBox) view.findViewById(R.id.bcheck);

        view.setTag(viewHolder);
    } else {
        viewHolder = (ViewHolder) view.getTag();
    }
    viewHolder.image.setImageBitmap(bmps[position]);
    viewHolder.appitemnum.setText(itemnos[position]);
    viewHolder.price.setText(prices[position]);
    viewHolder.desc.setText(descs[position]);
    // viewHolder.checkbox.setTag(itemnames[position]);
    ViewHolder holder = (ViewHolder) view.getTag();
    holder.text.setText(itemnames[position]);

     */
    return view;
}



static class ViewHolder {

    protected TextView text, price, desc, appitemnum;
    protected ImageView image;
    public static CheckBox checkbox = null;
}

 }

This is my activity code

           public class Appetizers extends Activity {
ImageView back;
String url;
String Qrimage;
Bitmap bmp;
GridView list;
Appetizerlist adapter;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.appetizers);
    url=getIntent().getStringExtra("url");

    ArrayList<HashMap<String, String>> mylist = new ArrayList<HashMap<String, String>>();

    InputStream is = null;
    String result = "";
    JSONObject jArray = null;   
    try {
        HttpClient httpClient = new DefaultHttpClient();
        HttpPost httpPost = new HttpPost(url+"Appetiser.php3");
        HttpResponse response = httpClient.execute(httpPost);
        HttpEntity entity = response.getEntity();
        is = entity.getContent();
    } catch (Exception e) {
        // TODO: handle exception
        Log.e("Log", "Error in Connection" + e.toString());
        Toast.makeText(getApplicationContext(), "Error in Connection",
                Toast.LENGTH_SHORT).show();
        //Intent intent = new Intent(ViewQRCode.this, PimCarder.class);

        //startActivity(intent);

    }
    try {
        BufferedReader reader = new BufferedReader(new InputStreamReader(
                is, "iso-8859-1"), 8);
        StringBuilder sb = new StringBuilder();
        String line = null;
        while ((line = reader.readLine()) != null) {
            sb.append(line + "\n");
        }
        is.close();
        result = sb.toString();
        jArray = new JSONObject(result);
        JSONArray json = jArray.getJSONArray("appetiser");
        list=(GridView)findViewById(R.id.appetiserlist);
         adapter=new Appetizerlist(this, json);
         list.setAdapter(adapter);     
      /*  list.setOnItemClickListener(new OnItemClickListener() {

            public void onItemClick(AdapterView<?> arg0, View arg1,
                    int arg2, long arg3) {
                // TODO Auto-generated method stub
                Toast.makeText(getApplicationContext(), "prakash", 3000).show();

            }
        });*/

        // ListView g = (ListView) findViewById(R.id.gallery);
          //  g.setAdapter(new ImageAdapter(this, json));


    } catch (Exception e) {
        // TODO: handle exception
        Log.e("log", "Error in Passing data" + e.toString());
    }
}
}

The above code I can display custom listview. I want select one item in custom listview means the window has divided to two halves. One for same custom listview another half I want to show selected item details.

  • 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-05T01:14:07+00:00Added an answer on June 5, 2026 at 1:14 am

    Please refer this link

    if not using different layout for phone / tablet …………

    http://developer.android.com/guide/topics/fundamentals/fragments.html#Example

    void showDetails(int index) {
            mCurCheckPosition = index;
    
    
                // We can display everything in-place with fragments, so update
                // the list to highlight the selected item and show the data.
                getListView().setItemChecked(index, true);
    
                // Check what fragment is currently shown, replace if needed.
                DetailsFragment details = (DetailsFragment)
                        getFragmentManager().findFragmentById(R.id.details);
                if (details == null || details.getShownIndex() != index) {
                    // Make new fragment to show this selection.
                    details = DetailsFragment.newInstance(index);
    
                    // Execute a transaction, replacing any existing fragment
                    // with this one inside the frame.
                    FragmentTransaction ft = getFragmentManager().beginTransaction();
                    ft.replace(R.id.details, details);
                    ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
                    ft.commit();
                }
    
    
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a homepage with four displayed posts and one that is emphasized. The
I have a domain aggregate that is displayed using a view model in a
I have an array of Image URl's from that array i have displayed my
I have prepared one custom view, in custom view I have displayed alphabets. It
I have implemented an application with Custom base adapter for display data in list
I have displayed the map in my app by using the following code. I
I am trying to have information displayed for this query: SELECT o.sub_number,o.unique_id,o.period_from,o.period_to,o.total_amt, i.paid_amt,i.dated,i.payment,i.paid_by,i.entered_date,i.paid_for_unique, j.cheque_num,j.drawn_on,j.dated
hi i have displayed a PNG image on screen in android by using XML
I have an iphone App that reads the category field from the xml file
I have an JSON string that gets returned from the server that i'm trying

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.