OutOfMemoryError when use radaee library - RadaeePDF.com
Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
13 Jul 2017
Microsoft has ended support for Windows Phone 8.1
Read More...
Questions about Android development and PDF
  • Page:
  • 1

TOPIC: OutOfMemoryError when use radaee library

OutOfMemoryError when use radaee library 3 years 3 months ago #8338

  • asliyanage
  • asliyanage's Avatar Topic Author
  • Offline
  • Expert Boarder
  • Expert Boarder
  • Posts: 100
  • Thank you received: 0
I used radaee library for my app.

I have customized the PDFReader class.
package com.sph.pdf;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.text.InputFilter;
import android.text.InputType;
import android.util.AttributeSet;
import android.util.Log;
import android.util.TypedValue;
import android.view.Gravity;
import android.widget.EditText;

import com.radaee.pdf.Page;
import com.radaee.reader.PDFReader;
import com.radaee.util.ComboList;
import com.radaee.view.PDFView.PDFPos;
import com.sph.controller.SPHApplication;

public class SPHCustomizedRadaeePDFReader extends PDFReader {

	private Context context;
	
	public SPHCustomizedRadaeePDFReader(Context context, AttributeSet attrs) {
		super(context, attrs);
		this.context=context;
		// TODO Auto-generated constructor stub
		
	}
	
	
	protected void onSizeChanged(int w, int h, int oldw, int oldh) {
		//if(oldw==0||oldh==0){
			super.onSizeChanged(w, h, oldw, oldh);
			Log.d("SAMEERA", " SPHCustomizedonSizeChanged onSizeChanged " +context);
			
			
			
			
		//}
	}
	
	
	

	
	public boolean OnPDFSingleTapped(float x, float y) {
		//context=SPHApplication.getContext();
		Log.d("ASL", " SPHCustomizedRadaeePDFReader OnPDFSingleTapped " +context);
		
		String tap="SingleTapped";
		
		PDFActivity activity = (PDFActivity) context;
		activity.tapDetected();
		/*
		Intent intent = new Intent();
		//intent.putExtra("OnPDFSingleTapped",tap);
		intent.setAction("com.tutorialspoint.CUSTOM_INTENT");
		context.sendBroadcast(intent);*/
		
		return super.OnPDFSingleTapped(x,y);
	}

	
	// sameera
		public static boolean Swipeable() {

			//return false;
			return status;
		}
		
		
		// sameera
		
		public void isPdfSwipeable() {
			if (m_view != null) {
				/*Log.d("ASL","truetrue m_view.vGetWinH()  "+m_view.vGetWinH());
				Log.d("ASL","truetrue m_view.vGetWinW()  "+m_view.vGetWinW());
				Log.d("ASL","truetrue m_view.vGetX()  "+m_view.vGetX());
				Log.d("ASL","truetrue m_view.vGetY()  "+m_view.vGetY());*/
				
				if (m_view.vGetScale() == m_view.vGetMinScale()) {
					status = true;
					//if(m_view.vGetX() + m_view.vGetWinW() >= m_view.vGet)
					Log.d("ASL","truetrue m_view.vGetX()  "+m_view.vGetWinW());				
							
				} else {
					status = false;
					/*if(m_view.vGetX()!=0){
						status = false;
					}				
					else{
						status = true;
					}
					Log.d("ASL","falsefalse  m_view.vGetX()  "+m_view.vGetX());*/
				}
			}
		}
		
	
	public boolean OnPDFDoubleTapped(float x, float y) {
		//Log.d("SAMEERA", "OnPDFDoubleTapped");
		/*
		 * if( m_status != STA_NORMAL ) return false;
		 * m_view.vSetScale(m_view.vGetScale() + Global.zoomStep, x, y);
		 */
		//Log.d("SAMEERA", "m_view.vGetScale() "+m_view.vGetScale());
		//Log.d("SAMEERA", "OnPDFDoubleTapped IFF");
		
		/*
		if(true){
		if (m_view.vGetScale() == m_view.vGetMinScale()) {
			m_view.vSetScale(m_view.vGetMaxScale(), x, y);
			
		//	Log.d("SAMEERA", "OnPDFDoubleTapped IFF "+m_view.vGetScale());
		} else {
			m_view.vSetScale(m_view.vGetMinScale(), x, y);
			
			//Log.d("SAMEERA", "OnPDFDoubleTapped ELSE  "+m_view.vGetMinScale());
		}
		}else{
			*/
			if (m_view.vGetScale() == m_view.vGetMinScale()) {
				//if(m_view.vGetMaxScale()<9.598424f)
				if(m_view.vGetMaxScale()<9.598424f){
					m_view.vSetScale(m_view.vGetMaxScale(), x, y);
				}				
				else{
					m_view.vSetScale(9.598424f, x, y);	
				}
				
			//	Log.d("SAMEERA", "OnPDFDoubleTapped IFF "+m_view.vGetScale());
			} else {
				
				m_view.vSetScale(m_view.vGetMinScale(), x, y);
				
				//Log.d("SAMEERA", "OnPDFDoubleTapped ELSE  "+m_view.vGetMinScale());
			//}9.598424
			
		}
		
		
		return true;
	}
	
}

when i run the app i got below exception
01-20 16:56:47.309: W/System.err(18508): java.lang.OutOfMemoryError
01-20 16:56:47.314: W/System.err(18508): 	at android.graphics.Bitmap.nativeCreate(Native Method)
01-20 16:56:47.314: W/System.err(18508): 	at android.graphics.Bitmap.createBitmap(Bitmap.java:726)
01-20 16:56:47.314: W/System.err(18508): 	at android.graphics.Bitmap.createBitmap(Bitmap.java:703)
01-20 16:56:47.314: W/System.err(18508): 	at android.graphics.Bitmap.createBitmap(Bitmap.java:670)
01-20 16:56:47.314: W/System.err(18508): 	at com.radaee.view.PDFView.vResize(PDFView.java:218)
01-20 16:56:47.314: W/System.err(18508): 	at com.radaee.view.PDFViewDual.vResize(PDFViewDual.java:62)
01-20 16:56:47.319: W/System.err(18508): 	at com.radaee.reader.PDFReader.onSizeChanged(PDFReader.java:1140)
01-20 16:56:47.319: W/System.err(18508): 	at com.sph.pdf.SPHCustomizedRadaeePDFReader.onSizeChanged(SPHCustomizedRadaeePDFReader.java:34)
01-20 16:56:47.319: W/System.err(18508): 	at android.view.View.sizeChange(View.java:15326)
01-20 16:56:47.319: W/System.err(18508): 	at android.view.View.setFrame(View.java:15290)
01-20 16:56:47.319: W/System.err(18508): 	at android.view.View.layout(View.java:15201)
01-20 16:56:47.319: W/System.err(18508): 	at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1076)
01-20 16:56:47.319: W/System.err(18508): 	at android.view.View.layout(View.java:15204)
01-20 16:56:47.319: W/System.err(18508): 	at android.view.ViewGroup.layout(ViewGroup.java:4793)
01-20 16:56:47.324: W/System.err(18508): 	at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1076)
01-20 16:56:47.324: W/System.err(18508): 	at android.view.View.layout(View.java:15204)
01-20 16:56:47.324: W/System.err(18508): 	at android.view.ViewGroup.layout(ViewGroup.java:4793)
01-20 16:56:47.324: W/System.err(18508): 	at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
01-20 16:56:47.324: W/System.err(18508): 	at android.view.View.layout(View.java:15204)
01-20 16:56:47.324: W/System.err(18508): 	at android.view.ViewGroup.layout(ViewGroup.java:4793)
01-20 16:56:47.324: W/System.err(18508): 	at android.support.v4.view.ViewPager.onLayout(ViewPager.java:1594)
01-20 16:56:47.324: W/System.err(18508): 	at android.view.View.layout(View.java:15204)
01-20 16:56:47.329: W/System.err(18508): 	at android.view.ViewGroup.layout(ViewGroup.java:4793)
01-20 16:56:47.329: W/System.err(18508): 	at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1076)
01-20 16:56:47.329: W/System.err(18508): 	at android.view.View.layout(View.java:15204)
01-20 16:56:47.329: W/System.err(18508): 	at android.view.ViewGroup.layout(ViewGroup.java:4793)
01-20 16:56:47.329: W/System.err(18508): 	at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
01-20 16:56:47.329: W/System.err(18508): 	at android.view.View.layout(View.java:15204)
01-20 16:56:47.329: W/System.err(18508): 	at android.view.ViewGroup.layout(ViewGroup.java:4793)
01-20 16:56:47.329: W/System.err(18508): 	at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1677)
01-20 16:56:47.334: W/System.err(18508): 	at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1531)
01-20 16:56:47.334: W/System.err(18508): 	at android.widget.LinearLayout.onLayout(LinearLayout.java:1440)
01-20 16:56:47.334: W/System.err(18508): 	at android.view.View.layout(View.java:15204)
01-20 16:56:47.334: W/System.err(18508): 	at android.view.ViewGroup.layout(ViewGroup.java:4793)
01-20 16:56:47.334: W/System.err(18508): 	at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
01-20 16:56:47.334: W/System.err(18508): 	at android.view.View.layout(View.java:15204)
01-20 16:56:47.334: W/System.err(18508): 	at android.view.ViewGroup.layout(ViewGroup.java:4793)
01-20 16:56:47.339: W/System.err(18508): 	at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2260)
01-20 16:56:47.339: W/System.err(18508): 	at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2007)
01-20 16:56:47.339: W/System.err(18508): 	at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1249)
01-20 16:56:47.339: W/System.err(18508): 	at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6364)
01-20 16:56:47.339: W/System.err(18508): 	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:791)
01-20 16:56:47.339: W/System.err(18508): 	at android.view.Choreographer.doCallbacks(Choreographer.java:591)
01-20 16:56:47.339: W/System.err(18508): 	at android.view.Choreographer.doFrame(Choreographer.java:561)
01-20 16:56:47.344: W/System.err(18508): 	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:777)
01-20 16:56:47.344: W/System.err(18508): 	at android.os.Handler.handleCallback(Handler.java:730)
01-20 16:56:47.344: W/System.err(18508): 	at android.os.Handler.dispatchMessage(Handler.java:92)
01-20 16:56:47.344: W/System.err(18508): 	at android.os.Looper.loop(Looper.java:176)
01-20 16:56:47.344: W/System.err(18508): 	at android.app.ActivityThread.main(ActivityThread.java:5419)
01-20 16:56:47.349: W/System.err(18508): 	at java.lang.reflect.Method.invokeNative(Native Method)
01-20 16:56:47.349: W/System.err(18508): 	at java.lang.reflect.Method.invoke(Method.java:525)
01-20 16:56:47.349: W/System.err(18508): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
01-20 16:56:47.349: W/System.err(18508): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
01-20 16:56:47.349: W/System.err(18508): 	at dalvik.system.NativeStart.main(Native Method)
01-20 16:56:47.359: W/FlurryAgent(18508): Error logged: uncaught
01-20 16:56:47.499: W/FlurryAgent(18508): Flurry session finalized
01-20 16:56:49.769: W/com.newrelic.agent.android(18508): setBytesReceived(...) called on TransactionState in COMPLETE state
01-20 16:56:49.769: W/com.newrelic.agent.android(18508): setStatusCode(...) called on TransactionState in COMPLETE state
01-20 16:56:49.769: W/FlurryAgent(18508): Analytics report sent.
01-20 16:56:53.744: I/com.newrelic.agent.android(18508): Crash 825aa35e-5797-13f5-e516-450a3bf545d4 successfully submitted.
01-20 16:56:55.494: D/dalvikvm(18508): GC_FOR_ALLOC freed 5586K, 14% free 56169K/64984K, paused 56ms, total 56ms
01-20 16:56:55.664: E/AndroidRuntime(18508): FATAL EXCEPTION: main
01-20 16:56:55.664: E/AndroidRuntime(18508): java.lang.OutOfMemoryError
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.graphics.Bitmap.nativeCreate(Native Method)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.graphics.Bitmap.createBitmap(Bitmap.java:726)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.graphics.Bitmap.createBitmap(Bitmap.java:703)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.graphics.Bitmap.createBitmap(Bitmap.java:670)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at com.radaee.view.PDFView.vResize(PDFView.java:218)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at com.radaee.view.PDFViewDual.vResize(PDFViewDual.java:62)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at com.radaee.reader.PDFReader.onSizeChanged(PDFReader.java:1140)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at com.sph.pdf.SPHCustomizedRadaeePDFReader.onSizeChanged(SPHCustomizedRadaeePDFReader.java:34)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.view.View.sizeChange(View.java:15326)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.view.View.setFrame(View.java:15290)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.view.View.layout(View.java:15201)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1076)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.view.View.layout(View.java:15204)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.view.ViewGroup.layout(ViewGroup.java:4793)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1076)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.view.View.layout(View.java:15204)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.view.ViewGroup.layout(ViewGroup.java:4793)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.view.View.layout(View.java:15204)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.view.ViewGroup.layout(ViewGroup.java:4793)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.support.v4.view.ViewPager.onLayout(ViewPager.java:1594)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.view.View.layout(View.java:15204)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.view.ViewGroup.layout(ViewGroup.java:4793)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1076)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.view.View.layout(View.java:15204)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.view.ViewGroup.layout(ViewGroup.java:4793)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.view.View.layout(View.java:15204)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.view.ViewGroup.layout(ViewGroup.java:4793)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1677)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1531)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.widget.LinearLayout.onLayout(LinearLayout.java:1440)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.view.View.layout(View.java:15204)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.view.ViewGroup.layout(ViewGroup.java:4793)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.view.View.layout(View.java:15204)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.view.ViewGroup.layout(ViewGroup.java:4793)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2260)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2007)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1249)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6364)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:791)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.view.Choreographer.doCallbacks(Choreographer.java:591)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.view.Choreographer.doFrame(Choreographer.java:561)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:777)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.os.Handler.handleCallback(Handler.java:730)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.os.Handler.dispatchMessage(Handler.java:92)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.os.Looper.loop(Looper.java:176)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at android.app.ActivityThread.main(ActivityThread.java:5419)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at java.lang.reflect.Method.invokeNative(Native Method)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at java.lang.reflect.Method.invoke(Method.java:525)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
01-20 16:56:55.664: E/AndroidRuntime(18508): 	at dalvik.system.NativeStart.main(Native Method)

Please Log in or Create an account to join the conversation.

OutOfMemoryError when use radaee library 3 years 3 months ago #8340

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 830
  • Karma: 43
  • Thank you received: 10
it is better of you to use PDFLayoutView, if zoom level greater that 4.
PDFReader cost more memory, in large zoom level, because it render whole page as 1 bitmap.

Please Log in or Create an account to join the conversation.

OutOfMemoryError when use radaee library 3 years 3 months ago #8342

  • asliyanage
  • asliyanage's Avatar Topic Author
  • Offline
  • Expert Boarder
  • Expert Boarder
  • Posts: 100
  • Thank you received: 0
could you pls provide me how to open pdf file using PDFLayoutView?

I know we can open pdf using PDFReader as below.

m_reader.PDFOpen(m_doc, false, this);
m_reader.PDFSetView(3);

Please Log in or Create an account to join the conversation.

OutOfMemoryError when use radaee library 3 years 3 months ago #8343

  • asliyanage
  • asliyanage's Avatar Topic Author
  • Offline
  • Expert Boarder
  • Expert Boarder
  • Posts: 100
  • Thank you received: 0
could you pls provide me how to open pdf file using PDFLayoutView?
I know we can open pdf using PDFReader as below.
m_reader.PDFOpen(m_doc, false, this);
m_reader.PDFSetView(3);

Please Log in or Create an account to join the conversation.

OutOfMemoryError when use radaee library 3 years 3 months ago #8344

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 830
  • Karma: 43
  • Thank you received: 10
yes, mostly methods are same.
plz see PDFLayoutAct, and you can launch PDFLayoutAct, modify start Activity in AndroidManifest.xml

Please Log in or Create an account to join the conversation.

OutOfMemoryError when use radaee library 3 years 3 months ago #8345

  • asliyanage
  • asliyanage's Avatar Topic Author
  • Offline
  • Expert Boarder
  • Expert Boarder
  • Posts: 100
  • Thank you received: 0
i remember you told once PDFLayoutAct is still in beta version.Is it good to use this class in production.we are doing commercial item.

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Powered by Kunena Forum