Results 1 to 3 of 3
- 10-02-2012, 11:11 PM #1
Member
- Join Date
- Aug 2009
- Posts
- 4
- Rep Power
- 0
Change a public boolean value from another activity
I have created a Public boolean in main window. that when its true will finish the main activity.
the question is now how i change that value from another activity.
i have spend over 24 hours on this problem and must accept i cant seem to figure it out myself:/
this is my code from the screen that need to be closed.
and this is the code from the window that i need to change the boolean value from.Java Code:public static Boolean CanIClose = false; @Override public void onResume(){ super.onResume(); Intent intent = getIntent(); if (CanIClose.equals(true)){ NewShoppingListMainScreen.this.finish(); } }
Java Code:public void dlgexitbtn(View view){ Intent intent = new Intent(this, NewShoppingListMainScreen.class); intent.putExtra("true", NewShoppingListMainScreen.CanIClose); NewShoppingListMainScreen.CanIClose.equals(true); this.finish(); }
My quess is i need to use intent to pass the value or change it. But im fairly new and cant seem to figure it out:/
Hope that i can be helped and best regards from MarkLast edited by Darkyere; 10-02-2012 at 11:56 PM.
- 10-03-2012, 09:35 AM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Re: Change a public boolean value from another activity
That's not setting the value.Java Code:NewShoppingListMainScreen.CanIClose.equals(true);
That's simply comparing CanIClose with 'true'.
Try:
Java Code:NewShoppingListMainScreen.CanIClose = Boolean.TRUE;
Please do not ask for code as refusal often offends.
- 10-03-2012, 10:41 AM #3
Member
- Join Date
- Aug 2009
- Posts
- 4
- Rep Power
- 0
Similar Threads
-
Loading soundpool and music in activity A and calling in Activity B
By N00Bie in forum AndroidReplies: 0Last Post: 10-01-2011, 04:14 AM -
Boolean.True and Boolean.False, why do some people use these?
By Pojahn_M in forum New To JavaReplies: 3Last Post: 09-13-2011, 12:01 AM -
Passing Variable from a New Activity to an Old Activity
By rolledback in forum AndroidReplies: 1Last Post: 09-12-2011, 02:09 AM -
Why wont my boolean variable change?
By equal in forum New To JavaReplies: 8Last Post: 02-22-2011, 10:43 PM -
Err:java.io.IOException: public key ring doesn't start with public key tag
By Deepa in forum New To JavaReplies: 5Last Post: 06-26-2009, 03:03 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks