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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:01:51+00:00 2026-05-31T20:01:51+00:00

In my code,I want to display TextView text name as Toast message. I do

  • 0

In my code,I want to display TextView text name as Toast message.
I do following coding for that .I didn’t get the proper text only object of that text I got.

In Toast I want to display the Text please guide me if possible.
Here is my code :

 package com.Viewflipper;

    import android.app.Activity;
    import android.os.Bundle;
    import android.view.View;
    import android.view.View.OnClickListener;
    import android.widget.Button;
    import android.widget.Toast;
    import android.widget.ViewFlipper;

    public class Viewflipper extends Activity implements OnClickListener {
        /** Called when the activity is first created. */
         Button next;
         Button previous;
         ViewFlipper vf;

         /** Called when the activity is first created. */
         @Override
         public void onCreate(Bundle savedInstanceState) {
                 super.onCreate(savedInstanceState);
                 setContentView(R.layout.main);
                 vf = (ViewFlipper) findViewById(R.id.ViewFlipper01);
                 next = (Button) findViewById(R.id.Button01);
                 previous = (Button) findViewById(R.id.Button02);
                 next.setOnClickListener(this);
                 previous.setOnClickListener(this);
         }

         @Override
         public void onClick(View v) {
                 // TODO Auto-generated method stub
                 if (v == next) {
                         vf.showNext();
                         Toast.makeText(this,vf.toString(), Toast.LENGTH_SHORT).show();

                         **//HERE I DIDN'T GET vf.getText().toString();**

                 }
                 if (v == previous) {
                         vf.showPrevious();
                 }
         }
    }

**EDITED**


main.xml


<?xml version="1.0" encoding="utf-8"?>
    <LinearLayout android:id="@+id/LinearLayout01"
        android:layout_width="fill_parent" android:layout_height="fill_parent"
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical">
        <LinearLayout android:id="@+id/LinearLayout03"
            android:layout_width="wrap_content" android:layout_height="wrap_content">
            <Button android:id="@+id/Button01" android:layout_width="wrap_content"
                android:layout_height="wrap_content" android:text="Next"></Button>
            <Button android:id="@+id/Button02" android:layout_width="wrap_content"
                android:layout_height="wrap_content" android:text="Previous"></Button>
        </LinearLayout>

        <LinearLayout android:id="@+id/LinearLayout02"
            android:layout_width="wrap_content" android:layout_height="wrap_content">
            <ViewFlipper android:id="@+id/ViewFlipper01"
                android:layout_width="wrap_content" android:layout_height="wrap_content">
                <!--adding views to ViewFlipper-->
                <TextView android:id="@+id/TextView01" android:layout_width="wrap_content"
                    android:layout_height="wrap_content" android:background="@drawable/a10" 
                    android:text="one"></TextView>
                <TextView android:id="@+id/TextView02" android:layout_width="wrap_content"
                    android:layout_height="wrap_content" android:background="@drawable/a11"
                    android:text="two"></TextView>
                <TextView android:id="@+id/TextView03" android:layout_width="wrap_content"
                    android:layout_height="wrap_content" android:background="@drawable/a12"
                    android:text="three">

                </TextView>
                <TextView android:id="@+id/TextView04" android:layout_width="wrap_content"
                    android:layout_height="wrap_content" android:background="@drawable/a13"></TextView>
                <TextView android:id="@+id/TextView05" android:layout_width="wrap_content"
                    android:layout_height="wrap_content" android:background="@drawable/a14"></TextView>
                <TextView android:id="@+id/TextView06" android:layout_width="wrap_content"
                    android:layout_height="wrap_content" android:background="@drawable/a15"></TextView>

            </ViewFlipper>
        </LinearLayout>

    </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-05-31T20:01:52+00:00Added an answer on May 31, 2026 at 8:01 pm

    Try This:-

       package com.Viewflipper;
    
    import android.app.Activity;
    import android.os.Bundle;
    import android.view.View;
    import android.view.View.OnClickListener;
    import android.widget.Button;
    import android.widget.Toast;
    import android.widget.ViewFlipper;
    
    public class Viewflipper extends Activity implements OnClickListener {
        /** Called when the activity is first created. */
         Button next;
         Button previous;
         ViewFlipper vf;
    
         /** Called when the activity is first created. */
         @Override
         public void onCreate(Bundle savedInstanceState) {
                 super.onCreate(savedInstanceState);
                 setContentView(R.layout.main);
                 vf = (ViewFlipper) findViewById(R.id.ViewFlipper01);
                 next = (Button) findViewById(R.id.Button01);
                 previous = (Button) findViewById(R.id.Button02);
                 next.setOnClickListener(this);
                 previous.setOnClickListener(this);
         }
    
         @Override
         public void onClick(View v) {
                 // TODO Auto-generated method stub
                 if (v == next) {
                          vf.showNext();
                         Toast.makeText(getApplicationContext(),((TextView) vf.getCurrentView()).getText(), Toast.LENGTH_SHORT).show();
    
    
                 }
                 if (v == previous) {
                         vf.showPrevious();
                 }
         }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to concat two text and display with single TextView in Android. I
I want to display image in TextView with text, I had used Html.ImageGetter but
I have the following code for my dialog box, I want to get some
I want to display some text below each grid image. Please see my code
Using VB.NET I want to display the date in datetimepicker from the database. Code.
For the most part, when I want to display some HTML code to be
I want to perform a printf() to display when the currently executing code was
I want a php page to 'display' a pdf. Here is the code: <?php
In the following code I want to replace every occurrence of U.S.A with united
In my code I want to send two parameters in my data. Name is

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.