I have an application with a main Activity " class MainActivity extends AppCompatActivity " from which I call the others class xxxx extends Fragment .
In these Fagment I show local web content using WebViewClient()
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.menu_2, container, false);
webView = (WebView) view.findViewById(R.id.webview);
webView.loadUrl("file:///android_asset/pagina.htm");
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webView.setWebViewClient(new WebViewClient());
return view;
}
And in the Activity , I'm trying now is: in onCreate
but R.string.up shows me error up
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(MainActivity.this, R.string.up, Toast.LENGTH_SHORT).show();
}
});
I have also seen comments that should be included in each of the layaut.xml %% of%:
<include
android:id="@+id/toolbar"
layout="@layout/telefonos" />
the telephones corresponds telenos.xml but to me the layout="@ layout / phones" shows me error
I do not want to go to the previous menu or Fragment, or parent activity (MainActivity), I try to return to the previous screen, if I show a web page, and from that page I will see 5 more web pages, than when I press the arrow go back on the web pages that I have seen, and when the web pages are finished, if I have gone through other fragments that also return on these, I do not know if the correct thing would be to say a level backwards.
Thank you.