i am new to the android and so i was just trying to make a simple application which takes an integer data,rather a mobile no. from one activity to the another (in both activities it is stored in the edittext). i used the following code in the sender activity-
done.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
Intent i=new Intent(ctx,MainActivity.class);
i.putExtra("number", Long.parseLong(edittext.getText().toString()));
ctx.startActivity(i);
}
});
following is the receiving code in the receiver activity–
num=getIntent().getIntExtra("number", set_default);
accept(num);
protected void accept(long t) {
// TODO Auto-generated method stub
edittext=(EditText)findViewById(R.id.editText1);
String a=(edittext.getText().toString()+t);
clear(edittext);
edittext.append(a);
}
private void clear(EditText edittext) {
// TODO Auto-generated method stub
edittext.setText("");
}
num is of type long.
the problem with the above code is that it is working correctly upto the 8 digits of numbers but not with 9 digit onwards.
previously i used int with num and int.parseInt with putExtra in sender activity,but changed to long after the problem, but it retains.
can anyone plz help me out with this??
You’re still using
getIntExtra. UsegetLongExtra.