I have dynamically created the action bar and tabs. I have define a class for tab fragments like the below code.
public static class TabFragmentClass extends Fragment
{
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// TODO Auto-generated method stub
try
{
linearLayout=new LinearLayout(sActiveContext);
linearLayout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));
linearLayout.setOrientation(LinearLayout.VERTICAL);
CustomWebView webview=new CustomWebView(sActiveContext);
FrameLayout layout=webview.createwebview();
for (int i = 0; i < arrayList.size(); i++) {
if(sActionBar.getSelectedTab().getPosition()==i)
{
webview.initwebview(arrayList.get(i));
mWebViewList.add(i, webview);
break;
}
}
linearLayout.addView(layout);
linearLayout.setId(sActionBar.getSelectedTab().getPosition());
return linearLayout;
}
catch(Exception error)
{
System.out.println(error.getMessage());
return null;
}
}
}
The url is the local html file having their own native java method calls. If I am select the action bar tab first time, this is working fine. That is native java method is correctly called and callback is success. If I am visiting the tab second time, the fragment is only shown, tabs content is not re-created. I need the functionality of tab content not created each time. But I am facing the issue of native method not defined error. That is the native method is not called at all. How can I fix the issue?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…