Im using a fragment that is supposed to display a webview. When I try to instantiate it from the class that uses it I get the following warning in my logcat.
02-
if you want to go back from activity to Fragment try this
proToolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//Note: you must give an id to the Main layout of your activity e.g : searchVehicles
((ConstraintLayout) findViewById(R.id.searchVehicles)).removeAllViews();
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragment_nearby_vehicles fnv = new fragment_nearby_vehicles();
fragmentTransaction.add(R.id.searchVehicles, fnv).commit();
}
});
No don't add it to your manifest. You never need to add fragments to your manifest.
Do you create an Intent somewhere to start the WebActivity? How is it brought to the screen, that is probably where your problem lies.
EDIT
This is your problem:
Intent showContent = new Intent(getApplicationContext(),
WebFrag.class);
startActivity(showContent);
You can't start a Fragment as an Activity, you'll have to wrap the fragment in an Activity that extends FragmentActivity