I have a TabInterface.java which hosts five tabs. In one of the tab, I am using subactivities.When I click on the AddBook tab (which extends ActivityGroup) the search book page loads properly. When I click on search button a list of books is generated. When I click on the book, a new page must open but its program is running properly but not displaying any thing on the screen.

TabInterface.java

public class TabInterface extends TabActivity
{
  super.onCreate(savedInstanceState);
  setContentView(R.layout.tablayout);
  Resources res = getResources();
  TabHost tabHost = getTabHost();
  LocalActivityManager mlam = new LocalActivityManager(this, false);
  mlam.dispatchCreate(savedInstanceState);
  ............................................
  intent = new Intent().setClass(this, AddBook.class);
  spec = tabHost.newTabSpec("AddBook").setIndicator("Add Book", res.getDrawable(R.drawable.tab_icons)).setContent(intent);
  tabHost.addTab(spec);
  ..............................................`   

AddBook.java

...........
Intent i = new Intent(this.getBaseContext(), BookList.class);
replaceContentView("blist", i, getApplicationContext());
........
public void replaceContentView(String id, Intent newIntent, Context c)
{
  View view = getLocalActivityManager().startActivity(id, newIntent.addFlags(Intent.FLAG_ACTIVITY_CLE AR_TOP)).getDecorView();
  this.setContentView(view);
}
..........

BookList.java

 ......................

 private class BookAdapter extends ArrayAdapter < Books > //my custom adater
 ...................
 public View getView(final int position, View convertView, ViewGroup parent)
 ...................

 //in getView function
 v.setOnClickListener(new View.OnClickListener()
 {
   public void onClick(View v)
   {
     Intent k = new Intent(getBaseContext(), BookNew.class);
     AddBook ab = (AddBook) getParent();
     ab.replaceContentView("bnew", k, getApplicationContext());
   }
 }

 ................... 

The third sub activity BookNew.java is running properly but the output is not getting displayed. It works fine when displayed without tabs. May I know where I am wrong?

有帮助吗?

解决方案

Strange No one could answer my question. After spending around 5-6 days i cam to a solution. The reason why it was not displaying because I have used notfyDataSetChanged() so it was not drawing the next fragment.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top