Android 如何在文本视图中显示另一个数组列表元素以及微调器中使用相同数组列表填充的选定项
嗨,我是安卓程序员,当我在spinner中选择商品时,我想在文本视图中显示我的产品价格 因此,我创建了数组列表,并使用product类将json对象转换为数组列表,并使用fundapter在spinner中调整数组 因此,我的微调器在父视图中创建的任何视图上获取数据和膨胀 所以我想,选择我的产品名称,名称是(“نامممحول”),然后这个对象从我的数组列表中加载数据,这样我想获取我在微调器中选择的任何产品的价格,以在文本视图中显示它,该视图的值为“0” 请帮助我确定这个数组列表的位置,它在我的微调器中表示数据,并在文本视图中显示我的价格。请查看我的应用程序图片和代码Android 如何在文本视图中显示另一个数组列表元素以及微调器中使用相同数组列表填充的选定项,android,arraylist,spinner,Android,Arraylist,Spinner,嗨,我是安卓程序员,当我在spinner中选择商品时,我想在文本视图中显示我的产品价格 因此,我创建了数组列表,并使用product类将json对象转换为数组列表,并使用fundapter在spinner中调整数组 因此,我的微调器在父视图中创建的任何视图上获取数据和膨胀 所以我想,选择我的产品名称,名称是(“نامممحول”),然后这个对象从我的数组列表中加载数据,这样我想获取我在微调器中选择的任何产品的价格,以在文本视图中显示它,该视图的值为“0” 请帮助我确定这个数组列表的位置,它在我的
这里是我的json文件 计数=计数+1; LayoutInflater in=getLayoutInflater() 公共价格 }
public void add (View v){
final LinearLayout line = (LinearLayout) findViewById(R.id.parentorder);
final View view=in.inflate(R.layout.packet_list
, line , false);
TextView txt=(TextView)view.findViewById(R.id.textView4);
txt.setText(String.valueOf(count));
TextView co =(TextView)findViewById(R.id.cotxt);
co.setText(String.valueOf(count));
PostResponseAsyncTask task1 = new PostResponseAsyncTask(OrderActivity.this, new AsyncResponse() {
@Override
public void processFinish(String s) {
Log.d(ORD ,s);
product = new JsonConverter<products>().toArrayList(s, products.class);
BindDictionary<products> dict = new BindDictionary<products>();
dict.addStringField(R.id.txtitem, new StringExtractor<products>() {
@Override
public String getStringValue(products product, int position) {
return "" + product.nameproduct ;
}
});
BindDictionary<products> dict1 = new BindDictionary<products>();
dict1.addStringField(R.id.txtcategory, new StringExtractor<products>() {
@Override
public String getStringValue(products product, int position) {
return "" + product.category ;
}
});
adapter = new FunDapter<>(OrderActivity.this , product ,R.layout.spinner_list ,dict);
lvproduct = (Spinner)view.findViewById(R.id.spinner);
lvproduct.setAdapter(adapter);
FunDapter<products> adapter1 = new FunDapter<>(OrderActivity.this , product ,R.layout.category_list ,dict1);
category = (Spinner)view.findViewById(R.id.spinner2);
category.setAdapter(adapter1);
line.addView(view);
lvproduct.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
}
});
task1.execute("http://mybofeh.ir/android/listback");
}
public String category;
@SerializedName("price")