Click here to Skip to main content
15,891,607 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I have this code to passing array to other activity I need enter the number to int array from user and then pass it. how can do this?

first activity

Java
public void onclick(){
		Intent i = new Intent(MainActivity.this, Second.class);
		i.putExtra("numbers", array);
		startActivity(i);
	}

second activity
Java
Bundle extras = getIntent().getExtras();
int[] arrayB = extras.getIntArray("numbers");

 textView.setText( ":val:" +arrayB[1]);
finish();
Posted
Updated 9-Mar-15 6:17am
v4

1 solution

Second activity:
Intent intent = getIntent();
int[] arrayB = intent.getIntArrayExtra("numbers"); 
textView.setText( ":val:" +arrayB[1]);
finish();
 
Share this answer
 
Comments
[no name] 10-Mar-15 13:54pm    
??!! I need enter the number to int array from user

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900