I run this
Toast toast = new Toast(getApplication());
toast.setDuration(Toast.LENGTH_LONG);
toast.setView(toastView);
toast.show();
from a service. Shows reliably on top of everything even if the
application is not there.
On Mar 15, 3:29 pm, ClarkBattle <[email protected]> wrote:
> Nope. That doesnt work either.
>
> Here is my code for the activity that responds to the QSB. You'll see
> that I am using the application context for the toast.
> My app shows with the toast over it. If it is possible to show a
> toast over the QSB then how? (Example code)
>
> public class GlobalSearchActivity extends Activity
> {
> @Override
> protected void onCreate( Bundle savedInstanceState )
> {
> super.onCreate( savedInstanceState );
>
> String extra =
> getIntent().getStringExtra( SearchManager.EXTRA_DATA_KEY );
> if( extra == null )
> finish();
>
> if( ActivityHelpers.isOffline() )
> {
> String message = "You can not view this content while
> offline";
> Toast.makeText( getApplicationContext(), message,
> Toast.LENGTH_SHORT).show();
> finish();
> }
> else
> {
> Intent myIntent = new Intent( this,
> SplashScreen.class );
>
> myIntent.setAction( getIntent().getAction() );
> Bundle extras = getIntent().getExtras();
> if( extras != null && extras.size() > 0 )
> myIntent.putExtras( extras );
>
> try
> {
> this.startActivity( myIntent );
> }
> catch( ActivityNotFoundException
> activityNotFoundException )
> {}
>
> finish();
> }
> }
>
> }
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en