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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:45:06+00:00 2026-05-22T20:45:06+00:00

In my application I need to move from one activity to another depending on

  • 0

In my application I need to move from one activity to another depending on the list clicked. In each listview there will be three textview namely: Emp_id, Emp_name,Emp_address, so whenever I click on a particular list that should move to next activity of the corresponding Emp_id. So here I want to catch the Emp_id, which I am unable. I have tried a lot but got only the first Emp_id not the list that I have clicked.

CODE:

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

        try{
            JSONObject jObj = new JSONObject(Mydetail);
            JSONArray data = jObj.getJSONArray("mydata");

            for(int i=0;i<data.length();i++){                       
                HashMap<String, String> map = new HashMap<String, String>();    
                JSONObject e = data.getJSONObject(i);

                map.put("id", String.valueOf(i));
                map.put("Eid", "" + e.getString("E_id"));
                map.put("Ename", "" + e.getString("E_name"));
                map.put("Eaddress", "" + e.getString("E_address"));
                mylist2.add(map);
            }       
        }catch(JSONException e)        {
             Log.e("log_tag", "Error parsing data "+e.toString());
        }

         ListAdapter adapter = new SimpleAdapter(this, mylist2 , R.layout.datalist,
                                  new String[] { "Eid", "Ename", "Eaddress" }, 
                                  new int[] {  R.id.TextView1,R.id.TextView2e,R.id.TextView3 });
                                  setListAdapter(adapter);


        final ListView lv = getListView();
        lv.setTextFilterEnabled(true);  
        lv.setOnItemClickListener(new OnItemClickListener() {
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {              
                @SuppressWarnings("unchecked")
                HashMap<String, String> o = (HashMap<String, String>) lv.getItemAtPosition(position);                   
                //String val = o.get("id");

                Pnm = (TextView)findViewById(R.id.TextView1);
                 String str = ((TextView)Pnm).getText().toString();


                Toast.makeText(projects.this, str,Toast.LENGTH_LONG).show();

                Intent newActivitySecond = new Intent(projects.this, modules.class);     
                projects.this.startActivity(newActivitySecond);


            }
        });

Thanks

  • 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-22T20:45:07+00:00Added an answer on May 22, 2026 at 8:45 pm

    Try like this:

     ListView lv_ArchivePartylist;
    
        lv_ArchivePartylist = (ListView)findViewById(R.id.archive_ListView01);
                lv_ArchivePartylist.setOnItemClickListener(new OnItemClickListener()
                    {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position,long id) {
                        // TODO Auto-generated method stub
                        String message = view.findViewById(R.id.txt_box1).getText().toString;
                        Toast.makeText(Activityname.this, message, Toast.LENGTH_SHORT).show();
    
        }
        }
    
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to move all requests from one domain to another. I want to
a task at my hand requires me to move an ASP application from one
In the java web application need to select the file from server and print
In an application I need to execute other programs with another user's credentials. Currently
I have two application that need to talk to each other. App1 needs to
In my iPhone application I need to show a video image in UITableView. Each
I need to centralize all settings for our Java web application in one .properties
I need to move the aspnetdb from the development machine to the test machine.
I am working on an application where i need to transfer mails from a
In my Android application I need to read a large amount of data from

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.