Android Open Source - AndroidMooch Main Activity






From Project

Back to project page AndroidMooch.

License

The source code is released under:

Copyright (c) 2010 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software witho...

If you think the Android project AndroidMooch listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.github.stchris.activities;
/*from   www  .  j av a 2  s.  co  m*/
import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;

import com.github.stchris.R;

public class MainActivity extends TabActivity {

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    Resources res = getResources(); // Resource object to get Drawables
    TabHost tabHost = getTabHost(); // The activity TabHost
    TabHost.TabSpec spec; // Resusable TabSpec for each tab
    Intent intent; // Reusable Intent for each tab

    // Create an Intent to launch an Activity for the tab (to be reused)
    intent = new Intent().setClass(this, BookSearchActivity.class);

    // Initialize a TabSpec for each tab and add it to the TabHost
    spec = tabHost
        .newTabSpec("search")
        .setIndicator("Search",
            res.getDrawable(R.drawable.tab_search))
        .setContent(intent);
    tabHost.addTab(spec);

    // Do the same for the other tabs
    intent = new Intent().setClass(this, InventoryActivity.class);
    spec = tabHost
        .newTabSpec("inventory")
        .setIndicator("Inventory",
            res.getDrawable(R.drawable.tab_inventory))
        .setContent(intent);
    tabHost.addTab(spec);

    intent = new Intent().setClass(this, WishlistActivity.class);
    spec = tabHost
        .newTabSpec("wishlist")
        .setIndicator("Wishlist", res.getDrawable(R.drawable.tab_wishlist))
        .setContent(intent);
    tabHost.addTab(spec);

    tabHost.setCurrentTab(0);

  }

}




Java Source Code List

com.github.stchris.activities.BookInfoActivity.java
com.github.stchris.activities.BookSearchActivity.java
com.github.stchris.activities.BookSearchListActivity.java
com.github.stchris.activities.InventoryActivity.java
com.github.stchris.activities.MainActivity.java
com.github.stchris.activities.ShowImageActivity.java
com.github.stchris.activities.WishlistActivity.java
com.github.stchris.models.BookListAdapter.java
com.github.stchris.models.Book.java
com.github.stchris.queries.Constants.java
com.github.stchris.util.JSONUtil.java
com.github.stchris.util.Util.java
com.github.stchris.views.BookListView.java