How to creat Toast Like view

by Tushar » Wed, 11 Mar 2009 16:16:51 GMT


Sponsored Links
 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 ?
--~--~---------~--~----~------------~-------~--~----~



How to creat Toast Like view

by Gulfam » Wed, 11 Mar 2009 20:26:20 GMT


 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



--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


How to creat Toast Like view

by mark . kahrl » Fri, 13 Mar 2009 06:31:31 GMT


 Did you look at PopupWindow in the /widgets package? it is toast
like, but persist until the user closes it.


                    Mark




--~--~---------~--~----~------------~-------~--~----~



How to creat Toast Like view

by gymshoe » Fri, 13 Mar 2009 11:13:36 GMT


  http://www.anddev.org/2_ways_to_implement_a_toast-t3164.html 




--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. A couple of Rom questions for the experts

I have a couple of questions for the Rom developers/experts on here
regarding things that can be done with Android ROM's.

Is a parser Rom upgrade possible? So is it possible to change a small
part of a ROM and then allow users to upgrade their ROM easily?

So can I change a part of a ROM and then a customer can upgrade to the
newer ROM without having to be technically savvy and needing to root
and flash their devices?

Can a change be burnt into a ROM so that when a user selects "Restore
Factory Settings" that it doesn't remove the upgrade to the ROM?

So essentially I want to know if its possible (with a device
manufacturers permission) to add to a ROM some small additional parts
and then give this new ROM version as a firmware upgrade to the device
so that a user only has to "upgrade" and not go through the process of
rooting and flashing there device?

-- 

2. Pagi....OOT : Ask TFlash

Boys&Girls...., ada titipan pertanyaan dari temen...

Apa APN TFlash Unlimited berubah ? Soalnya katanya dari semalam sampe detik
ini gak bisa internetan baik di HH Android or di PC/Notebook ---> pake modem
kali ya

Sy sendiri sih ada, tp dah 2 bulan gak pernah di pake, bayar doang :P , kalo
mau nutup udah telat ya

-- 
Salam,
Jus
~ pake web google mail ajah ~
http://jus2005.multiply.com/

-- 
"Indonesian Android Community [id-android]" 

3. Compiling and porting Open source android to Nexus One

4. Yellow colored background on button click

5. Closed: Pagi....OOT : Ask TFlash

6. Wifi drop Issues on Motorola Droid

7. Help Cara Menggembalikan partisi sdcard ke kapasitas semula