[android-beginners] blob type size in SQLite database?

2009-07-29 Thread lei

The question is that I store the large file as Blob type in the SQLite
database, the CursorWindow try to grow window size 1048576, then it
failed to allocating the large file in the database, I just wonder is
there limitation for Blob size, it seems only contain the file that
not exceeds 1048576?


07-29 15:36:15.554: ERROR/CursorWindow(1013): need to grow: mSize =
1048576, size = 3972972, freeSpace() = 1048473, numRows = 1
07-29 15:36:15.554: ERROR/CursorWindow(1013): Attempting to grow
window beyond max size (1048576)
07-29 15:36:15.563: ERROR/Cursor(1013): Failed allocating 3972972
bytes for blob at 0,2
07-29 15:36:15.573: DEBUG/Cursor(1013):
finish_program_and_get_row_count row 0
07-29 15:36:16.563: ERROR/CursorWindow(1013): need to grow: mSize =
1048576, size = 3972972, freeSpace() = 1048473, numRows = 1
07-29 15:36:16.573: ERROR/CursorWindow(1013): Attempting to grow
window beyond max size (1048576)
07-29 15:36:16.573: ERROR/Cursor(1013): Failed allocating 3972972
bytes for blob at 0,2
07-29 15:36:16.583: WARN/ActivityManager(581): Launch timeout has
expired, giving up wake lock!
07-29 15:36:16.594: DEBUG/Cursor(1013):
finish_program_and_get_row_count row 0
07-29 15:36:16.594: ERROR/CursorWindow(1013): Bad request for field
slot 0,0. numRows = 0, numColumns = 3
07-29 15:36:16.604: WARN/System.err(1013):
java.lang.IllegalStateException: get field slot from row 0 col 0
failed

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] android service repaint

2009-09-28 Thread lei

I just found postInvalidate() does not paint the view immediately, is
there a method like serviceRepaint() in J2ME ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] Re: android service repaint

2009-09-29 Thread lei

Thanks Mark, this app only has one view, and many custom UI components
which is about to draw on screen. A UI component has properties like
x,y,width,height and so on. The events and actions that are produced
by UI components are placed into event thread. This thread will
response to execute each one sequentially, I call postInvalidate()
after each execution to update screen, but sometimes I just found
postInvalidate() did not paint immediately. I port this app from
JavaME to Android, the serviceRepaint() is called after each repaint
in JavaME, so it can force any pending repaint requests to be serviced
immediately, is there any thing similar for Android or alternative way
to do that?

On Sep 28, 12:56 pm, Mark Murphy  wrote:
> lei wrote:
> > I just found postInvalidate() does not paint the view immediately, is
> > there a method like serviceRepaint() in J2ME ?
>
> Nothing paints anything "immediately" in Android.
>
> All GUI events (e.g., setting the text on a TextView) are put on a
> message queue. Those events are only then processed when you return from
> whatever callback you are in and let the UI thread go back to processing
> those events on the queue.
>
> If you explain a bit more about what effect you are trying to achieve,
> we may be able to give you more guidance.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> _Beginning Android_ from Apress Now Available!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] play video encounter PV SW DECODER IS USED FOR MPEG4

2009-11-10 Thread lei
I wrote a media player for playing video, but it encounter an error of
PV SW DECODER IS USED FOR MPEG4 when I try to play back a 3gp format
video, anyone knows what is it? How to solve this problem? I paste my
code below:

package com.test;


import android.app.Activity;
import android.content.Intent;
import android.content.res.AssetFileDescriptor;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.util.Log;
import android.view.SurfaceHolder;
import android.view.SurfaceView;

public class MediaVideoTest extends Activity implements
MediaPlayer.OnPreparedListener,MediaPlayer.OnCompletionListener,SurfaceHolder.Callback
{

private static final String TAG = "MediaVideoTest";
private MediaPlayer player;
private SurfaceHolder holder;
private SurfaceView surfaceView;
private int mWidth,mHeight;


@Override
protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);
setContentView(R.layout.video_view);
surfaceView = (SurfaceView) findViewById(R.id.surfaceView);
holder = surfaceView.getHolder();
holder.addCallback(this);
holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);

}

private void playVideo() {

try {
AssetFileDescriptor asd = 
getResources().openRawResourceFd
(R.raw.chainsaw);

//create media player
player = new MediaPlayer();

player.setDataSource(asd.getFileDescriptor(),asd.getStartOffset
(),asd.getLength());
player.setDisplay(holder);
player.prepare();
player.setOnPreparedListener(this);
player.setOnCompletionListener(this);
player.setAudioStreamType(AudioManager.STREAM_MUSIC);

} catch (Exception e) {
Log.e(TAG, "error: " + e.getMessage(), e);
}
}

@Override
public void onPrepared(MediaPlayer mp) {
Log.d(TAG, "onPrepared called");
mWidth = player.getVideoWidth();
mHeight = player.getVideoHeight();
Log.d(TAG, "width : " + mWidth + " height : " + mHeight);

if(mWidth != 0 && mHeight != 0){
holder.setFixedSize(mWidth, mHeight);
player.start();
}
}

@Override
public void surfaceChanged(SurfaceHolder holder, int format, int
width,int height) {
Log.d(TAG, "surfaceChanged width : " + width + " height : " +
height);
}

@Override
public void surfaceCreated(SurfaceHolder holder) {
Log.d(TAG, "surfaceCreated() is called");
playVideo();
}

@Override
public void surfaceDestroyed(SurfaceHolder holder) {
Log.d(TAG, "surfaceDestroy() is called");
}

@Override
protected void onDestroy() {
super.onDestroy();
if(player != null){
player.release();
player = null;
}
}

@Override
public void onCompletion(MediaPlayer mp) {

if(player != null){
player.release();
player = null;
}

//close this activity;
finish();

//go back to the main menu
Intent intent = new Intent(this,MediaTest.class);
startActivity(intent);

}
}

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Re: play video encounter PV SW DECODER IS USED FOR MPEG4

2009-11-10 Thread lei
I am using the Android SDK 1.6.

On Nov 10, 6:18 pm, lei  wrote:
> I wrote a media player for playing video, but it encounter an error of
> PV SW DECODER IS USED FOR MPEG4 when I try to play back a 3gp format
> video, anyone knows what is it? How to solve this problem? I paste my
> code below:
>
> package com.test;
>
> import android.app.Activity;
> import android.content.Intent;
> import android.content.res.AssetFileDescriptor;
> import android.media.AudioManager;
> import android.media.MediaPlayer;
> import android.os.Bundle;
> import android.util.Log;
> import android.view.SurfaceHolder;
> import android.view.SurfaceView;
>
> public class MediaVideoTest extends Activity implements
> MediaPlayer.OnPreparedListener,MediaPlayer.OnCompletionListener,SurfaceHold 
> er.Callback
> {
>
>         private static final String TAG = "MediaVideoTest";
>         private MediaPlayer player;
>         private SurfaceHolder holder;
>         private SurfaceView surfaceView;
>         private int mWidth,mHeight;
>
>         @Override
>         protected void onCreate(Bundle savedInstanceState) {
>
>                 super.onCreate(savedInstanceState);
>                 setContentView(R.layout.video_view);
>                 surfaceView = (SurfaceView) findViewById(R.id.surfaceView);
>                 holder = surfaceView.getHolder();
>         holder.addCallback(this);
>         holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
>
>         }
>
>         private void playVideo() {
>
>                 try {
>                         AssetFileDescriptor asd = 
> getResources().openRawResourceFd
> (R.raw.chainsaw);
>
>                         //create media player
>                         player = new MediaPlayer();
>                         
> player.setDataSource(asd.getFileDescriptor(),asd.getStartOffset
> (),asd.getLength());
>                         player.setDisplay(holder);
>                         player.prepare();
>                         player.setOnPreparedListener(this);
>                         player.setOnCompletionListener(this);
>             player.setAudioStreamType(AudioManager.STREAM_MUSIC);
>
>                 } catch (Exception e) {
>             Log.e(TAG, "error: " + e.getMessage(), e);
>                 }
>         }
>
>         @Override
>         public void onPrepared(MediaPlayer mp) {
>         Log.d(TAG, "onPrepared called");
>                 mWidth = player.getVideoWidth();
>                 mHeight = player.getVideoHeight();
>                 Log.d(TAG, "width : " + mWidth + " height : " + mHeight);
>
>                 if(mWidth != 0 && mHeight != 0){
>                         holder.setFixedSize(mWidth, mHeight);
>                         player.start();
>                 }
>         }
>
>         @Override
>         public void surfaceChanged(SurfaceHolder holder, int format, int
> width,int height) {
>         Log.d(TAG, "surfaceChanged width : " + width + " height : " +
> height);
>         }
>
>         @Override
>         public void surfaceCreated(SurfaceHolder holder) {
>         Log.d(TAG, "surfaceCreated() is called");
>                 playVideo();
>         }
>
>         @Override
>         public void surfaceDestroyed(SurfaceHolder holder) {
>         Log.d(TAG, "surfaceDestroy() is called");
>         }
>
>         @Override
>         protected void onDestroy() {
>                 super.onDestroy();
>                 if(player != null){
>                         player.release();
>                         player = null;
>                 }
>         }
>
>         @Override
>         public void onCompletion(MediaPlayer mp) {
>
>                 if(player != null){
>                         player.release();
>                         player = null;
>                 }
>
>                 //close this activity;
>                 finish();
>
>                 //go back to the main menu
>                 Intent intent = new Intent(this,MediaTest.class);
>                 startActivity(intent);
>
>         }
>
>
>
> }

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Re: play video encounter PV SW DECODER IS USED FOR MPEG4

2009-11-11 Thread lei
I figure it out, sometimes the width and height values from
player.getVideoWidth() and player.getVideoHeight() are zero, I do not
know why?   ;

On Nov 10, 6:19 pm, lei  wrote:
> I am using the Android SDK 1.6.
>
> On Nov 10, 6:18 pm, lei  wrote:
>
>
>
> > I wrote a media player for playing video, but it encounter an error of
> > PV SW DECODER IS USED FOR MPEG4 when I try to play back a 3gp format
> > video, anyone knows what is it? How to solve this problem? I paste my
> > code below:
>
> > package com.test;
>
> > import android.app.Activity;
> > import android.content.Intent;
> > import android.content.res.AssetFileDescriptor;
> > import android.media.AudioManager;
> > import android.media.MediaPlayer;
> > import android.os.Bundle;
> > import android.util.Log;
> > import android.view.SurfaceHolder;
> > import android.view.SurfaceView;
>
> > public class MediaVideoTest extends Activity implements
> > MediaPlayer.OnPreparedListener,MediaPlayer.OnCompletionListener,SurfaceHold 
> > er.Callback
> > {
>
> >         private static final String TAG = "MediaVideoTest";
> >         private MediaPlayer player;
> >         private SurfaceHolder holder;
> >         private SurfaceView surfaceView;
> >         private int mWidth,mHeight;
>
> >         @Override
> >         protected void onCreate(Bundle savedInstanceState) {
>
> >                 super.onCreate(savedInstanceState);
> >                 setContentView(R.layout.video_view);
> >                 surfaceView = (SurfaceView) findViewById(R.id.surfaceView);
> >                 holder = surfaceView.getHolder();
> >         holder.addCallback(this);
> >         holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
>
> >         }
>
> >         private void playVideo() {
>
> >                 try {
> >                         AssetFileDescriptor asd = 
> > getResources().openRawResourceFd
> > (R.raw.chainsaw);
>
> >                         //create media player
> >                         player = new MediaPlayer();
> >                         
> > player.setDataSource(asd.getFileDescriptor(),asd.getStartOffset
> > (),asd.getLength());
> >                         player.setDisplay(holder);
> >                         player.prepare();
> >                         player.setOnPreparedListener(this);
> >                         player.setOnCompletionListener(this);
> >             player.setAudioStreamType(AudioManager.STREAM_MUSIC);
>
> >                 } catch (Exception e) {
> >             Log.e(TAG, "error: " + e.getMessage(), e);
> >                 }
> >         }
>
> >         @Override
> >         public void onPrepared(MediaPlayer mp) {
> >         Log.d(TAG, "onPrepared called");
> >                 mWidth = player.getVideoWidth();
> >                 mHeight = player.getVideoHeight();
> >                 Log.d(TAG, "width : " + mWidth + " height : " + mHeight);
>
> >                 if(mWidth != 0 && mHeight != 0){
> >                         holder.setFixedSize(mWidth, mHeight);
> >                         player.start();
> >                 }
> >         }
>
> >         @Override
> >         public void surfaceChanged(SurfaceHolder holder, int format, int
> > width,int height) {
> >         Log.d(TAG, "surfaceChanged width : " + width + " height : " +
> > height);
> >         }
>
> >         @Override
> >         public void surfaceCreated(SurfaceHolder holder) {
> >         Log.d(TAG, "surfaceCreated() is called");
> >                 playVideo();
> >         }
>
> >         @Override
> >         public void surfaceDestroyed(SurfaceHolder holder) {
> >         Log.d(TAG, "surfaceDestroy() is called");
> >         }
>
> >         @Override
> >         protected void onDestroy() {
> >                 super.onDestroy();
> >                 if(player != null){
> >                         player.release();
> >                         player = null;
> >                 }
> >         }
>
> >         @Override
> >         public void onCompletion(MediaPlayer mp) {
>
> >                 if(player != null){
> >                         player.release();
> >                         player = null;
> >                 }
>
> >                 //close this activity;
> >                 finish();
>
> >                 //go back to the main menu
> >                 Intent intent = new Intent(this,MediaTest.class);
> >                 startActivity(intent);
>
> >         }
>
> > }

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Re: play video encounter PV SW DECODER IS USED FOR MPEG4

2009-11-12 Thread lei
thanks.

On Nov 11, 2:55 pm, rktb  wrote:
> You need to use the 
> "onVideoSizeChangedListener".http://developer.android.com/reference/android/media/MediaPlayer.OnVi...
>
> Please refer the example 
> at:http://developer.android.com/guide/samples/ApiDemos/src/com/example/a...
>
> -Ravi
>
> On Nov 11, 4:13 am, lei  wrote:
>
>
>
> > I figure it out, sometimes the width and height values from
> > player.getVideoWidth() and player.getVideoHeight() are zero, I do not
> > know why?   ;
>
> > On Nov 10, 6:19 pm, lei  wrote:
>
> > > I am using the Android SDK 1.6.
>
> > > On Nov 10, 6:18 pm, lei  wrote:
>
> > > > I wrote a media player for playing video, but it encounter an error of
> > > > PV SW DECODER IS USED FOR MPEG4 when I try to play back a 3gp format
> > > > video, anyone knows what is it? How to solve this problem? I paste my
> > > > code below:
>
> > > > package com.test;
>
> > > > import android.app.Activity;
> > > > import android.content.Intent;
> > > > import android.content.res.AssetFileDescriptor;
> > > > import android.media.AudioManager;
> > > > import android.media.MediaPlayer;
> > > > import android.os.Bundle;
> > > > import android.util.Log;
> > > > import android.view.SurfaceHolder;
> > > > import android.view.SurfaceView;
>
> > > > public class MediaVideoTest extends Activity implements
> > > > MediaPlayer.OnPreparedListener,MediaPlayer.OnCompletionListener,SurfaceHold
> > > >  er.Callback
> > > > {
>
> > > >         private static final String TAG = "MediaVideoTest";
> > > >         private MediaPlayer player;
> > > >         private SurfaceHolder holder;
> > > >         private SurfaceView surfaceView;
> > > >         private int mWidth,mHeight;
>
> > > >         @Override
> > > >         protected void onCreate(Bundle savedInstanceState) {
>
> > > >                 super.onCreate(savedInstanceState);
> > > >                 setContentView(R.layout.video_view);
> > > >                 surfaceView = (SurfaceView) 
> > > > findViewById(R.id.surfaceView);
> > > >                 holder = surfaceView.getHolder();
> > > >         holder.addCallback(this);
> > > >         holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
>
> > > >         }
>
> > > >         private void playVideo() {
>
> > > >                 try {
> > > >                         AssetFileDescriptor asd = 
> > > > getResources().openRawResourceFd
> > > > (R.raw.chainsaw);
>
> > > >                         //create media player
> > > >                         player = new MediaPlayer();
> > > >                         
> > > > player.setDataSource(asd.getFileDescriptor(),asd.getStartOffset
> > > > (),asd.getLength());
> > > >                         player.setDisplay(holder);
> > > >                         player.prepare();
> > > >                         player.setOnPreparedListener(this);
> > > >                         player.setOnCompletionListener(this);
> > > >             player.setAudioStreamType(AudioManager.STREAM_MUSIC);
>
> > > >                 } catch (Exception e) {
> > > >             Log.e(TAG, "error: " + e.getMessage(), e);
> > > >                 }
> > > >         }
>
> > > >         @Override
> > > >         public void onPrepared(MediaPlayer mp) {
> > > >         Log.d(TAG, "onPrepared called");
> > > >                 mWidth = player.getVideoWidth();
> > > >                 mHeight = player.getVideoHeight();
> > > >                 Log.d(TAG, "width : " + mWidth + " height : " + 
> > > > mHeight);
>
> > > >                 if(mWidth != 0 && mHeight != 0){
> > > >                         holder.setFixedSize(mWidth, mHeight);
> > > >                         player.start();
> > > >                 }
> > > >         }
>
> > > >         @Override
> > > >         public void surfaceChanged(SurfaceHolder holder, int format, int
> > > > width,int height) {
> > > >         Log.d(TAG, "surfaceChanged width : " + width + " height : " +
> > > > height);
> > > >       

[android-beginners] Does styled text support html tag: and ?

2009-11-16 Thread lei
Styled text supports: ,, does it support more html tags, like
 or  ?

The code below is used for testing styled text:

CharSequence str = getText(R.string.styled_text); //retrieve
the styled text as char sequence, so it won't lose any formatting
TextView tv = (TextView)findViewById(R.id.text);
tv.setText(str);

I found only the  and  works, other tags just ignore the
formatting.

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] embeded web browser with custom width and height

2009-11-24 Thread lei
I try to create a web browser with custom width and height rather
than
fill screen, is that possible to do in android? Below is my snippet
code:
 AbsoluteLayout.LayoutParams params = new
AbsoluteLayout.LayoutParams(
180,
180,
50,
90);
webview = (WebView) findViewById(R.id.webview);
webview.setLayoutParams(params);
webview.getSettings().setJavaScriptEnabled(true);
webview.loadUrl("http://www.google.com";);
what am I doing is set web view's width and height to 180 pixels, and
coordinate to 50 and 90. when I run this test, it display a white
square on screen, nothing render at all. Could any one tell me how to
do it in android?

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] how to run multiple instances of the emulator concurrently?

2008-11-12 Thread Lei

Hi all

how to run multiple instances of the emulator concurrently with
eclipse?

Thanks,

Regards,
Lei

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] Re: how to run multiple instances of the emulator concurrently?

2008-11-13 Thread Lei

Hi Nick

Thank you.

Regards,
Lei

On Nov 13, 4:39 pm, "Nick" <[EMAIL PROTECTED]> wrote:
> It is possible to run 2 emulators by running c:\ SDK>\tools\emulator.exe two times.
> I guess, one can run the first one from there for sending something to the
> 2nd and the 2nd one from Eclipse for debugging.
> Yet, maybe DDMS perspective in Eclipse will be fine because can send SMS,
> calls etc.
> Anyway, 3 emulators then 3 times from the Tools directory
>
> - Original Message -
> From: "Lei" <[EMAIL PROTECTED]>
> To: "Android Beginners" 
> Sent: Thursday, November 13, 2008 5:59 AM
> Subject: [android-beginners] how to run multiple instances of the emulator
>
> concurrently?
>
> > Hi all
>
> > how to run multiple instances of the emulator concurrently with
> > eclipse?
>
> > Thanks,
>
> > Regards,
> > Lei
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] Could not find AVD file

2009-04-29 Thread lei

Hi, I am using eclipse with ADT plugin to develop an Android app, the
problem is I could not find a AVD file in the run configuration ->
Android application->target. I've created a AVD following the steps on
the Android website which is located in the default directory C:
\Documents and Settings\xxx\.android\avd, but it can find the AVD file
in the run configuration -> Android JUnit Test -> target, could you
explain it? thanks

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---