• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Intent doesn't work from onClickListener

 
Ranch Hand
Posts: 36
Android Java ME
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello ..to make long story short, root of my problem and my frustation :

I am making an app with two Floating Buttons

When user click my floating button he will be able to go to dial up screen and call phone number.For some reason doesn't work..

I already have intent,in the same activity, where he will able to go to SMS screen and be able to send a text.For some reason work just fine.

in first case nothing happened.If i put Toast in onClick listener also nothing happens.I just do not know why. Do i need to put another activity in my manifest? but this is not new activity?how to name it in my manifest....or problem is something completly different. When i say nothing happens...well nothing happens.There is no error,or some strange behavior or something else.There is no error message in my LogCat also. It is completly possible to mess up intent but my toast message also doesn't pop up.What leeds me to conclusion that i messed up something with onClickListener. But what?it is completly normal, like other listeners that i used before.Or i am just tired to see elephant in the room. I am on my computer for about 10ish hours

My full code:


my full xml code:


My "problematic" onClickListener is second one..this one:




 
Ranch Hand
Posts: 570
3
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Remove the intent first. Check Toast get displayed or not.
 
John Joe
Ranch Hand
Posts: 570
3
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should never add Toast after startActivity(intent);. I guess Toast will never get called because your application have intent to  ACTION_DIAL....maybe ?
 
Saloon Keeper
Posts: 7600
177
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

You should never add Toast after startActivity(intent);


No, it will get called, but you might not see it because it's tied to the activity - which gets switched out. Better to use android.util.Log to write something to the logcat output.
 
On my planet I'm considered quite beautiful. Thanks to the poetry in this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic