[Solved] send string data from Activity to fragment [closed]


Add below code inside listview itemclick listner in activity:

 Tozihat gTozihat  = new Tozihat().newInstance("Data");
        getSupportFragmentManager().beginTransaction()
                .replace(R.id.textViewTozihat, gTozihat).commit();

Inside your Fragment :

 private static final String TYPE = "DATA_KEY";
public static  Tozihat newInstance(String type) {
         Tozihat fragment = new  Tozihat();
        Bundle args = new Bundle();
        args.putString(TYPE, type);

        fragment.setArguments(args);
        return fragment;
    }

3

solved send string data from Activity to fragment [closed]