[android-developers] Using background Mediarecorder in service Mediarecorder.stop() was hanging issue.

2012-12-16 Thread apaladin
Hi  i use service bind when my activity in enter  background 
contineue Video recording.

service.java
...
...

stopRecord(){
 new Thread(){
  public void run(){
.
mediarecorder.stop();  hanging here
.
  }
 }
}

activity.java

button stop.setOnclickListener(){
 stopService(...)  call stopRecord()
}

this code every Device fine but Galaxy Nexus was hanging.

Logcat message 
Timed out waiting for incoming camera video frames:xx ms

anybody find same problerm and find solution?

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

[android-developers] Viewstub reuse

2012-12-12 Thread apaladin
i want use viewstub real time titlebar change

main.xml

***ViewStub*

*android:id**=**@+id/headerstub*

*android:layout_gravity**=**top*

*android:layout_width**=**match_parent*

*android:layout_height**=**wrap_content*

*android:inflatedId**=**@+id/titleArea*

*android:layout**=**@layout/title_one* */*

title_one.xml
some controls

titile_two.xml
some controls


i want change title_one and title_two toggle
here is my code

 titleBar = (ViewStub)findViewById(R.id.headerstub);

 titleBar.setLayoutResource(R.layout.title_one);

 titleBar.inflate();


some event change to title_two

titleBar.setLayoutResource(R.layout.title_two);

titleBar.inflate(); crash app

logcat message : ViewStub must have a non-null ViewGroup viewParent

how can reuse viewstub?

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

[android-developers] AR application Texture problem

2012-10-28 Thread apaladin
Hi every one.
i have a one big problem for may AR application.

here is my application Layout stack

LineaLayout Device Opengl View - GLSurfaceView 
LineaLayout Device Camera View - Surfaceview  
LineaLayout Device UI View - view = not used

i loaded Two object in my oGLview and PNG Texture
Object1 non-blend
Object2 20%alpha blend

it work to GalaxyS2 look so fine every thing work good
but GalaxyS3 Object2 Texture is broken .
it looks very agly.

i use LoadTexture like this

BitmapFactory.decodeResource();//make bitmap
gl.glGenTexture();
gl.glBindTexture();
gl.glTexparameters()..
GLUtils.texImage2D();

alpha option is here
gl.glEnable(GL10.GL_BLEND);

gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);

gl.glEnable(GL10.GL_ALPHA_TEST);

i searched this groups that problem looks like  multiplyed alpha.
so i changed my code from 
https://groups.google.com/forum/?fromgroups=#!topic/android-developers/uqbDPmP4L8o

but it dosen't work ..

anybody some kind hint for me?

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

[android-developers] How can save CameraDevice onPreviewFrame to Video file?

2012-06-24 Thread apaladin
Hi 
i want device camera preview to video file not using Mediarecorder.

i know onPreviewFrame data is YUV data and success just save bitmap .

but i don't any hint onPreviewFrame data to video file any format 

can't anybody hint to me?

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

[android-developers] How can split mp4 file?

2012-06-11 Thread apaladin
hi

i have 400MB mp4 file play time is 9 minute

i want split that file save as play time 2min30sec~3min

how can i do that?
does any hint for me

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


[android-developers] Re: How can split mp4 file?

2012-06-11 Thread apaladin
thank you that's really great advice for me

On 6월11일, 오후9시39분, Jim Graham spooky1...@gmail.com wrote:
 On Mon, Jun 11, 2012 at 04:54:50AM -0700, lbendlin wrote:
  Use a desktop video editor.

 And that's not all  mp4 is a compressed format.  You will have
 key frames (aka I frames) which encode the full screen, and [I
 forgot the name of the others---it's been a while] frames which
 encode only the CHANGES since the previous frame.

 You can end a segment on either type of frame, but unless you are
 using some high-end professional video editing software, you *MUST*
 always start a segment with a key frame (I frame).  Note that
 you do NOT have to end on a key frame.

 The really high-end professional stuff will re-encode it for you.  But
 unless you're in a professional studio in Hollywood, or something along
 those lines, your software very probably will not do that for you.

 Later,
--jim

 --
 THE SCORE:  ME:  2  CANCER:  0
 73 DE N5IAL (/4)  | DMR: So fsck was originally called
 spooky1...@gmail.com  |  something else.
  Running Mac OS X Lion  | Q:   What was it called?
 ICBM / Hurricane: | DMR: Well, the second letter was different.
30.44406N 86.59909W|-- Dennis M. Ritchie, Usenix, June 1998.

 Android Apps Listing athttp://www.jstrack.org/barcodes.html

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


[android-developers] Device Camera reopen error question

2012-04-16 Thread apaladin
HI i use Device camera in my Activity preview

first Camera.open() is good work

but enter Home key to back ground my Activity

and restart Acvitity is Camera.open()  runtimeException Why?

public SurfaceHolder.Callback getSurfaceHolderCallback() {
return new SurfaceHolder.Callback() {
/**
 *
 */
public void surfaceCreated(SurfaceHolder holder) {
Logger.log(Camera overlay surfaceCreated);
try {
mCameraDevice = Camera.open();  
RuntimeException
mCameraDevice.setPreviewDisplay(holder);
}catch (IOException e) {
mCameraDevice.release();
mCameraDevice = null;
e.printStackTrace();
Logger.log(surfaceCreated:+e.getMessage());
}catch (RuntimeException e) {
Logger.log(surfaceCreated:+e.getMessage());
mCameraDevice.release();
mCameraDevice = null;
e.printStackTrace();
}
mStatusListener.onOpenCamera();
}
/**
 *
 */
public void surfaceChanged(SurfaceHolder holder, int format, int
width, int height) {
if(mCameraDevice != null) {
Parameters _param = 
mCameraDevice.getParameters();
Camera.Size _camSize =
_param.getSupportedPreviewSizes().get(0);

_param.setPreviewSize(_camSize.width,_camSize.height);
//  _param.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO);
mCameraDevice.setParameters(_param);
mCameraDevice.startPreview();
Logger.log(surfaceChanged);
} else {
// Maybe OutOfMemory
Logger.log(Camera overlay surfaceChanged : 
outofmemory);
}
mStatusListener.onCameraChange();
}
/**
 *
 */
public void surfaceDestroyed(SurfaceHolder holder) {
Logger.log(Camera overlay surfaceDestroyed);
if(mCameraDevice != null) {
mCameraDevice.stopPreview();
mCameraDevice.release();
mCameraDevice = null;
Logger.log(surfaceDestroyed OK);
}else{
Logger.log(surfaceDestroyed : ??);
}
mStatusListener.onCameraDestroy();
}
};

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


[android-developers] Device Camera preview record problem

2012-04-06 Thread apaladin
Hi first thank you for read this Thread

I want make video record App

first seeing camera preview  with Camera(Device camera) and record
start User interaction(MediaRecorder)
but Camera.setPreviewDisplay(surfaceholder) and
MediaRecorder.setPreviewDisplay(surfaceholder) crash

i attached  setPreviewDisplay in surfacechange: in devicecamera
and When user pushed record start buttn  in activity  start recording

but it didnt work just Exception in startRecord();

just generated empty file my given name


Thank you have a nice day;

Here is my code--

package com.test.camera.Preview

import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.text.SimpleDateFormat;
import java.util.Date;

import android.content.Context;
import android.os.*;

import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.widget.FrameLayout;

import android.hardware.Camera;
import android.hardware.Camera.Parameters;
import android.media.MediaRecorder;
import android.media.CamcorderProfile;
import android.media.CameraProfile;

public class CameraOverlay {
Context mContext;
private SurfaceView mCameraPreview;
private SurfaceHolder mSurfaceHolder;

private Camera mCameraDevice;
private MediaRecorder mRecorder;

private OnCameraStateChangeListener mStatusListener;
/**
 *
 */
public CameraOverlay(Context context){
mContext = context;
mCameraPreview = new SurfaceView(mContext);
mSurfaceHolder = mCameraPreview.getHolder();

mSurfaceHolder.addCallback(getSurfaceHolderCallback());
 
mSurfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
}
/**
 *
 */
public void startRecord(){
if(mRecorder !=  null){
stopRecord();
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Debug.log(startRecord:+e.getMessage());
}
}
SimpleDateFormat formatter = new SimpleDateFormat
( MMddHHmmss);
Date currentTime = new Date ( );
String _szFile = String.format(/sdcard/test/
%s.mp4,formatter.format ( currentTime ));

mRecorder = new MediaRecorder();
mCameraDevice.unlock();
mRecorder.setCamera(mCameraDevice);

mRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);

mRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
mRecorder.setVideoFrameRate(15);

mRecorder.setVideoSize(176,144);
mRecorder.setMaxDuration(1000*10);
mRecorder.setMaxFileSize(1024*3000);

mRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);
mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);

try{
mCameraDevice.setPreviewDisplay(null);
mRecorder.setPreviewDisplay(mSurfaceHolder.getSurface());
mRecorder.setOutputFile(_szFile);

mRecorder.prepare();
Thread.sleep(1000);
mRecorder.start();  not work just sound pong and generate
empty file
}catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Debug.log(IllegalStateException:::+_szFile+ : 
+e.getMessage()
+:+e.getLocalizedMessage());
}catch (IOException e) {
Debug.log(IOException:::+_szFile+ : +e.getMessage()
+:+e.getLocalizedMessage());
}catch(Exception error){
Debug.log(Exception:::+_szFile+ : +error.getMessage()
+:+error.getLocalizedMessage());
}
}
/**
 *
 */
public void stopRecord(){
if(mRecorder != null){
mRecorder.reset();
mRecorder.release();
mRecorder = null;
mCameraDevice.lock();
}
}
/**
 *
 * @return
 */
public SurfaceHolder.Callback getSurfaceHolderCallback() {
return new SurfaceHolder.Callback() {
/**
 *
 */
public void surfaceCreated(SurfaceHolder holder) {
Debug.log(surfaceCreated);
try {
mCameraDevice = Camera.open();
mCameraDevice.setPreviewDisplay(holder);
}catch (IOException e) {
mCameraDevice.release();
mCameraDevice = null;
e.printStackTrace();
Debug.log(surfaceCreated:+e.getMessage());
}catch (RuntimeException e) {

[android-developers] Bitmap Handle Error.

2009-05-20 Thread apaladin

i have a two question.

first i want copy image in pixel by pixel

Bitmap mSnowflake = BitmapFactory.decodeResource(mContext.getResources
(), R.drawable.snowflake);
//mSnowflake is black background in white snowflake
Bitmap mChangedBitmap = Bitmap.createBitmap(mSnowflake.getWidth
(),mSnowflake.getHeight(),Config.ARGB_);

copyImage(mSnowflake,mChangedBitmap);

public void copyImage(Bitmap bmSrc,Bitmap bmDest){
for(int x = 0x00; x   bmSrc.getWidth(); x++){
for(int y = 0x00; y  bmSrc.getHeight(); y++){
   bmDest.setPixel(x, y, bmSrc.getPixel(x, y));
}
}
}
i want SrcImage and DestImage very same but DestImage are not same
very slime snowflake
why loss color pixel in destImage i dont Know

second i want change image color

Bitmap mSnowflake = BitmapFactory.decodeResource(mContext.getResources
(), R.drawable.snowflake);
//mSnowflake is black background in white snowflake
i want show red snowflake but check error

public void setAlpha(Bitmap bmSrc,int nOpacity){
  for(int x = 0x00; x   bmSrc.getWidth(); x++){
for(int y = 0x00; y  bmSrc.getHeight(); y++){
  int nColor =  bmSrc.getPixel(x,y);
  if(nColor != 0x00){
bmSrc.setPixel(x, y, Color.RED); error
  }
   }
  }
}

thank you for read this thread!
have a nice day!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] How link to myCustomView and layout.xml?

2009-04-22 Thread apaladin

Hi Thank you for read this Thread.

I want linked mynewviewClass with layout1.xml controls

But running Emulator app is broken  i want all process in my new View

i don't like that.
setContentView(R.layout.layout1);

i want like this
newclass _listView  = new newclass(context);
setContentView(_listView);

but dont match controls

===layout1.xml begin===

?xml version=1.0 encoding=utf-8?
LinearLayout xmlns:android=http://schemas.android.com/apk/res/
android
android:orientation=vertical
android:layout_width=fill_parent
android:layout_height=fill_parent

//my new view class extends View
com.test.android.proc.appname.mngView
  id=@+id/mngView
  android:layout_width=fill_parent
  android:layout_height=fill_parent/

 RelativeLayout
 android:layout_width=fill_parent
 android:layout_height=fill_parent 

  ListView
android:id=@android:id/list
android:persistentDrawingCache=animation|scrolling
android:layout_width=fill_parent
android:layout_height=fill_parent
android:background=@drawable/bg/
/RelativeLayout
/LinearLayout
===layout1.xml end===
===Activity begin===
public class listAct extends ListActivity{
/** Called when the activity is first created.
*...@override
*/
private friendlistView _listView;

public void onCreate(Bundle icicle) {
super.onCreate(icicle);
_listView = new friendlistView(this);
setContentView(_listView);
setListAdapter(_listView.getAdapter());
}
}//
===Activity end===
===new View begin===
class friendlistView extends CextendedView{
.some codes
}
===new View end===


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



[android-developers] How can use mycustomView in layout.xml

2009-04-22 Thread apaladin

Hi Thank you for read this Thread.

I want linked mynewviewClass with layout1.xml controls


But running Emulator app is broken  i want all process in my new View


i don't like that.
setContentView(R.layout.layout1);


i want like this
newclass _listView  = new newclass(context);
setContentView(_listView);


but dont match controls


===layout1.xml begin===


?xml version=1.0 encoding=utf-8?
LinearLayout xmlns:android=http://schemas.android.com/apk/res/
android
android:orientation=vertical
android:layout_width=fill_parent
android:layout_height=fill_parent

//my new view class extends View
com.test.android.proc.appname.mylistView
  id=@+id/mylistView
  android:layout_width=fill_parent
  android:layout_height=fill_parent/


 RelativeLayout
 android:layout_width=fill_parent
 android:layout_height=fill_parent 


  ListView
android:id=@android:id/list
android:persistentDrawingCache=animation|scrolling
android:layout_width=fill_parent
android:layout_height=fill_parent
android:background=@drawable/bg/
/RelativeLayout
/LinearLayout
===layout1.xml end===
===Activity begin===
public class listAct extends ListActivity{
/** Called when the activity is first created.
*...@override
*/
private friendlistView _listView;


public void onCreate(Bundle icicle) {
super.onCreate(icicle);
_listView = new friendlistView(this);
setContentView(_listView);
setListAdapter(_listView.getAdapter());
}


}//


===Activity end===
===new View begin===
class mylistView extends CextendedView{
.some codes

}


===new View end===




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