Monday, March 3, 2014

android-value problems between the different activity


I define a class, which defines the activity I need to pass other variables,
package com.example.moi;
import android.app.Application;
public class Declare extends Application
{
private String pwd = "";
private String shopname = "";
private String position = "";
private String shelfheap = "";
private String shelfno = "";
public void setUser (String pwd)
{
this.pwd = pwd;
}

public String getUser ()
{
return this.pwd;
}


public void setShopname (String shopname)
{
this.shopname = shopname;
}
public String getShopname ()
{
return this.shopname;
}

public void setPosition (String position)
{
this.position = position;
}
public String getPosition ()
{
return this.position;
}


public void setShelfheap (String shelfheap)
{
this.shelfheap = shelfheap;
}
public String getShelfheap ()
{
return this.shelfheap;
}


public void setShelfno (String shelfno)
{
this.shelfno = shelfno;
}
public String getShelfno ()
{
return this.shelfno;
}
}
In the first user login activity, pwd = pwdedittext.getText () toString ();.
. ((Declare) getApplication ()) setUser (pwd);
Then in the third activity, String pwd = ((Declare) getApplicationContext ()). GetUser () ;/ / user pass over the job number, job number is always the result of user pass, however, do not know why the trouble to see heroes look, thank you.
Note: Other variables in the second activity, using the same method can be passed to a third activity, is the first activity of the user job number does not reach the third activity. . Hurry!<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Store user information is best not to do so.
Comes to passwords, encrypted storage is best, you can use SQLCipher, using AES encryption, but this will increase the volume apk's: Android proper use SQLCipher to encrypt the database
If no requirements for information security and want to save it with a simple point SharedPreferences or SQLite, so you can always come up with.
Reply:
cited a floor tantahe reply:
store user information is best not to do so.
Comes to passwords, encrypted storage is best, you can use SQLCipher, using AES encryption, but this will increase the volume apk's: Android proper use SQLCipher to encrypt the database
If no requirements for information security and want to save it with a simple point SharedPreferences or SQLite, so you can always come up with.

I do not ask for information security here is that the user wants the job number from the first activity reached the third activity, then execute insert statement, stored in sqlite database, but also expert guidance.
Reply:
Jump from the first activity to the third activity it? When jump-value Well, anyway, are the basic data types.
The value placed intent inside
Reply:
reference to the third floor guoyoulei520 reply:
activity from the first to the third activity of the jump you jump when the value of a good pass, anyway? are the basic data types.
The value placed intent inside

Not from the first activity to jump to the third activity, the middle of the second activity
Reply:
references, 4th Floor lhx200610930202 reply:
Quote: references to the third floor guoyoulei520 reply:

Jump from the first activity to the third activity it? When jump-value Well, anyway, are the basic data types.
The value placed intent inside

Not from the first activity to jump to the third activity, the middle of the second activity

Same.
The first pass second, second and then take out the value of the package into the intent, passed the third. Flower drum transfer
Reply:
references
first pass second, second and then take out the value of the package into the intent, passed the third. Flower drum transfer

Reply:
reference to the 6th floor xiongyanbing123123 reply:
references
first pass first two, the second and then take out the value of the package into the intent, passed the third. Flower drum transfer

Thank you for your answer, I use flower drum transfer approach really pass over values, thanks thanks.
Reply:
references, 5th Floor tantahe reply:
Quote: references to the 4th floor lhx200610930202 reply:

Quote: references to the third floor guoyoulei520 reply:

Jump from the first activity to the third activity it? When jump-value Well, anyway, are the basic data types.
The value placed intent inside

Not from the first activity to jump to the third activity, the middle of the second activity

Same.
The first pass second, second and then take out the value of the package into the intent, passed the third. Flower drum transfer


Thank you all God's answer, thank you very much. Results posted satisfied

No comments:

Post a Comment