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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:18:34+00:00 2026-06-16T05:18:34+00:00

I am having problem of showing Toast Message when i click a button within

  • 0

I am having problem of showing Toast Message when i click a button within a list View.
The problem is that i a custom class extended by BaseAdapter i have a method named GetView
I wanna show a toast Message from that particular message

Following is my Listview Row Xml

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/tools"
    android:id="@+id/scrollView1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    app:context=".HomeActivity" >

    <TableLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <TableRow
            android:id="@+id/tableRow_laugh"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <RelativeLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                app:ignore="UselessParent" >

                <TableLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_alignParentLeft="true"
                    android:layout_alignParentTop="true" >

                    <TableRow
                        android:id="@+id/tableRow_Header_laugh"
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:background="#818085" >

                        <RelativeLayout
                            android:id="@+id/relative_header"
                            android:layout_width="wrap_content"
                            android:layout_height="fill_parent"
                            android:background="#818085" >

                            <ImageView
                                android:id="@+id/UserIconPic_laugh"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_alignParentLeft="true"
                                android:layout_alignParentTop="true"
                                android:layout_weight="0.4"
                                android:src="@drawable/ic_launcher"
                                app:ignore="ObsoleteLayoutParam,ContentDescription" />

                            <Button
                                android:id="@+id/btn_Vote_laugh"
                                android:layout_width="wrap_content"
                                android:layout_height="match_parent"
                                android:layout_alignParentRight="true"
                                android:layout_alignParentTop="true"
                                android:layout_weight=".4"
                                android:text="VOTE"
                                app:ignore="ObsoleteLayoutParam,HardcodedText" />

                            <TextView
                                android:id="@+id/txt_number_of_vote_laugh"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_alignBaseline="@+id/btn_Vote_laugh"
                                android:layout_alignBottom="@+id/btn_Vote_laugh"
                                android:layout_toRightOf="@+id/UserIconPic_laugh"
                                android:layout_weight=".4"
                                android:textAppearance="?android:attr/textAppearanceMedium"
                                app:ignore="ObsoleteLayoutParam,HardcodedText" />
                        </RelativeLayout>
                    </TableRow>

                    <TableRow
                        android:id="@+id/tableRow_MainText_laugh"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content" >

                        <TextView
                            android:id="@+id/txt_MainText_laugh"
                            android:layout_width="fill_parent"
                            android:layout_height="wrap_content"
                            android:text="@string/whatweare_about_main"
                            android:textAppearance="?android:attr/textAppearanceMedium"
                            app:ignore="HardcodedText" />
                    </TableRow>

                    <TableRow
                        android:id="@+id/tableRow_Footer_laugh"
                        android:layout_width="wrap_content"
                        android:layout_height="fill_parent" >

                        <RelativeLayout
                            android:id="@+id/relative_footer"
                            android:layout_width="wrap_content"
                            android:layout_height="fill_parent"
                            android:background="#bababa" >

                            <Button
                                android:id="@+id/btn_Share_laugh"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="Share"
                                app:ignore="HardcodedText" />

                            <ImageButton
                                android:id="@+id/btn_facebook_laugh"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_centerVertical="true"
                                android:layout_toLeftOf="@+id/btn_twitter_laugh"
                                android:src="@drawable/pic2"
                                app:ignore="ContentDescription" />

                            <ImageButton
                                android:id="@+id/btn_twitter_laugh"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_alignParentRight="true"
                                android:layout_alignTop="@+id/btn_facebook_laugh"
                                android:src="@drawable/pic3"
                                app:ignore="ContentDescription" />
                        </RelativeLayout>
                    </TableRow>
                </TableLayout>
            </RelativeLayout>
        </TableRow>

        <TableRow
            android:id="@+id/tableRow_light"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <RelativeLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                app:ignore="UselessParent" >

                <TableLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_alignParentLeft="true"
                    android:layout_alignParentTop="true" >

                    <TableRow
                        android:id="@+id/tableRow_header_light"
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content" >

                        <RelativeLayout
                            android:id="@+id/RelativeLayout02"
                            android:layout_width="wrap_content"
                            android:layout_height="fill_parent"
                            android:background="#818085" >

                            <ImageView
                                android:id="@+id/UserIconPic_light"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_alignParentLeft="true"
                                android:layout_alignParentTop="true"
                                android:layout_weight="0.4"
                                android:src="@drawable/ic_launcher"
                                app:ignore="ObsoleteLayoutParam,ContentDescription" />

                            <Button
                                android:id="@+id/btn_Vote_light"
                                android:layout_width="wrap_content"
                                android:layout_height="match_parent"
                                android:layout_alignParentRight="true"
                                android:layout_alignParentTop="true"
                                android:layout_weight=".4"
                                android:text="VOTE"
                                app:ignore="ObsoleteLayoutParam,HardcodedText" />

                            <TextView
                                android:id="@+id/txt_vote_light"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_alignBaseline="@+id/btn_Vote_light"
                                android:layout_alignBottom="@+id/btn_Vote_light"
                                android:layout_toRightOf="@+id/UserIconPic_light"
                                android:layout_weight=".4"
                                android:textAppearance="?android:attr/textAppearanceMedium"
                                app:ignore="ObsoleteLayoutParam,HardcodedText" />
                        </RelativeLayout>
                    </TableRow>

                    <TableRow
                        android:id="@+id/tableRow_content_light"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content" >

                        <FrameLayout
                            android:layout_width="fill_parent"
                            android:layout_height="wrap_content" >

                            <TextView
                                android:id="@+id/textView1"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_gravity="bottom|center"
                                android:maxLength="300"
                                android:text="@string/Main_laugh"
                                android:textAppearance="?android:attr/textAppearanceSmall"
                                app:ignore="HardcodedText" />

                            <ImageView
                                android:id="@+id/light_image"
                                android:layout_width="fill_parent"
                                android:layout_height="wrap_content"
                                app:ignore="ContentDescription" />
                        </FrameLayout>
                    </TableRow>

                    <TableRow
                        android:id="@+id/tableRow_Footer_light"
                        android:layout_width="wrap_content"
                        android:layout_height="fill_parent" >

                        <RelativeLayout
                            android:id="@+id/RelativeLayout01"
                            android:layout_width="wrap_content"
                            android:layout_height="fill_parent"
                            android:background="#bababa" >

                            <Button
                                android:id="@+id/Btn_Share_light"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="Share"
                                app:ignore="HardcodedText" />

                            <ImageButton
                                android:id="@+id/btn_facebook_light"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_centerVertical="true"
                                android:layout_toLeftOf="@+id/btn_twitter_light"
                                android:src="@drawable/pic2"
                                app:ignore="ContentDescription" />

                            <ImageButton
                                android:id="@+id/btn_twitter_light"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_alignParentRight="true"
                                android:layout_alignTop="@+id/btn_facebook_light"
                                android:src="@drawable/pic3"
                                app:ignore="ContentDescription" />
                        </RelativeLayout>
                    </TableRow>
                </TableLayout>
            </RelativeLayout>
        </TableRow>

        <TableRow
            android:id="@+id/tableRow_fun"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <RelativeLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                app:ignore="UselessParent" >

                <TableLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_alignParentLeft="true"
                    android:layout_alignParentTop="true" >

                    <TableRow
                        android:id="@+id/tableRow_header_fun"
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content" >

                        <RelativeLayout
                            android:id="@+id/RelativeLayout04"
                            android:layout_width="wrap_content"
                            android:layout_height="fill_parent"
                            android:background="#818085" >

                            <ImageView
                                android:id="@+id/UserIconPic_fun"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_alignParentLeft="true"
                                android:layout_alignParentTop="true"
                                android:layout_weight="0.4"
                                android:src="@drawable/ic_launcher"
                                app:ignore="ObsoleteLayoutParam,ContentDescription" />

                            <Button
                                android:id="@+id/btn_vote_fun"
                                android:layout_width="wrap_content"
                                android:layout_height="match_parent"
                                android:layout_alignParentRight="true"
                                android:layout_alignParentTop="true"
                                android:layout_weight=".4"
                                android:text="VOTE"
                                app:ignore="ObsoleteLayoutParam,HardcodedText" />

                            <TextView
                                android:id="@+id/txt_vote_number_fun"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_alignBaseline="@+id/btn_vote_fun"
                                android:layout_alignBottom="@+id/btn_vote_fun"
                                android:layout_toRightOf="@+id/UserIconPic_fun"
                                android:layout_weight=".4"
                                android:textAppearance="? android:attr/textAppearanceMedium"
                                app:ignore="ObsoleteLayoutParam,HardcodedText" />
                        </RelativeLayout>
                    </TableRow>

                    <TableRow
                        android:id="@+id/tableRow_Content_fun"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content" >

                        <RelativeLayout
                            android:id="@+id/relativelayout"
                            android:layout_width="fill_parent"
                            android:layout_height="fill_parent" >

                            <ImageView
                                android:id="@+id/image_fun"
                                android:layout_width="fill_parent"
                                android:layout_height="fill_parent"
                                android:adjustViewBounds="true"
                                android:baselineAlignBottom="true"
                                android:cropToPadding="true"
                                app:ignore="ContentDescription" />

                            <TextView
                                android:id="@+id/myImageViewText"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_alignBottom="@+id/image_fun"
                                android:layout_alignLeft="@+id/image_fun"
                                android:layout_alignRight="@+id/image_fun"
                                android:layout_alignTop="@+id/image_fun"
                                android:layout_margin="1dp"
                                android:gravity="center"
                                android:text="@string/main_light"
                                android:textColor="#000000" />
                        </RelativeLayout>
                    </TableRow>

                    <TableRow
                        android:id="@+id/tableRow_Footer_fun"
                        android:layout_width="wrap_content"
                        android:layout_height="fill_parent" >

                        <RelativeLayout
                            android:id="@+id/RelativeLayout03"
                            android:layout_width="wrap_content"
                            android:layout_height="fill_parent"
                            android:background="#bababa" >

                            <Button
                                android:id="@+id/Btn_share_fun"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="Share"
                                app:ignore="HardcodedText" />

                            <ImageButton
                                android:id="@+id/btn_facebook_fun"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_centerVertical="true"
                                android:layout_toLeftOf="@+id/btn_twitter_fun"
                                android:src="@drawable/pic2"
                                app:ignore="ContentDescription" />

                            <ImageButton
                                android:id="@+id/btn_twitter_fun"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_alignParentRight="true"
                                android:layout_alignTop="@+id/btn_facebook_fun"
                                android:src="@drawable/pic3"
                                app:ignore="ContentDescription" />
                        </RelativeLayout>
                    </TableRow>
                </TableLayout>
            </RelativeLayout>
        </TableRow>
    </TableLayout>

</ScrollView>

My CustomeAdapter Class code

 package com.example.laysapp.ContentListView;
 import java.util.ArrayList;
 import java.util.List;

 import com.example.laysapp.R;
 import com.example.laysapp.RegisteredUser.LighterShare;

 import android.app.Application;
 import android.content.Context;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.View.OnClickListener;
 import android.view.ViewGroup;
 import android.webkit.WebView.FindListener;
 import android.widget.BaseAdapter;
 import android.widget.Button;
 import android.widget.ImageView;
 import android.widget.TextView;
 import android.widget.Toast;

 public class ContentItemAdapter extends BaseAdapter {

private final List<Content_Items> items;

public ContentItemAdapter(final Context context, final int itemResId,
        final ArrayList<Content_Items> items2) {
    this.items = items2;
}

@Override
public int getCount() {
    // TODO Auto-generated method stub
    return items.size();
}

@Override
public Object getItem(int arg0) {
    // TODO Auto-generated method stub
    return null;
}

@Override
public long getItemId(int position) {
    // TODO Auto-generated method stub
    return 0;
}

@SuppressWarnings("null")
@Override
public View getView(int position, View convertView, ViewGroup parent) {

    final Content_Items item = this.items.get(position);
    View itemView = null;

    if (convertView == null) {
        LayoutInflater inflater = (LayoutInflater) parent.getContext()
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        itemView = inflater.inflate(R.layout.contentlistrow, null);
    } else {
        itemView = convertView;
    }

    // Set the text of the Laugh Row Start
    TextView txtLaugh_Vote = (TextView) itemView
            .findViewById(R.id.txt_number_of_vote_laugh);
    txtLaugh_Vote.setText(item.getLaughNo_Vote());

    TextView txtlaugh_Content = (TextView) itemView
            .findViewById(R.id.txt_MainText_laugh);
    txtlaugh_Content.setText(item.getLaughContent());

    ImageView imgView_Laugh_UserPic = (ImageView) itemView
            .findViewById(R.id.UserIconPic_laugh);

    imgView_Laugh_UserPic.setImageBitmap(item.getLaughtUserPic());

    // Set the text of the Laugh Row End

    // Setting of Light Row Start

    TextView txtLight_Vote = (TextView) itemView
            .findViewById(R.id.txt_vote_light);
    txtLight_Vote.setText(item.getLaughNo_Vote());

    TextView txtlight_Content = (TextView) itemView
            .findViewById(R.id.textView1);
    txtlight_Content.setText(item.getLaughContent());

    ImageView imgView_Light_UserPic = (ImageView) itemView
            .findViewById(R.id.UserIconPic_light);

    imgView_Light_UserPic.setImageBitmap((item.getLightStoriesUserPic()));

    ImageView imgView_LightContent_Image = null;
    // Check weather ContentImage is Available For Light

    String Check = item.getIsLightContentAvaiable();
    if (Check == "yes") {
        imgView_LightContent_Image = (ImageView) imgView_LightContent_Image
                .findViewById(R.id.light_image);
        imgView_LightContent_Image.setImageBitmap(item
                .getLightStoriesContentImagePic());
    }

    // Setting of Light Row End

    // Set the text of the Funto Row Start

    TextView txtfunto_Vote = (TextView) itemView
            .findViewById(R.id.txt_vote_number_fun);
    txtfunto_Vote.setText(item.getLaughNo_Vote());

    TextView txtfunto_Content = (TextView) itemView
            .findViewById(R.id.myImageViewText);
    txtfunto_Content.setText(item.getLaughContent());

    // Set the text of the Funto Row End

    ImageView imgView_funto_UserPic = (ImageView) itemView
            .findViewById(R.id.UserIconPic_fun);

    imgView_funto_UserPic.setImageBitmap(item.getfuntoUserPic());

    ImageView imgView_funto_ContentPic = (ImageView) itemView
            .findViewById(R.id.image_fun);

    imgView_funto_ContentPic.setImageBitmap(item.getfuntoContentImagePic());

    Button MainVote_Laugh = null;
    MainVote_Laugh = (Button) MainVote_Laugh
            .findViewById(R.id.btn_Vote_laugh);
    MainVote_Laugh.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub

            Toast.makeText(getApplication(), "Clicked Laugh Vote", Toast.LENGTH_SHORT).Show();
        }
    });

    return itemView;
}
}
  • 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-16T05:18:36+00:00Added an answer on June 16, 2026 at 5:18 am

    Replace this line:

    Toast.makeText(getApplication(), "Clicked Laugh Vote", Toast.LENGTH_SHORT).show();
    

    with this line:

     Toast.makeText(v.getContext(), "Clicked Laugh Vote", 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'm having small problem (I guess) of showing the JTable panel. I have class
I'm having a problem with a custom NSPopUpButtonCell in a table that's instantiated when
I am having weird problem, I am having a user click button to choose
Good day! I am having a problem in showing the data that I need
I am having a problem with a table and showing another view when the
I'm having problem with custom VertexRenderingFunction showing at different sizes for different graphs. An
Hey, well I'm having a problem and this weird symbol is showing up â€
I am having problem with previewing custom performance counters with PerflibV2. Performance Monitor shows
I'm having problem with datagrid view. I have attached an image with the code
I am having a problem that is strange to me but hopefully is not

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.