This week's book giveaway is in the Design forum.
We're giving away four copies of Experimentation for Engineers: From A/B testing to Bayesian optimization and have David Sweet on-line!
See this thread for details.
  • 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
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

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 ?
 
Bartender
Posts: 7488
171
  • 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.
 
Why does your bag say "bombs"? The reason I ask is that my bag says "tiny ads" and it has stuff like this:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic