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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:00:19+00:00 2026-05-23T11:00:19+00:00

I have a list activity, in which I show an image and text in

  • 0

I have a list activity, in which I show an image and text in a row.

Images are static and these are placed in the drawable folder.

I want to print images and text in next activity while clicking on the list item. I can successfully send text view on the next activity. But I found it difficulty to send an image to the next window. Because these are static.

Can anyone help me on this issue. Thanks in advance.

      public class Myimage extends ListActivity {

        private LayoutInflater mInflater;
        static Vector<RowData> data = new Vector<RowData>();
        RowData rd;
        static boolean fromCategory = false;
        static final String[] title = new String[] {
                "One", "Two", "Three "};

        private Integer[] img = {
          R.drawable.i,R.drawable.im,R.drawable.ima};
        @Override
        public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        mInflater = 

(LayoutInflater) getSystemService(
    Activity.LAYOUT_INFLATER_SERVICE);

    for(int i=0;i<title.length;i++){
    try {
        rd = new RowData(i,title[i]);
        } catch (Exception e) {
            e.printStackTrace();
       }
       data.add(rd);
    }
       CustomAdapter adapter = new CustomAdapter(this, R.layout.list,
                                         R.id.title, data);
       setListAdapter(adapter);
       getListView().setTextFilterEnabled(true);

    // This is the List Item Click method which i should work to send the image on next activity.




    public void onListItemClick(ListView parent, View v, int position,
                long id) { 
            Intent intent = new Intent(this,Second.class);
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);






        } 
    public class RowData  {

               protected int mId;
               protected String mTitle;

               RowData(int id,String title){
               mId=id;
               mTitle = title;

            }
               public void setTitle(String title) {
                this.mTitle = title.trim();
            }

               public String getTitle() {
                return mTitle;
            }
               public void setId(int i){ 
                   this.mId=i;
                   }
               public int getId(){
                   return mId;
               }


               @Override
               public String toString() {
                       return mId+" "+mTitle;
               }
        }




          private class CustomAdapter extends ArrayAdapter<RowData> {
          public CustomAdapter(Context context, int resource,
                                int textViewResourceId, List<RowData> objects) {               
         super(context, resource, textViewResourceId, objects);
        }
              @Override
               public View getView(int position, View convertView, ViewGroup parent) {   
               ViewHolder holder = null;
               TextView title = null;

               ImageView i11=null;
               RowData rowData= getItem(position);
               if(null == convertView){
                    convertView = mInflater.inflate(R.layout.list, null);
                    holder = new ViewHolder(convertView);
                    convertView.setTag(holder);
         }
                     holder = (ViewHolder) convertView.getTag();
                     title = holder.gettitle();
                     title.setText(rowData.mTitle);

                     i11=holder.getImage();
                     i11.setImageResource(img[rowData.mId]);
                     return convertView;
        }
                    private class ViewHolder {
                    private View mRow;
                    private TextView title = null;

                    private ImageView i11=null; 
                    public ViewHolder(View row) {
                    mRow = row;
         }
                 public TextView gettitle() {
                     if(null == title){
                         title = (TextView) mRow.findViewById(R.id.title);
                        }
                    return title;
                 }     

                public ImageView getImage() {
                     if(null == i11){
                          i11 = (ImageView) mRow.findViewById(R.id.img);
                                              }
                        return i11;
                }
             }
           } }
  • 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-23T11:00:20+00:00Added an answer on May 23, 2026 at 11:00 am

    You should use Bundle class for sending text and image. I suggest you to send imageid(R.id.imageID) rather than send to hole ImageView.

      //Use It for setting value of Bundle variable 
      Intent intent = new Intent(CourtDetailActivity.thisDrivingDirection.class);
      intent.putExtra("CourtId", courtId);
      startActivity(intent);
       //Use It for geting value of Bandle variable 
       Bundle extras = getIntent().getExtras();
       courtId = extras != null ? extras.getString("ImageId") : "";
    
         //You just copy and past given blow code in your code
         public void onListItemClick(ListView parent, View v, int position,
                long id) { 
            Intent intent = new Intent(this,Second.class);
    
           intent.putExtra("ImageId", ""+img[position]);
            startActivity(intent);
    
        } 
    

    I hope it is helpful to you

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

Sidebar

Related Questions

I have an activity which I want to show ListView with list of topics,
Hi i have a tab activity which show a list of items (ListView) .
I have a list activity which display all running applications in the device. it's
I have an activity which shows some List entries. When I click on a
I have a database which contains list of image and video path. My problem
I have one Activity in which I try to show some simple messages, and
I have a activity which showing the 20 items in listview, at bottom list
I have an activity with a listView, which uses a custom row layout defined
I have a list of objects called Activity: class Activity { public Date activityDate;
I have managed to reload the list item in a list when the activity

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.