我想从下面的代码
之外获取Action Bar下拉导航的选定项目值kiss_fft_cpx convolution(kiss_fft_cpx *a, kiss_fft_cpx *b, int size)
{
kiss_fft_cpx r[size];
memset(r,0,size*sizeof(kiss_fft_cpx));
int skalar = size * 2; // for the normalisation
for (int i = 0; i < size; ++i){
r[i].r = ((a[i].r/skalar) * (b[i].r)/skalar) - ((a[i].i/skalar) * (b[i].i)/skalar);
r[i].i = ((a[i].r/skalar) * (b[i].i)/skalar) + ((a[i].i/skalar) * (b[i].r)/skalar);
}
return r;
}
我想从下面的代码
中获取所选项目@Override
public boolean onNavigationItemSelected(int itemPosition, long itemId) {
mSelected.setText("Selected: " + mLocations[itemPosition]);//I want this selected item from the below code
答案 0 :(得分:0)
无论如何,我提出了这样的解决方案,但我不知道这样做是否是个好主意
public TextView tv_selected_item_value;
@Override
public boolean onNavigationItemSelected(int itemPosition, long itemId) {
mSelected.setText("Selected: " + mLocations[itemPosition]);
tv_selected_item_value = (TextView)findViewById(R.id.text);
tv_selected_item_value.setText(mLocations[itemPosition]);}
@Override
public boolean onContextItemSelected(android.view.MenuItem item) {
selected_item_value = (TextView)findViewById(R.id.text);