Android Open Source - palhike Page






From Project

Back to project page palhike.

License

The source code is released under:

GNU General Public License

If you think the Android project palhike 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.palhike.android;
/*from  ww w. j  a  va 2s  .  c  o  m*/
import java.util.ArrayList;

import android.support.v7.app.ActionBarActivity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

public class Page extends ActionBarActivity {

  int current_image = 0;
  final ArrayList<Bitmap> bitmapArray = new ArrayList<Bitmap>();

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

    final ImageView image = (ImageView) findViewById(R.id.image);
    final TextView title = (TextView) findViewById(R.id.title);
    final TextView description = (TextView) findViewById(R.id.description);
    Bundle extras = getIntent().getExtras();
    if (extras != null) {

      String titleStr = extras.getString("title");
      String descriptionStr = extras.getString("description");
      String num_images_string = extras.getString("num_images");
      if (num_images_string == null) {
        num_images_string = "3";
      }
      final int num_images = Integer.parseInt(num_images_string);
      byte[] image1 = extras.getByteArray("image1");
      byte[] image2 = extras.getByteArray("image2");
      byte[] image3 = extras.getByteArray("image3");
      byte[] image4 = extras.getByteArray("image4");
      byte[] image5 = extras.getByteArray("image5");

      title.setText(titleStr);
      description.setText(descriptionStr);

      Bitmap image1bm = BitmapFactory.decodeByteArray(image1, 0,
          image1.length);
      Bitmap image2bm = BitmapFactory.decodeByteArray(image2, 0,
          image2.length);
      Bitmap image3bm = BitmapFactory.decodeByteArray(image3, 0,
          image3.length);
      Bitmap image4bm = BitmapFactory.decodeByteArray(image4, 0,
          image4.length);
      Bitmap image5bm = BitmapFactory.decodeByteArray(image5, 0,
          image5.length);

      bitmapArray.add(image1bm);
      bitmapArray.add(image2bm);
      bitmapArray.add(image3bm);
      bitmapArray.add(image4bm);
      bitmapArray.add(image5bm);

      image.setImageBitmap(bitmapArray.get(0));
      image.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
          if (current_image != (num_images - 1)) {
            image.setImageBitmap(bitmapArray.get(current_image + 1));
            current_image = current_image + 1;
          } else {
            image.setImageBitmap(bitmapArray.get(0));
            current_image = 0;
          }
        }
      });
    }
  }
}




Java Source Code List

com.palhike.android.DataBaseHelper.java
com.palhike.android.Details.java
com.palhike.android.FragmentInfo.java
com.palhike.android.Home.java
com.palhike.android.IntentIntegrator.java
com.palhike.android.IntentResult.java
com.palhike.android.Login.java
com.palhike.android.ObjectModel.java
com.palhike.android.Page.java
com.palhike.android.SettingsActivity.java
com.palhike.android.TestAdapter.java
com.palhike.android.TreeTabs.java
com.palhike.android.TreeViewData.java
com.palhike.android.WelcomeActivity.java