布局中有六个按钮。我已经对每个按钮执行了单击操作。当我点击按钮时,它会显示一个包含三个按钮的自定义对话框。在对话框按钮上单击它打开不同的listView 我有3个listView打开作为单击对话框按钮的对话框我必须获取列表视图的单击文本并将该文本设置为相应的按钮单击我的布局,其中包含6个按钮,我还想使用共享首选项存储这些值...请各位帮助我出于这个问题,我已经在这里坚持了三天......我将非常感谢你。
public boolean onLongClick(View v) {
switch (v.getId()) {
case R.id.bt_fav3:
favuorite();
Log.w(TAG, "fav val--------3 "+fav_val);
fav3.setText(fav_val);
break;
返回字符串的方法
public String favuorite(){
final String fav="";
final Dialog dialogsencond1 = new Dialog(this);
dialogsencond1.requestWindowFeature(Window.FEATURE_NO_TITLE);
final ArrayList<String> arr_hindi=new ArrayList<String>();
String[] hindi = getResources().getStringArray(R.array.Hindi_Topics);
for(int i=0; i<hindi.length;i++){
arr_hindi.add(""+hindi[i]);
}
dialogsencond1.setCancelable(false);
dialogsencond1.setContentView(R.layout.get_duration);
dialogsencond1.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.WHITE));
ListView listView=(ListView) dialogsencond1.findViewById(R.id.listView_gettime);
dialogsencond1.setTitle("Hindi Topics");
dialogsencond1.setCancelable(true);
ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(
getApplicationContext(), android.R.layout.simple_list_item_1,arr_hindi);
listView.setAdapter(arrayAdapter);
listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View view,
int pos, long arg3) {
// TODO Auto-generated method stub
String string=""+arr_hindi.get(pos);
fav_val=""+arr_hindi.get(pos);
Log.w(TAG, "value of time==="+string);
dialogsencond1.dismiss();
}
});