[android-developers] Re: When the new activity starts, the data of previous activity is gone.

2010-01-02 Thread android09
Hi Rui Wu,

I got the solution of get back to the first activity by pressing
previous button without changing data of first activity. Now, the user
will enter his credentials. When he click to proceed further, the
credential details will directly go to the server and server gives
response with the cookie and that cookies should be store in my phone
for the usage for the future. It means that when the user again run
the application he should directly loggedin in to the application,
e.g., www.mail.yahoo.com.

If you have any idea as mentioned above, please share me.

Thanks.

Regards,
---
Pranav

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: When the new activity starts, the data of previous activity is gone.

2010-01-01 Thread Rui Wu
Hi Pranav,
I didn't catch the point for your second problem. Do you want to pass the
value of edittext in first activity to second activity, then show the
strings in the edittext of second activiy. If so, you can try in the similar
way as the first problem.
BRs,
Rui


2010/1/1 android09 pranav.jaja...@gmail.com

 Hi Rui Wu,

 Thanks a lot. It works very good and perfectly as i want. Now, i know
 that where was my problem. Actually, i had not added this line/lines :
mData.strFirstName = edFirstName.getEditableText().toString();.
 That's why i was not getting any result.

 Now, i got it. I have also one query. I have two activities. First
 activity consist on edittext and button whereas second activity
 consist only edittext. When i write in edittext of first activity and
 press a button of first activity than the edittext of second activity
 should get the same string. Actually, i want to get the email id from
 the first activity and also it should be automatically get in the
 edittext of second activity.

 If you have any idea about it, please tell me. Again thanks for help
 me out from this problem.

 Regards,
 --
 Pranav

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
BRs,
Rui

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: When the new activity starts, the data of previous activity is gone.

2010-01-01 Thread android09
Hi Rui Wu,

I got the solution of the second problem. Actually, i have used the
same string value for the both fields. It means i have used the same
string value for the edittext in the first activity as well as in
second activity which has also one edittext. When i press next button
it takes the string, entered by the user and it shows in the edittext
of the second activity.

By the way, thank you for communicating with me.

Regards,

Pranav

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: When the new activity starts, the data of previous activity is gone.

2009-12-31 Thread android09
Hi netiger198610 and Lance Nanek,

First of all thank you for reply me. Now i am coming to the point.

Yes, netiger, i want exactly this thing, that whenever the new
activity starts, the data should not go elsewhere it should be there
when i press Previous button of my project(do not consider the back
button of emulator, but i want the same functionality like that.).

How can i do that can you give me an example or any idea, how to do
that. I really need it because i can't go further more without getting
the data from the previous activity.

Please give me any idea or example of to hold the data in the previous
activity when the new activity is started.

Thank you.
Regards

Pranav

On Dec 30, 8:12 pm, netiger198610 netiger198...@gmail.com wrote:
 Hi,
 Do you mean the new activity will uses the previous activity's data? If so, 
 you can pass the data in Intent which start the new activity.

 --
 I'm Tiger

 -- Original --
 From:  android09pranav.jaja...@gmail.com;
 Date:  Wed, Dec 30, 2009 08:49 PM
 To:  Android Developersandroid-developers@googlegroups.com;

 Subject:  [android-developers] When the new activity starts, the data of 
 previous activity is gone.

  Hi,

 I am developing an application in which the user require to register
 first and than got the user page. For that i have made layout and the
 layout consist many fields, so, i have made part of layout and also
 made the separate activity for the each layout. The layout like
 address, phone, etc...

 After that i have wrote the code for calling an activity and it works
 fine. It means when i press the Next button the another page will
 come and it will also consist some textview ,edittext and previous and
 next button. Actually, i want something different like -- When the
 user fill the first form and he will proceed to next, the content
 written by the user should not gone when the user press Next button.
 The content should be there which was written by user. And same way i
 have have 6 pages like that way to complete the registration process.

 So, have you any idea to solve above problem? I really need your help
 because right now i stuck at this point. So, please any body help me
 out of this problem. I would appreciate your help. I am waiting for
 your reply.

 Thanks,
 -
 Pranav

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group 
 athttp://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: When the new activity starts, the data of previous activity is gone.

2009-12-31 Thread Neilz
Well, surely you just need to populate the fields within the onCreate
() methods?

1) Have an object in the Activity which holds the data that the user
enters. (Populate them when the user moves to the next activity).

2) On the next Activity, if the user presses the 'Previous' button,
pass in Intent which indicates that the user is coming back from that
activity.

3) When the original activity is called again, check for the presence
of the Intent, and if it's coming back from the other activity, the
data will already be populated in your object, which you can use to
populate the various text fields.

Hope that helps...

On Dec 31, 11:15 am, android09 pranav.jaja...@gmail.com wrote:
 Hi netiger198610 and Lance Nanek,

 First of all thank you for reply me. Now i am coming to the point.

 Please give me any idea or example of to hold the data in the previous
 activity when the new activity is started.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: When the new activity starts, the data of previous activity is gone.

2009-12-31 Thread Neilz
In fact, even simpler...

Just have an object in your activity which holds the data from the
fields. Then everytime the activity loads, populate the fields from
the onResume() method, if the object and the data exists.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: When the new activity starts, the data of previous activity is gone.

2009-12-31 Thread android09
Hi Neilz,

Thank you for reply me with the proper and useful idea. I tried to
hold the first activity data but it gives error while loading the
data. It is not allows me to get data back.

Can you understand me by the code? How can i hold the first activity's
data when i start another activity and get back to previous. I also
tried with the onPause() and onResume() methods. How can i do that
with the code? Please help me.

Thank you.
Regards,
---
Pranav

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: When the new activity starts, the data of previous activity is gone.

2009-12-31 Thread Rui Wu
Hi Pranav,
I guess you implemented your logic like this:

Button previous = (Button) findViewById(.);
previous.setOnClickListener(new OnClickListener(){
   public void onClick(View v) {
Intent i = new Intent();
i.setClassName(the name of the previous activiy.);
startActivity(i);
 }});


Try the below way:
Button next = (Button) findViewByid(.);
 next.setOnClickListener(new OnClickListener(){
   public void onClick(View v) {
Intent i = new Intent();
i.setClassName(the name of the next activity.);
i.putExtra();... //to pass this activity's data to next
startActivity(i);
 }});

 Button previous = (Button) findViewById(.);
previous.setOnClickListener(new OnClickListener(){
   public void onClick(View v) {
finish();
 }});

What you need to do is passing the current activity's data to next
Activity;  When you press the Prev button, you will find Android keeps
the inputed strings  in the EditText and other editable views
automatically...
Hope this can help you.

2009/12/31 android09 pranav.jaja...@gmail.com

 Hi Neilz,

 Thank you for reply me with the proper and useful idea. I tried to
 hold the first activity data but it gives error while loading the
 data. It is not allows me to get data back.

 Can you understand me by the code? How can i hold the first activity's
 data when i start another activity and get back to previous. I also
 tried with the onPause() and onResume() methods. How can i do that
 with the code? Please help me.

 Thank you.
 Regards,
 ---
 Pranav

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: When the new activity starts, the data of previous activity is gone.

2009-12-31 Thread Rui Wu
Hi Pranav,
The way in the previous mail has an issue: if user inputs sth. in Current
activiy named Activity2, then Presses Prev, the previous Acitivy named
Activity1 does keep the inputed contents in UI, however when user
presses Next here to go to Activity2, Activity2 will not keep the data
inputed by user.

Another solution: Construct a Class for your registration info i.e. Person
which implements Serializable interface.

1. For each activiy,  implements the 2 buttons' logic like this:
 next.setOnClickListener(new OnClickListener(){
   public void onClick(View v) {
update person according to the cotents inputed by user
Intent i = new Intent();
i.setClassName(the name of the next activity.);
i.putExtra(Person, person);... //to pass this activity's data
to next
startActivity(i);
finish();
 }});

 previous.setOnClickListener(new OnClickListener(){
   public void onClick(View v) {
   update person according to the contents inputed by user
   Intent i = new Intent();
i.setClassName(the name of the previous activity.);
i.putExtra(Person, person);... //to pass this activity's data
to next
startActivity(i);
finsh();
 }});
 Of course, special logic is needed for the first activity's Back button 
the last activity's Next button;

2. Add below code in OnCreate() :

Intent i = getIntent();
person = (Person)i.getSerializableExtra(Person);
if(person != null) {
update the editable ui controls according to the value of person's
member variables
}  else {
person = new Person();   // this will only happen in the first activiy
}

3.  For the back key handle, use the same logic as Prev button to
set onKeyListener for the activiy.

BRs,
Rui

2010/1/1 Rui Wu netiger198...@gmail.com


 Hi Pranav,
 I guess you implemented your logic like this:

 Button previous = (Button) findViewById(.);
 previous.setOnClickListener(new OnClickListener(){
public void onClick(View v) {
 Intent i = new Intent();
 i.setClassName(the name of the previous activiy.);
 startActivity(i);
  }});


 Try the below way:
 Button next = (Button) findViewByid(.);
  next.setOnClickListener(new OnClickListener(){
public void onClick(View v) {
 Intent i = new Intent();
 i.setClassName(the name of the next activity.);
 i.putExtra();... //to pass this activity's data to next
 startActivity(i);
  }});

  Button previous = (Button) findViewById(.);
 previous.setOnClickListener(new OnClickListener(){
public void onClick(View v) {
 finish();
  }});

 What you need to do is passing the current activity's data to next
 Activity;  When you press the Prev button, you will find Android keeps
 the inputed strings  in the EditText and other editable views
 automatically...

 Hope this can help you.

 2009/12/31 android09 pranav.jaja...@gmail.com


 Hi Neilz,

 Thank you for reply me with the proper and useful idea. I tried to
 hold the first activity data but it gives error while loading the
 data. It is not allows me to get data back.

 Can you understand me by the code? How can i hold the first activity's
 data when i start another activity and get back to previous. I also
 tried with the onPause() and onResume() methods. How can i do that
 with the code? Please help me.

 Thank you.
 Regards,
 ---
 Pranav

   --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: When the new activity starts, the data of previous activity is gone.

2009-12-31 Thread android09
Hi Rui Wu,

Happy New Year!

Thanks for reply me with the code. I tried for the current activity
which holds the data while the second activity is started and get back
to the current activity by pressing the previous button with using of
your code. But every time i got the NullPointerException error. I can
go on next activity but when i trying to back on the previous
activity, i got an exception.

Here, i have placed my code without added your code and i want that
you just modified this code and reply me. So, can you help me to out
from this problem?

The first.xml file consist two edittext and one button  the
second.xml file consist one button.

FirstActivity.java
--

// Organised imports...

public class FirstActivity extends Activity{

private EditText edFirstName, edLastName;
private Button btnNext;

@Override
public void onCreate(Bundle b){
super.onCreate(b);
setContentView(R.layout.first);

edFirstName = (EditText)findViewById(R.id.editFirst);
edLastName = (EditText)findViewById(R.id.editLast);

btnNext = (Button)findViewById(R.id.btnNext);
btnNext.setOnClickListener(new View.OnClickListener(){

@Override
public void onClick(View v){
Intent intent = new Intent(FirstActivity.this,
SecondActivity.class);
startActivity(intent);
}
});
}
}

SecondActivity.java
---

// Organised imports...

public class SecondActivity extends Activity{

private Button btnPrev;

@Override
public void onCreate(Bundle b){
super.onCreate(b);
setContentView(R.layout.second);

btnPrev = (Button)findViewById(R.id.btnPrevious);
btnPrev.setOnClickListener(new View.OnClickListener(){

@Override
public void onClick(View v){
Intent intent = new Intent(SecondActivity.this,
FirstActivity.class);
startActivity(intent);
}
});
}
}

Thanks,
Regards,
-
Pranav

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: When the new activity starts, the data of previous activity is gone.

2009-12-30 Thread Lance Nanek
http://developer.android.com/guide/appendix/faq/framework.html#3

On Dec 30, 7:49 am, android09 pranav.jaja...@gmail.com wrote:
 Hi,

 I am developing an application in which the user require to register
 first and than got the user page. For that i have made layout and the
 layout consist many fields, so, i have made part of layout and also
 made the separate activity for the each layout. The layout like
 address, phone, etc...

 After that i have wrote the code for calling an activity and it works
 fine. It means when i press the Next button the another page will
 come and it will also consist some textview ,edittext and previous and
 next button. Actually, i want something different like -- When the
 user fill the first form and he will proceed to next, the content
 written by the user should not gone when the user press Next button.
 The content should be there which was written by user. And same way i
 have have 6 pages like that way to complete the registration process.

 So, have you any idea to solve above problem? I really need your help
 because right now i stuck at this point. So, please any body help me
 out of this problem. I would appreciate your help. I am waiting for
 your reply.

 Thanks,
 -
 Pranav

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en