I am writing a app, and basically I want to carry accross a variable
from one java file to another.
So from my first java file I am calling the second one by:
setContentView(R.layout.saveimage);
//Intent i = new Intent(anyView.getContext(),
AndroidWebImage.class);
Intent i = new Intent(arg0.getContext(),
AndroidWebImage.class);
i.putExtra("ImagePosition", picurepos);
startActivity(i);
Which loads up the new page fine, but then causes a error and forces
close. When playing about with the code of the java file i am going
to, which is:
Intent intent = getIntent();
int position = intent.getIntExtra("ImagePosition", -1);
String picposition = Integer.toString(position);
This causes the force close. But if I remove the above and put the
line
String picposition= "10";
The app doesn't force close, but then I haven't carried the needed
varable over. My manifest refrence is:
<activity android:name=".SavePicture"
android:label="@string/SavePicTitle"
android:screenOrientation="portrait"
>
<intent-filter>
<action
android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
The one variable i need to carry accross is 'picturepos'. Thank you
in advance....
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en