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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:49:17+00:00 2026-06-14T21:49:17+00:00

I’m trying to create a Request Responses activity and get the itemSelected for use

  • 0

I’m trying to create a Request Responses activity and get the itemSelected for use of next activity which is store them into user friendlist. But the itemSelected return nothing when the “Accept” button is clicked.(It should display itemSelected in toast dialog) Anyone knows what happen it is? Additionally, I like to ask why the item in the listView was located at the not accurate location? it seems like more upper that usual, for the second item.How to adjust it properly?

The figure below is layout of NotificationView.java:

The result when the "Accept" button is clicked.

NotificationView.java

public class NotificationView extends ListActivity{

String[] people;
ListView lv;
Button btn1,btn2;

public void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView(R.layout.view);  
    NotificationManager mnotis =(NotificationManager)getSystemService(NOTIFICATION_SERVICE);
    mnotis.cancel(getIntent().getExtras().getInt("notificationID"));
    String i = getIntent().getExtras().getString("name");
    people = i.split("[,]");
    Log.d("how",i);

    lv= (ListView) findViewById(android.R.id.list);
    btn1 = (Button)findViewById(R.id.acceptbtn);
    btn2 = (Button)findViewById(R.id.closebtn);
    ArrayAdapter<String> list = new ArrayAdapter<String>(NotificationView.this,R.layout.friendlist_item, R.id.friend_name,people);
    lv.setAdapter(list); 

    btn1.setOnClickListener(new View.OnClickListener()
    {
        public void onClick(View v)
        {
            lv = getListView();
            int i = lv.getCount();
            Log.d("count",String.valueOf(i));
            runOnUiThread(new Runnable(){
                public void run(){
                    String itemSelected = "Selected items: \n";
                    for(int i=0;i<lv.getCount();i++){
                        if(lv.isItemChecked(i)){
                            itemSelected += lv.getItemAtPosition(i) + "\n";
                        }
                    }
                    Toast.makeText(NotificationView.this,itemSelected,Toast.LENGTH_SHORT).show();
                }               
            });

        }
    });
}}      

view.xml

  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:background="#ffffff"
  >

<ListView android:id="@android:id/list" 
  android:layout_width="wrap_content" 
  android:layout_height="wrap_content" 
  android:layout_weight="1">
</ListView>

<FrameLayout android:id="@+id/FrameLayout01" 
  android:layout_width="fill_parent" 
  android:layout_height="wrap_content">


  <LinearLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="fill_parent"
      android:background="#ffffff"
      android:orientation="horizontal" >


      <Button
          android:id="@+id/acceptbtn"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_gravity="center_horizontal"
          android:layout_weight="0.46"
          android:text="Accept" />



      <Button
          android:id="@+id/closebtn"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_weight="0.49"
          android:text="Close" />

  </LinearLayout>

</FrameLayout>

friendlist_item.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

<CheckBox android:id="@+id/friend_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight = "88dip"
android:textSize="20dip"
android:textStyle="bold"/>  

</LinearLayout>
  • 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-14T21:49:18+00:00Added an answer on June 14, 2026 at 9:49 pm

    Your Checkbox isn’t related with the method that you are calling, for listview with multiselect items follow the next guide: http://dj-android.blogspot.com/2012/04/milti-selection-listview-android-with.html

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

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm trying to select an H1 element which is the second-child in its group
I'm trying to create an if statement in PHP that prevents a single post
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I am trying to render a haml file in a javascript response like so:

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.