안드로이드 개발중 onActivityResult에서 onCreateView()를 사용하고 싶은데 오류가 뜹니다 ㅠㅠ

    public class FragmentE extends Fragment implements View.OnClickListener
{

private static final int EDIT_DATA_REQUEST_CODE = 1;

Button editMyInfo;
ToggleButton quick_view_switch;

private ListView listView;
private CustomAdapter adapter;
public DatabaseHelper dbHelper;
Context mContext;

String myName;
String myRank;
String myTel;
String myAddr;
String myEmail;

    //이 메소드를 외부에서 호출하려고합니다.
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.activity_setting, container, false);
    mContext = v.getContext();
    dbHelper = new DatabaseHelper(mContext);

    listView = (ListView) v.findViewById(R.id.setting_listView);
    adapter = new CustomAdapter();
    listView.setAdapter(adapter);

    editMyInfo = (Button)v.findViewById(R.id.editMyInfo);
    editMyInfo.setOnClickListener(this);

    quick_view_switch = (ToggleButton) v.findViewById(R.id.toggleButton1);
       // quick_view_switch.setOnClickListener(this);

        return v;
    }

    @Override
    public void onResume(){
    super.onResume();

    Cursor mCursor = (Cursor)dbHelper.getAllData();

    mCursor.moveToFirst();

    myName = mCursor.getString(mCursor.getColumnIndexOrThrow(dbHelper.USER_TABLE_COLUMN_NAME));
    myRank = mCursor.getString(mCursor.getColumnIndexOrThrow(dbHelper.USER_TABLE_COLUMN_RANK));
    myTel = mCursor.getString(mCursor.getColumnIndexOrThrow(dbHelper.USER_TABLE_COLUMN_TEL));
    myAddr = mCursor.getString(mCursor.getColumnIndexOrThrow(dbHelper.USER_TABLE_COLUMN_ADDR));
    myEmail = mCursor.getString(mCursor.getColumnIndexOrThrow(dbHelper.USER_TABLE_COLUMN_EMAIL));

        adapter.add("이름",myName);
        adapter.add("번호",myTel);
        adapter.add("직급",myRank);
        adapter.add("메일",myEmail);
        adapter.add("주소",myAddr);
    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {

    if(resultCode==getActivity().RESULT_OK){
        switch (requestCode){
            case EDIT_DATA_REQUEST_CODE:
                Toast.makeText(mContext, "ELEL", Toast.LENGTH_SHORT).show();
                onDestroyView();
                onCreateView(); // 여기에 무슨 매개변수가 들어가야될지 모르겠어요..
                onStart();
                break;
        }
     } 
    }

    @Override
    public void onClick(View v) {
    Intent intent = new Intent(getActivity().getApplicationContext(),EditMyInfo.class);
    startActivityForResult(intent,EDIT_DATA_REQUEST_CODE);

      }
    }

onCreate()메소드같이 액티비티가 시작할때 호출되는 메소드를 다른 메소드에서 호출하려면 어떻게 해야될까요??

1답변

ᕕ( ᐛ )ᕗ
로그인이 필요합니다

작성한 답변에 다른 개발자들이 댓글을 작성하거나 댓글에 좋아요/싫어요를 할 수 있기 때문에 계정을 필요로 합니다.