i want to use values of number picker and spinner together in a way that after selecting value of spinner and then number picker user enters search and this will stat another ac
It looks like you are looking for how to pass data between activities. First, you will have to make your NumberPicker
global:
private Spinner mSpinner;
private NumberPicker mNumberPicker;
With this in mind, you can send your data to a new Activity
with an Intent
like so:
Intent intent = new Intent(v.getContent(), ListItem.class);
intent.putExtra(ListItemActivity.EXTRA_MAJOR, mSpinner.getSelectedItem().toString());
intent.putExtra(ListItemActivity.EXTRA_INT, mNumberPicker.getValue());
startActivityForResult(intent, 0);
Then you can receive the data in your new Activity
with getIntent()
:
public class ListItemActivity extends AppCompatActivity {
public static final String EXTRA_MAJOR = "list_item:major";
public static final String EXTRA_INT = "list_item:int";
private int mInteger;
private String mMajor;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_item);
Intent intent = getIntent();
mMajor = intent.getStringExtra(EXTRA_MAJOR);
mInteger = intent.getIntExtra(EXTRA_INT);
}
}