Android Open Source - AndroidMooch Book Search 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;
/* www  .j  a  v  a 2  s. c o m*/
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.SpinnerAdapter;

import com.github.stchris.R;
import com.github.stchris.queries.Constants;

/**
 * Main AndroidMooch {@link Activity}.
 * 
 * @author chris
 * 
 */
public class BookSearchActivity extends Activity {

  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.search);

    final EditText isbnText = (EditText) findViewById(R.id.isbntext);
    final Button btnBookInfo = (Button) findViewById(R.id.btnBookInfo);
    final EditText searchText = (EditText) findViewById(R.id.searchtext);
    final Button btnSearchBook = (Button) findViewById(R.id.btnSearchBook);

    final Spinner spinnerSearchEngine = (Spinner) findViewById(R.id.spinnerSearchEngine);
    SpinnerAdapter searchEngineSpinnerAdapter = new ArrayAdapter<String>(
        this, android.R.layout.simple_spinner_item, new String[] {
            "BookMooch", "Amazon.com", "Amazon.de", "Amazon.co.uk",
            "Amazon.co.jp", "Amazon.fr", "Amazon.fr" });
    spinnerSearchEngine.setAdapter(searchEngineSpinnerAdapter);

    btnBookInfo.setOnClickListener(new OnClickListener() {

      public void onClick(View v) {
        Intent bookInfoIntent = new Intent(BookInfoActivity.ACTION);
        bookInfoIntent.putExtra(Constants.ISBN_PARAMETER, isbnText
            .getText().toString());
        startActivity(bookInfoIntent);
      }

    });

    btnSearchBook.setOnClickListener(new OnClickListener() {

      public void onClick(View v) {
        Intent bookSearchIntent = new Intent(BookSearchListActivity.ACTION);
        bookSearchIntent.putExtra(Constants.SEARCH_STRING, searchText
            .getText().toString());
        bookSearchIntent.putExtra(Constants.SEARCH_ENGINE,
            spinnerSearchEngine.getSelectedItem()
                .toString());
        startActivity(bookSearchIntent);
      }
    });
  }
}




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