我没有将结果恢复为活动片段
这是我的Sherlock片段代码
public class AlphabeticalListFragment extends SherlockFragment {
.
.
.
public void setAdapter(){
adapter = new ListviewAlphabetAdapter(context, alphabet_data);
lv_list.setAdapter(adapter);
}
.
.
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Toast.makeText(context, "RESULT : " + requestCode + "-" + resultCode,
Toast.LENGTH_SHORT).show();
}
}
我的适配器代码是
public class ListviewAlphabetAdapter extends BaseAdapter{
.
.
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
convertView = mInflater.inflate(R.layout.template_list_letter_view,
null);
holder.ll_store_data.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i_dialog = new Intent(context,
DialogStoreAllActivity.class);
i_dialog.putExtra("id", alphabet_data.get(position).getI());
((Activity) context).startActivityForResult(i_dialog, 500);
}
});
return convertView;
}
}
在活动中
public class DialogStoreAllActivity extends Activity{
.
.
// In onClick function of a button
setResult(RESULT_OK, (i_groups).setAction("ok"));
.
}
我没有在片段
中得到结果答案 0 :(得分:1)
在活动类中编写一个函数,如下所示
public void startCommentActivity(Intent i){
startActivityForResult(i, 100);
}
在适配器类Activity.startComment Activity(intent);
中调用它