Note that there are some explanatory texts on larger screens.

plurals
  1. POToast String display object instead of Text
    text
    copied!<p>In my code,I want to display <strong>TextView</strong> 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.</p> <p>In <strong>Toast</strong> I want to display the Text please guide me if possible. Here is my code :</p> <pre><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 &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;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"&gt; &lt;LinearLayout android:id="@+id/LinearLayout03" android:layout_width="wrap_content" android:layout_height="wrap_content"&gt; &lt;Button android:id="@+id/Button01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Next"&gt;&lt;/Button&gt; &lt;Button android:id="@+id/Button02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Previous"&gt;&lt;/Button&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:id="@+id/LinearLayout02" android:layout_width="wrap_content" android:layout_height="wrap_content"&gt; &lt;ViewFlipper android:id="@+id/ViewFlipper01" android:layout_width="wrap_content" android:layout_height="wrap_content"&gt; &lt;!--adding views to ViewFlipper--&gt; &lt;TextView android:id="@+id/TextView01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/a10" android:text="one"&gt;&lt;/TextView&gt; &lt;TextView android:id="@+id/TextView02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/a11" android:text="two"&gt;&lt;/TextView&gt; &lt;TextView android:id="@+id/TextView03" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/a12" android:text="three"&gt; &lt;/TextView&gt; &lt;TextView android:id="@+id/TextView04" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/a13"&gt;&lt;/TextView&gt; &lt;TextView android:id="@+id/TextView05" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/a14"&gt;&lt;/TextView&gt; &lt;TextView android:id="@+id/TextView06" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/a15"&gt;&lt;/TextView&gt; &lt;/ViewFlipper&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload