Hi Tushar

You can make toast like this

public void showAlertMessage(Context context, String text){

        LayoutInflater inflater = (LayoutInflater)context.getSystemService
(Context.LAYOUT_INFLATER_SERVICE);
        View view = inflater.inflate(R.layout.toast_layout, null);
        // set the text in the view
        TextView message = (TextView) view.findViewById(R.id.toast_message);
        message.setText(text);
        ImageView image = (ImageView)view.findViewById(R.id.toast_image);
        image.setImageResource(R.drawable.logo_icon);

        Toast toast = new Toast(context);
        toast.setView(view);
        toast.setDuration(Toast.LENGTH_LONG);
        toast.show();


    }


AND XML would be like this

<?xml version="1.0" encoding="utf-8"?>


        <FrameLayout
                        
xmlns:android="http://schemas.android.com/apk/res/android";
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:background="@android:drawable/toast_frame">

        <LinearLayout
                        android:orientation="horizontal"
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content">

        <ImageView
                android:id="@+id/toast_image"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"/>
                                <!-- android:src="@drawable/vopium_logo_icon"
                        /> -->

        <TextView
                        android:id="@+id/toast_message"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"/>

                </LinearLayout>
        </FrameLayout>
*********************************************
another way to make toast is

Toast.makeText(context,"Any String",Toast.LENGTH_LONG).show();

Hope fully it will help u

Regards
Gulfam

On Mar 11, 1:16 pm, Tushar <tusharpatu...@gmail.com> wrote:
> Hi,
>
> Using android.widget.Toast one can created  floating view over the
> application. I would like to created similar view which will float on
> top of all running applications at a specified location. Any thoughts
> on what should I need to do for this. I tried to created activity by
> setting
> android:windowIsFloating ="true" , but didn't worked out.
>
> Any suggestions ?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to