Android Application with embedded e-reading

by Brinson Tatum » Wed, 28 Jul 2010 01:29:55 GMT


Sponsored Links
 I am pretty new to mobile development and I'm struggling with how to
go about accomplishing one task.  The application that I'm working on
is for a state government agency and is going to include a variety of
features, one of them the ability to read a handbook.  I want to make
the user experience as nice as possible by making the handbook
readable in a similar as other e-reading software, but I'm at a loss
as to how to accomplish it.

I started by using a WebView and looking at packaging the handbook
into an epub file and displaying the contents in the WebView.  On the
surface, displaying the content was pretty easy in the webview.  The
challenge is with making it not have the user scroll down.  I would
rather them flip pages like a standard e-reader.  I'm not looking to
build a full featured e-reader, but I would like the basic
functionality.  It seems the WebView may not be the best UI component
for this task, but maybe it is.

Any suggestions or ideas would be MUCH appreciated!

Thanks

--



Other Threads

1. Need help animating the System Wallpaper.

This is my Service.

It's a simple service which use Handler to invoke "setWallpaper()"
every 2 seconds.
[code]
package com.mseer.testservice;

import java.io.IOException;
import java.io.InputStream;

import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.util.Log;

public class MyService extends Service{

  public IBinder onBind(Intent intent) {
    return null;
  }


  protected static Service sv;
  protected static InputStream bg01, bg02, bg03, bg04, bg05, bg06;

  protected static int index=0;

  protected static final int SECONDPASSED = 0x1234;

  protected boolean running = false;

  Thread counterThread = null;

  static Handler myWallpaperHandler = new Handler(){
       public void handleMessage(Message msg) {
            switch (msg.what) {
                 case MyService.SECONDPASSED:

                     updateWallpaper();

                      break;
            }
            super.handleMessage(msg);
       }
  };





  protected static void updateWallpaper(){

      try {
            if(index==0){
                sv.setWallpaper(bg01);
            }else if(index==1){
                sv.setWallpaper(bg02);
            }else if(index==2){
                sv.setWallpaper(bg03);
            }else if(index==3){
                sv.setWallpaper(bg04);
            }else if(index==4){
                sv.setWallpaper(bg05);
            }else if(index==5){
                sv.setWallpaper(bg06);
            }

            index++;
            if(index>5){
                index = 0;
            }


        } catch (IOException e) {

            e.printStackTrace();
        }




  }



  public void onCreate(){
      sv = this;
      super.onCreate();
      running = true;
      bg01 = sv.getResources().openRawResource(R.drawable.night01w);
      bg02 = sv.getResources().openRawResource(R.drawable.night02w);
      bg03 = sv.getResources().openRawResource(R.drawable.night03w);
      bg04 = sv.getResources().openRawResource(R.drawable.night04w);
      bg05 = sv.getResources().openRawResource(R.drawable.night05w);
      bg06 = sv.getResources().openRawResource(R.drawable.night06w);

      this.counterThread = new Thread(new secondCountDownRunner());
      this.counterThread.start();

  }

  public void onDestroy() {
    super.onDestroy();
    running = false;
    counterThread.interrupt();
  }


}



class secondCountDownRunner implements Runnable{
    public void run() {
         while(!Thread.currentThread().isInterrupted()){
              Message m = new Message();
              m.what = MyService.SECONDPASSED;
              MyService.myWallpaperHandler.sendMessage(m);
              try {
                   Thread.sleep(2000);
              } catch (InterruptedException e) {
                   Thread.currentThread().interrupt();
              }
         }
    }
}[/code]My problem:

The wallpaper changes for 4-5 frames, then stopped...


Solutions I've tried:

1. I tried Logging like this:


[code]if(index==0){
                Log.e("BM WALLPAPER","Wallpaper set to WP1 | " +
bg01);
                sv.setWallpaper(bg01);
            }else if(index==1){
                Log.e("BM WALLPAPER","Wallpaper set to WP2 | "  +
bg02);
                sv.setWallpaper(bg02);
// and so on...
[/code]And I can still see the Log message every 2 seconds (but the
wallpaper dont change anymore)



2. I tried creating the InputStream every cycle. It works. But it
greatly slow down the phone to an unacceptable level.

[code]if(index==0){
                              bg01 = sv.getResources().openRawResource
(R.drawable.night01w);
                sv.setWallpaper(bg01);
            }else if(index==1){
                                bg02 = sv.getResources
().openRawResource(R.drawable.night02w);
                sv.setWallpaper(bg02);
// and so on...[/code]3. I've tried all of the above solutions but use
setWallpaper(Bitmap); instead. The result is even slower...



My requests to experts in this forum:
1. I wonder why my wallpaper animated for only 4-5 frames, then
stopped. (using the first code snippet posted above)

2. If anyone happen to know how to efficiently create an animated
wallpaper, please let me know.


Thank you in advance. =)

--~--~---------~--~----~------------~-------~--~----~

2. Push email has stopped

I have the G1 on T-mobile UK.

I setup the alternative email client with my Gmail account to see how
it worked. It wasn't as good as the native Google Mail app so I
deleted my account.

But now my Google Mail program has stopped working properly. It won't
download new messages or send either. And also push email has
stoppped.

Please help.

--~--~---------~--~----~------------~-------~--~----~

3. Using RMI in Android

4. adb failed to start

5. Android & T-Moble

6. Android in Canada

7. overloading getView