Android Forums

Go Back   These FORUMS ARE DISABLED!! OUR NEW FORUMS ARE AT http://androidforum.com/ > Android Coders > Android Development, Answers, Tutorials, and Code Snippets
Connect with Facebook

Click Here To Register!
 
 
LinkBack Thread Tools Display Modes
Old 11-16-2009, 07:55 AM   #1
Junior Member
 
Join Date: Nov 2009
Posts: 3
Friends: 0
View ganesh4it's Profile   View ganesh4it's Photo Album   View ganesh4it's Blog   View Social Groups
Hi All,

Am very new to andriod tech.
Somehow I come to know about Toast.makeText.
It displays the message at the bottom of my application.

I want to align this toast dialog anywhere in the screen. Is it possible?

How to achieve this?

I tried the following as well but am not success.

Toast tost = new Toast(this);
tost.setGravity(Gravity.TOP, 20, 30);
tost.setDuration(Toast.LENGTH_LONG);
tost.setText("Sucess . . ");
tost.show();
===========================

plz help me out.
ganesh4it is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in Technorati
Old 11-28-2009, 09:37 AM   #2
Junior Member
 
Join Date: Nov 2009
Posts: 3
Friends: 0
View appforce.org's Profile   View appforce.org's Photo Album   View appforce.org's Blog   View Social Groups
Hi,

You can't change the position of Toast, it's position is hardcoded. If you want to show a notification from your foreground Activity, you can use some arbitrary View, Toast is mostly useful for notifying from background.
appforce.org is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in Technorati
Old 11-28-2009, 11:50 PM   #3
Junior Member
 
Join Date: Nov 2009
Posts: 3
Friends: 0
View ganesh4it's Profile   View ganesh4it's Photo Album   View ganesh4it's Blog   View Social Groups
Thanku appforce.

In your reply you mentioned as by using some arbitrary View we can change the position.

How it is possible. Can you please guide me.?

Tnx in advance.
ganesh4it is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in Technorati
Old 11-29-2009, 12:28 AM   #4
Junior Member
 
Join Date: Nov 2009
Posts: 3
Friends: 0
View appforce.org's Profile   View appforce.org's Photo Album   View appforce.org's Blog   View Social Groups
Hi,

Sorry about my mistake, it's possible to show Toast on different positions, here's an example of absolute positioning:

Toast toast = Toast.makeText(this, "Hello!", Toast.LENGTH_LONG);
toast.setGravity(Gravity.TOP | Gravity.LEFT, 20, 20);
toast.show();
appforce.org is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in Technorati
 

Thread Tools
Display Modes




Unlocked G1 Phones | Buy T-Mobile G1 | Google Phone

All times are GMT -6. The time now is 04:46 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.
Copyright (c) 2012 TalkAndroid.com. All rights reserved.