Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

android - intent

 
paul beppe
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi everybody!!!

i have problem with Intent in Android...

in my project i have 2 Activity...the Main ACTYVITY and the second activity...

In second Activity i have one ListView and when i click to lis,t go to in MainActivity for show the result row...

but i have the problem in MainActivit when open for fist or when open the MainActivity without click on listView in second Activity;

This is the code of MainActivity:


The problems is when open the MainActivity...

how to do???

help me please!!!
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is "the problem"? Remember that we don't have your app running, so we have no idea what's happening. What exactly is happening if you do what, and what would you like to have happen instead? (Yes, that's 3 questions :-)
 
paul beppe
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i will read all cod:
this is MainActivity:


if you copy code you can understand my problem!!!

when i start the MayActivity show error!!! don't want this error!!!
help!!!
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not going to run your code, that's way more effort than I'm willing to expend. Maybe someone else will step in, but if you're not willing to post a problem description, I doubt it.
 
paul beppe
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the problem is in:



when I launch the program this code prevents operation of MainActivity...but this code is important when i click on ListView in second Activity for show row of listView in MainActivity...how i can to use this code without problem???

i hope you can understand my problem....
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
While you haven't told us what exactly happens, I'm guessing that "bookName" is null when the app first launches, and there's an exception because the code doesn't check for that. (Hint: the logcat output contains the full stack trace if there's a crashing exception - ready for copy/paste.)

Why don't you just put the code that should only execute if launched from Lista in an if-block that only executes if "bookName" has been passed in?
 
paul beppe
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi!! i have understand the problem!!!

i have edit my code:



with "if" i haven't problems!!! thank's
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic