[android-developers] How can I download Android Sdk platform-tools without the pain?

2015-12-16 Thread seb mitchell
Hi just wondering if there is a better way to download 
the Android/Sdk/platform-tools files.

Just having a play with http://flutter.io/ via 
 https://atom.io/packages/dartlang editor and got an error about adb, 
on my debian jessie, being out of date.
Also the other android tools are required to build an apk.

So to get  platform-tools files for linux, I have to down load the 326M 
only to find the platform-tools directory empty
http://developer.android.com/sdk/installing/index.html?pkg=tools
Running the  Sdk/tools/android script populated the directory with the 
missing stuff.

What the best way to get a current copy of adb and other tools without 
having to having java installed
and without having to download over 300M?

After all this, running adb resulted in an unhelpful file not found error, 
fixed by adding 32bit stuff in Troubleshooting Ubuntu 
https://developer.android.com/sdk/installing/index.html?pkg=tools


Thanks, so I have no issues now, just what a easy way next time I trash my 
linux setup.
Would be nice to live a java free life too.


-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/55882520-ea20-4f61-9501-693410134454%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[android-developers] Re: Android custom ImageView fade animation

2011-12-29 Thread Seb
Hi, I tried it but it doesn't seem to work :( Here's my code in the
view that triggers the thread code in the activity:

case MotionEvent.ACTION_DOWN:
currentTouchIndex = checkForSquareTouch(X, Y);

if (currentTouchIndex = 0)
{
((MainActivity) this.getContext())

.playSquareAnimation(currentTouchIndex);


Activity code:

public void playSquareAnimation(int currentTouchIndex)
{
ranim = AnimationUtils.loadAnimation(this, R.anim.rotate);
// view.squares[currentTouchIndex].startAnimation(ranim);

runOnUiThread(new Runnable()
{

public void run()
{


view.clock.startAnimation(AnimationUtils.loadAnimation(
MainActivity.this, 
R.anim.rotate));
}
});
}


Any ideas?

Do you think my view's onDraw() method is messing around with the
animation?


On Dec 28, 5:14 am, AlexBonel bonela...@gmail.com wrote:
 On 28 дек, 00:56, Seb stsiop...@googlemail.com wrote:

  Hmm I kind of understand... are you able to provide any code or psuedo
  code though to show how it would fit together?
  On Dec 25, 5:08 pm, AlexBonel bonela...@gmail.com wrote:

 For example:

 public class MyActivity extends Activity {

         private GameView mGameView;

         @Override
         protected void onCreate(Bundle savedInstanceState) {
                 super.onCreate(savedInstanceState);
                 ..
                 // Deffinition of your Activity
                 ..
                 // somewhere (for example in some View.OnXXXListener
 implementation)
                 runOnUiThread(
                         new Runnable() {

                                 @Override
                                 public void run() {

 mGameView.startAnimation(AnimationUtils.loadAnimation(MyActivity.this,
 R.anim.my_animation));
                                 }
                         }
                 );
         }

 }

 Is it clear?

-- 
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: Android custom ImageView fade animation

2011-12-29 Thread Seb
Just to clarify, if I change

view.clock.startAnimation(AnimationUtils.loadAnimation(
MainActivity.this,
R.anim.rotate));

to:

view.startAnimation(AnimationUtils.loadAnimation(
MainActivity.this,
R.anim.rotate));

Then the animation plays, but for the whole view, which isn't what I
want

On Dec 29, 7:24 pm, Seb stsiop...@googlemail.com wrote:
 Hi, I tried it but it doesn't seem to work :( Here's my code in the
 view that triggers the thread code in the activity:

 case MotionEvent.ACTION_DOWN:
                         currentTouchIndex = checkForSquareTouch(X, Y);

                         if (currentTouchIndex = 0)
                         {
                                 ((MainActivity) this.getContext())
                                                 
 .playSquareAnimation(currentTouchIndex);

 Activity code:

 public void playSquareAnimation(int currentTouchIndex)
         {
                 ranim = AnimationUtils.loadAnimation(this, R.anim.rotate);
                 // view.squares[currentTouchIndex].startAnimation(ranim);

                 runOnUiThread(new Runnable()
                 {

                         public void run()
                         {

                                 
 view.clock.startAnimation(AnimationUtils.loadAnimation(
                                                 MainActivity.this, 
 R.anim.rotate));
                         }
                 });
         }

 Any ideas?

 Do you think my view's onDraw() method is messing around with theanimation?

 On Dec 28, 5:14 am, AlexBonel bonela...@gmail.com wrote:







  On 28 дек, 00:56, Seb stsiop...@googlemail.com wrote:

   Hmm I kind of understand... are you able to provide any code or psuedo
   code though to show how it would fit together?
   On Dec 25, 5:08 pm, AlexBonel bonela...@gmail.com wrote:

  For example:

  public class MyActivity extends Activity {

          private GameView mGameView;

          @Override
          protected void onCreate(Bundle savedInstanceState) {
                  super.onCreate(savedInstanceState);
                  ..
                  // Deffinition of your Activity
                  ..
                  // somewhere (for example in some View.OnXXXListener
  implementation)
                  runOnUiThread(
                          new Runnable() {

                                  @Override
                                  public void run() {

  mGameView.startAnimation(AnimationUtils.loadAnimation(MyActivity.this,
  R.anim.my_animation));
                                  }
                          }
                  );
          }

  }

  Is it clear?

-- 
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: Android custom ImageView fade animation

2011-12-27 Thread Seb

Hmm I kind of understand... are you able to provide any code or psuedo
code though to show how it would fit together?
On Dec 25, 5:08 pm, AlexBonel bonela...@gmail.com wrote:
 On 25 дек, 15:31, Seb stsiop...@googlemail.com wrote:

  But can I still define my animations in XML using your suggested
  method?

 Yeah, Why not, just call static AnimationUtils.() with context
 instance (which is your Activity) and id of youranimationxml and
 it'll return youAnimationobject that you can pass to your
 startAnimation() method

-- 
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: Android custom ImageView fade animation

2011-12-25 Thread Seb
But can I still define my animations in XML using your suggested
method?

On Dec 24, 6:27 pm, AlexBonel bonela...@gmail.com wrote:
 On 23 дек, 07:49, Seb stsiop...@googlemail.com wrote:

  Brilliant, that's useful, will give that a go. Any advice for the
  original issue?

 Well, I have got only one idea, but I think there is another better
 method to do, but never mind, try to call
 Activity.runOnUIThread(Runnable) method and pass there a Runnable
 whereanimationwould be launched.

-- 
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: Android custom ImageView fade animation

2011-12-23 Thread Seb
Brilliant, that's useful, will give that a go. Any advice for the
original issue?

On Dec 23, 6:51 am, AlexBonel bonela...@gmail.com wrote:
 Has looked through your code and saw one big perfomance issue:

 protected void onDraw(Canvas canvas) {
     Paint foreground = new Paint(Paint.ANTI_ALIAS_FLAG);
 ...

 }

 It takes too much time when your try to allocate memory for Paint
 object. If you work withanimationit always calls invalidate() method
 which redraws your View. Memory allocation for Paint should be outside
 of onDraw() method (e.g. when you create your view, in it's
 constructor) it will give you much better perfomance that you have
 now. Try to do so and you'll see.

-- 
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: Android custom ImageView fade animation

2011-12-22 Thread Seb
Bump: Can anyone help? If I define an imageview in my activity and
then set an animation for it, then it plays fine. But if I define an
image view as a member in my custom view and then try to play its
animation, it does not play. Any help is appreciated...

On Dec 18, 4:59 pm, Seb stsiop...@googlemail.com wrote:
 I am creating a game. Most of the computation is done in acustomView
 class which contains a grid ofcustomSquares which extendimageview.
 Here's some code to describe what's happening:

 public class GameView extends View {
 public Square squares[] = null;

 public GameView(Context context, AttributeSet a) {
     super(context, a);
     setFocusable(true);

 }

 @Override
 protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
 {
     super.onMeasure(widthMeasureSpec, heightMeasureSpec);
     squares = new Square[numSquares];

 }

 public void resetGame()
 {

 }

 public void restartGame()
 {

 }

 public boolean onTouchEvent(MotionEvent event) {
     int eventaction = event.getAction();
     int X = (int)event.getX();
     int Y = (int)event.getY();

     switch (eventaction)
     {
     case MotionEvent.ACTION_DOWN:
         currentTouchIndex = checkForSquareTouch(X, Y);

         if(currentTouchIndex = 0)
         {
             squares[currentTouchIndex].select();
             ((MainActivity)this.getContext()).startSquareAnimation();

         .
     return true;

 }

 Thats the main View. Square implementation:

 public class Square extendsImageView{

 public Square(Context context, AttributeSet attrs, int x, int y,
         int squareWidth, boolean operator, int textS, Typeface f) {
     super(context, attrs);
 {
             this.setImageResource(R.drawable.chalkbox);
     this.getDrawable().setBounds(x, y, x + squareWidth, y +
 squareWidth);

     this.setAlpha(10);

 }

 protected void onDraw(Canvas canvas) {
     Paint foreground = new Paint(Paint.ANTI_ALIAS_FLAG);
     foreground.setStyle(Style.FILL);
     foreground.setTextSize(textSize);
     foreground.setColor(Color.WHITE);
     foreground.setTextScaleX(1);
     foreground.setTextAlign(Paint.Align.CENTER);
     foreground.setTypeface(font);

     int left = this.getDrawable().getBounds().left;
     int right = this.getDrawable().getBounds().right;
     int top = this.getDrawable().getBounds().top;
     int bottom = this.getDrawable().getBounds().bottom;

     if (invalidMove) {

     }

     if (isOperator) {
         if (text.equals(+))
             bottom += 10;

         if (text.equals(/))
             bottom += 5;

         if (text.equals(x) || text.equals(/))
             foreground.setTextSize(textSize - 5);
         else
             foreground.setTextSize(textSize);
     }

     this.getDrawable().draw(canvas);
     canvas.drawText(text, (left + right) / 2, ((top + bottom) / 2) +
 10, foreground);

 }

 Hope that gives you a view of the structure. I'm trying to animate the
 Square, so that when a player presses on a Square, the Square
 brightens and then fades again when they lift their finger off. The
 problem is that the call to square[0].startAnimation() does not seem
 to be working and theanimationis not playing. Am I doing something
 wrong?

-- 
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] Android custom ImageView fade animation

2011-12-18 Thread Seb
I am creating a game. Most of the computation is done in a custom View
class which contains a grid of custom Squares which extend imageview.
Here's some code to describe what's happening:

public class GameView extends View {
public Square squares[] = null;

public GameView(Context context, AttributeSet a) {
super(context, a);
setFocusable(true);

}

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
{
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
squares = new Square[numSquares];
}

public void resetGame()
{

}

public void restartGame()
{

}

public boolean onTouchEvent(MotionEvent event) {
int eventaction = event.getAction();
int X = (int)event.getX();
int Y = (int)event.getY();

switch (eventaction)
{
case MotionEvent.ACTION_DOWN:
currentTouchIndex = checkForSquareTouch(X, Y);

if(currentTouchIndex = 0)
{
squares[currentTouchIndex].select();
((MainActivity)this.getContext()).startSquareAnimation();

.
return true;
}

Thats the main View. Square implementation:

public class Square extends ImageView {

public Square(Context context, AttributeSet attrs, int x, int y,
int squareWidth, boolean operator, int textS, Typeface f) {
super(context, attrs);
{
this.setImageResource(R.drawable.chalkbox);
this.getDrawable().setBounds(x, y, x + squareWidth, y +
squareWidth);


this.setAlpha(10);
}

protected void onDraw(Canvas canvas) {
Paint foreground = new Paint(Paint.ANTI_ALIAS_FLAG);
foreground.setStyle(Style.FILL);
foreground.setTextSize(textSize);
foreground.setColor(Color.WHITE);
foreground.setTextScaleX(1);
foreground.setTextAlign(Paint.Align.CENTER);
foreground.setTypeface(font);

int left = this.getDrawable().getBounds().left;
int right = this.getDrawable().getBounds().right;
int top = this.getDrawable().getBounds().top;
int bottom = this.getDrawable().getBounds().bottom;

if (invalidMove) {

}

if (isOperator) {
if (text.equals(+))
bottom += 10;

if (text.equals(/))
bottom += 5;

if (text.equals(x) || text.equals(/))
foreground.setTextSize(textSize - 5);
else
foreground.setTextSize(textSize);
}

this.getDrawable().draw(canvas);
canvas.drawText(text, (left + right) / 2, ((top + bottom) / 2) +
10, foreground);
}

Hope that gives you a view of the structure. I'm trying to animate the
Square, so that when a player presses on a Square, the Square
brightens and then fades again when they lift their finger off. The
problem is that the call to square[0].startAnimation() does not seem
to be working and the animation is not playing. Am I doing something
wrong?

-- 
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] HTTP post request with HTTP Auth

2011-11-25 Thread Seb
As the topic indicates I'm trying to perform a http post request to a page 
secured with basic http authentication.

It works from the command line with curl as following:
curl http://snot%40snot.dk:supersnot_at_teletracker.herokuapp.com/devices 
-d device[name]=snot -d device[device_id]=1234

But with the java code below I get redirected to a login form. Any ideas 
what I'm doing wrong?
Note that the username and password I have supplied is working so, if 
anyone cares, please try it out. You just have to replace _at_ with @


private void sendDeviceIdToServer(String deviceId) {
DefaultHttpClient client = new DefaultHttpClient();
client.getCredentialsProvider().setCredentials(
new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT),
new UsernamePasswordCredentials(snot_at_snot.dk, supersnot));
//new UsernamePasswordCredentials(snot%40snot%2Edk, supersnot));
HttpPost post = new 
HttpPost(http://teletracker.herokuapp.com/devices;);
try {
ListNameValuePair nameValuePairs = new ArrayListNameValuePair(1);
nameValuePairs.add(new BasicNameValuePair(device[name], from 
android));
nameValuePairs.add(new BasicNameValuePair(device[device_id], 
deviceId));

post.setEntity(new UrlEncodedFormEntity(nameValuePairs));

ResponseHandlerString handler = new BasicResponseHandler();
String response = client.execute(post, handler);
Log.d(HttpResponse, response);
} catch (IOException e) {
e.printStackTrace();
}
}

-- 
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] Sending/Receiving data with Socket

2011-04-20 Thread seb
Hi all,

I am having some issues with sending and receiving data to and from a
socket.

This is the class I put together from an example on the web:

[code]
package com.kinrou.android.socket_test;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketAddress;

import android.os.AsyncTask;
import android.util.Log;

public class NetworkTask extends AsyncTaskVoid, byte[], Boolean {
Socket nsocket; //Network Socket
InputStream nis; //Network Input Stream
OutputStream nos; //Network Output Stream

@Override
protected void onPreExecute() {
Log.i(AsyncTask, onPreExecute);
}

@Override
protected Boolean doInBackground(Void... params) { //This runs on
a different thread
boolean result = false;
try {
Log.i(AsyncTask, doInBackground: Creating socket);
SocketAddress sockaddr = new InetSocketAddress(some.url,
9339);
nsocket = new Socket();
nsocket.connect(sockaddr); //10 second connection timeout
if (nsocket.isConnected()) {
nis = nsocket.getInputStream();
nos = nsocket.getOutputStream();

Log.i(AsyncTask, doInBackground: Socket created,
streams assigned);
Log.i(AsyncTask, doInBackground: Waiting for inital
data...);
byte[] buffer = new byte[4096];
int read = nis.read(buffer, 0, 4096); //This is
blocking
while(read != -1){
byte[] tempdata = new byte[read];
System.arraycopy(buffer, 0, tempdata, 0, read);
publishProgress(tempdata);
Log.i(AsyncTask, doInBackground: Got some
data);
read = nis.read(buffer, 0, 4096); //This is
blocking
}
}
} catch (IOException e) {
e.printStackTrace();
Log.i(AsyncTask, doInBackground: IOException);
result = true;
} catch (Exception e) {
e.printStackTrace();
Log.i(AsyncTask, doInBackground: Exception);
result = true;
} finally {
try {
nis.close();
nos.close();
nsocket.close();
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
Log.i(AsyncTask, doInBackground: Finished);
}
return result;
}

public void SendDataToNetwork(String cmd) { //You run this from
the main thread.
try {
if (nsocket.isConnected()) {
Log.i(AsyncTask, SendDataToNetwork: Writing
received message to socket );
//nos.write(cmd.getBytes());
} else {
Log.i(AsyncTask, SendDataToNetwork: Cannot send
message. Socket is closed);
}
} catch (Exception e) {
Log.i(AsyncTask, SendDataToNetwork: Message send
failed. Caught an exception);
}
}

@Override
protected void onProgressUpdate(byte[]... values) {
if (values.length  0) {
Log.i(AsyncTask, onProgressUpdate:  + values[0].length
+  bytes received.);
  //  textStatus.setText(new String(values[0]));
}
}
@Override
protected void onCancelled() {
Log.i(AsyncTask, Cancelled.);
}
@Override
protected void onPostExecute(Boolean result) {
if (result) {
Log.i(AsyncTask, onPostExecute: Completed with an
Error.);
} else {
Log.i(AsyncTask, onPostExecute: Completed.);
}
}
}
[/code]


the this the way I have am using it:

in onCreate I have this
networktask = new NetworkTask();
networktask.execute();


in onClick I have this
networktask.SendDataToNetwork(som data to the server);


What I am trying to achieve to connect to the socket, send some data
to this socket, when connected the socket would send some data back
which relates to the data sent in the 1st place.

the above class logs the following output at start up

04-19 11:31:40.561: INFO/AsyncTask(6978): onPreExecute
04-19 11:31:40.641: INFO/AsyncTask(6978): doInBackground: Creating
socket
04-19 11:31:40.971: INFO/AsyncTask(6978): doInBackground: Socket
created, streams assigned
04-19 11:31:40.971: INFO/AsyncTask(6978): doInBackground: Waiting for
inital data...

--- when the button is pressed
04-19 11:29:53.591: INFO/AsyncTask(6978): SendDataToNetwork: Writing
received message to socket


I however never get anything back from the server or if I do, I am not
capturing it...

Any help welcome.

Seb

-- 
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

[android-developers] Re: http proxy

2010-12-08 Thread Seb


On Dec 6, 5:59 pm, Satya Prasad ksprasa...@gmail.com wrote:
 Try in the following way.
 setprop net.gprs.http-proxyhttp://10.201.51.54:8080


Thanks, I'll try that.

-- 
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: http proxy

2010-12-08 Thread Seb
On Dec 6, 8:18 pm, Danny Schimke danny.schi...@googlemail.com wrote:
 Hi,

 like many others I have had the same issue and got no internet access
 through proxy. I figured out the following solution:

 Try out comment#39 fromhttp://code.google.com/p/android/issues/detail?id=5508
 http://code.google.com/p/android/issues/detail?id=5508If you have proxy
 dont use its DNS. Instead use the IP address.


This is getting simpler by the minut, but thanks :)

-- 
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] http proxy

2010-12-04 Thread Seb
I'm trying to define a http proxy on my htc desire 2.2.

I've tried using various apps from the market. None worked!
I've tried using the adb shell, that is manually insert the proper
values into the database. Didnt work either.
Finally I tried to make my own app using
Settings.System.putString(getContentResolver(),
Settings.System.HTTP_PROXY, localhost:8080); which also seems to be
ignored. (No exceptions was thrown)

Can anyone tell me how to do this?


best regards,
Seb

-- 
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] https X509 webview

2010-11-23 Thread Seb
I need a webview which can connect and auth using x509 certs.

1. One idea which came to mind was that I could override or implement
some interface where I could use my own code for creating a secure
socket. However I cant seem to get started with this approche. I have
read the docs at 
http://developer.android.com/reference/android/webkit/WebViewClient.html
and AFAI can see this would be the class to override. However I'm not
sure which methods I should replace.

2. Another way would be implementing the following steps:
connect, auth and read the data (the body part of the http response)
and load it into a webview
intercept onclick or url loading and manually use httplib (or
whatever) to read the data and finally load it into the webview again


The first idea seems to be the best from a beautiful code
perspective... but I need some pointers before thats possible for me.
The second solution seems like a hack which actually isnt that big a
deal since client certs (most likely) will be supported in futhere
versions of the android browser. However I'm not 100% sure that it
will actually work. Cookies is one thing which needs to be support by
the httplib in question and also shared with the webview in case
someone wants to use js to read cookies.


Best regards,
Seb

-- 
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] https webview

2010-10-21 Thread Seb
I need to load a https page into a webview. The server requires client
authentication as per X509.

As of now the idea is to override shouldOverrideUrlLoading and use
httpclient to perform the requests and then load the data into my
webview.

Is there a better way... such as overriding the httpclient within
the webview class? or a totally different way?


best regards,
Seb

-- 
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] Get GpsStatus notification in a Service

2010-09-21 Thread Seb
Hi,

I'm trying to find a solution to my problem since a few days, without
any success for the moment.
I would like to get GPS_EVENT_START and GPS_EVENT_STOPPED in a
Service.

For this, in the Service, I get a reference on LocationManager, then
register a listener through addGpsStatusListener. This listener
implements GpsStatus.Listener and so override onGpsStatusChanged(int
event) to get the events I want.

But it doesn't work, the onGpsStatusChanged is never called when the
GPS is started/stopped.

I don't want to use LocationListener because it is too power consuming
for the events I want.
Also ACCESS_FINE_LOCATION permission is set.

I read in some forums and website that the addGpsStatusListener may
doesn't work well on Eclair or Froyo.

If you have a working solution to this issue, it can help me a lot.

Regards,
seb

-- 
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


RE : Re: RE : [android-developers] Re: Droid 2.1-update1 EGL10.eglCreateWindowSurface() deadlocks intermittently

2010-04-08 Thread seb boyart
 465) has died.
04/08/2010 09:44:11 [WARNING] ActivityManager(106) Scheduling restart of
crashed service com.seb.SLWP/.SLWP in 5000ms
04/08/2010 09:44:11 [INFORMATION] WindowManager(106) WIN DEATH:
Window{466c5a68 com.seb.SLWP.SLWP paused=false}
04/08/2010 09:44:11 [WARNING] WallpaperService(106) Wallpaper service gone:
ComponentInfo{com.seb.SLWP/com.seb.SLWP.SLWP}

I think i know how to fix It. I'll Try tonight.

Le 7 avr. 2010 23:46, seb boyart unix...@gmail.com a écrit :

forget it, your code is fine, it call the surfacechanged right, passing good
values for width and height.
for obvious reasons, my sphere isn't restreched after a rotation (it does
approx 5% of the time only), but all initialization is done
in surfacechanged using passed width and height, it worked fine before, but
not anymore.
anyway the code on the blog look fine, i just had to declare the instanceId
var and cast a return value to Runnable to compile it.
i'm gonna publish a commentary with a link to your blog in the code, do you
want something special in it ?

2010/4/7 seb boyart unix...@gmail.com



 I use helixlauncher2 to rotate the desktop on n1.

 Le 7 avr. 2010 23:01, Robert Green r...



-- 
//|¯¯¯||¯¯¯|||\¯¯¯\
\\|___||  ¯¯|¯ |   |/ /
||\  ¯¯\|  '¯¯¯'||   |\ \
||/___/|___|||/___/

-- 
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

To unsubscribe, reply using remove me as the subject.


RE : [android-developers] Re: Droid 2.1-update1 EGL10.eglCreateWindowSurface() deadlocks intermittently

2010-04-07 Thread seb boyart
I use helixlauncher2 to rotate the desktop on n1.

Le 7 avr. 2010 23:01, Robert Green rbgrn@gmail.com a écrit :

That's strange..

First of all, how are you getting orientation changes on an N1?  I
never found a way to get it to do that.

I tested my latest code on www.rbgrn.net on both the N1 and Droid and
both seem to be working well now.  It includes your wait-hack and my
updates.

On Apr 7, 3:57 pm, unixseb unix...@gmail.com wrote:
 i'm currently using the code on your blog, i have an issue on N1, when
 the orientation change, the surfacechanged function of the rendrerer
 isn't called, so i can't reset the frustum to the correct window size.
 i guess it's around the following code, i'm trying to fix it :

 if (needStart) {
   tellRendererSurfaceCreated = true;
 changed = true;
 }
 if (changed) {
 gl = (GL10)
mEglHelper.createSurface(mHolder);
 tellRendererSurfaceChanged = true;
 }
 if (tellRendererSurfaceCreated) {
 mRenderer.onSurfaceCreated(gl,
mEglHelper.mEglConfig);
 tellRendererSurfaceCreated =
false;
 }
 if (tellRendererSurfaceChanged) {
 mRenderer.onSurfaceChanged(gl, w,
h);
 tellRendererSurfaceChanged =
false;
 }

 On 7 avr, 22:32, unixseb unix...@gmail.com wrote:



  i can't tell you if my code works for the droid (i dont own one) but
  it help fixing issues on the N1.
  anyway i still have issues, sometimes it looks like i have 2 opengl
  surfaces swapping from each other after a resume.
  i'm gonna implement your modifications and tell you the effect on the
  N1
  Thanks a lot for everything, my work would have never exists without
  yours ! (and sorry for my poor english ;) )

  On 6 avr, 22:58, Robert Green rbgrn@gmail.com wrote:

   That occasional lock-up started happening constantly to me.  I messed
   around with a few things and found that the Droid really doesn't like
   to have its Display and Context destroyed all the time.

   I modified the code so that it would reuse the display and context as
   much as possible.  I looked through my GLES book and it doesn't say
   explicitly that you should always destroy them when your surface
   changes so I have to assume that it must be ok.  Even if it's not -
   this works and it wasn't working before, so I'm using it.

   Here are the code modifications:

   In EglHelper:

   public void start() {
   Log.d(EglHelper + instanceId, start());
   if (mEgl == null) {
   Log.d(EglHelper + instanceId, getting new EGL);
   /*
* Get an EGL instance
*/
   mEgl = (EGL10) EGLContext.getEGL();
   } else {
   Log.d(EglHelper + instanceId, reusing EGL);
   }

   if (mEglDisplay == null) {
   Log.d(EglHelper + instanceId, getting new display);
   /*
* Get to the default display.
*/
   mEglDisplay =
   mEgl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
   } else {
   Log.d(EglHelper + instanceId, reusing display);
   }

   if (mEglConfig == null) {
   Log.d(EglHelper + instanceId, getting new config);
   /*
* We can now initialize EGL for that display
*/
   int[] version = new int[2];
   mEgl.eglInitialize(mEglDisplay, version);
   mEglConfig = mEGLConfigChooser.chooseConfig(mEgl,
   mEglDisplay);
   } else {
   Log.d(EglHelper + instanceId, reusing config);
   }

   if (mEglContext == null) {
   Log.d(EglHelper + instanceId, creating new context);
   /*
* Create an OpenGL ES context. This must be done only
   once, an OpenGL context is a somewhat heavy object.
*/
   mEglContext = mEGLContextFactory.createContext(mEgl,
   mEglDisplay, mEglConfig);
   if (mEglContext == null || mEglContext ==
   EGL10.EGL_NO_CONTEXT) {
   throw new RuntimeException(createContext failed);
   }
   } else {
   Log.d(EglHelper + instanceId, reusing context);
   }

   mEglSurface = null;
   }

   In GLThread:

   private void stopEglLocked() {
   if (mHaveEgl) {
   mHaveEgl = false;
   mEglHelper.destroySurface();
   sGLThreadManager.releaseEglSurface(this);
   

Re: RE : [android-developers] Re: Droid 2.1-update1 EGL10.eglCreateWindowSurface() deadlocks intermittently

2010-04-07 Thread seb boyart
forget it, your code is fine, it call the surfacechanged right, passing good
values for width and height.
for obvious reasons, my sphere isn't restreched after a rotation (it does
approx 5% of the time only), but all initialization is done
in surfacechanged using passed width and height, it worked fine before, but
not anymore.
anyway the code on the blog look fine, i just had to declare the instanceId
var and cast a return value to Runnable to compile it.
i'm gonna publish a commentary with a link to your blog in the code, do you
want something special in it ?

2010/4/7 seb boyart unix...@gmail.com

 I use helixlauncher2 to rotate the desktop on n1.

 Le 7 avr. 2010 23:01, Robert Green rbgrn@gmail.com a écrit :


 That's strange..

 First of all, how are you getting orientation changes on an N1?  I
 never found a way to get it to do that.

 I tested my latest code on www.rbgrn.net on both the N1 and Droid and
 both seem to be working well now.  It includes your wait-hack and my
 updates.

 On Apr 7, 3:57 pm, unixseb unix...@gmail.com wrote:
  i'm currently using the code on your blog, i have an issue on N1, when
  the orientation change, the surfacechanged function of the rendrerer
  isn't called, so i can't reset the frustum to the correct window size.
  i guess it's around the following code, i'm trying to fix it :
 
  if (needStart) {
tellRendererSurfaceCreated = true;
  changed = true;
  }
  if (changed) {
  gl = (GL10)
 mEglHelper.createSurface(mHolder);
  tellRendererSurfaceChanged =
 true;
  }
  if (tellRendererSurfaceCreated) {
  mRenderer.onSurfaceCreated(gl,
 mEglHelper.mEglConfig);
  tellRendererSurfaceCreated =
 false;
  }
  if (tellRendererSurfaceChanged) {
  mRenderer.onSurfaceChanged(gl, w,
 h);
  tellRendererSurfaceChanged =
 false;
  }
 
  On 7 avr, 22:32, unixseb unix...@gmail.com wrote:
 
 
 
   i can't tell you if my code works for the droid (i dont own one) but
   it help fixing issues on the N1.
   anyway i still have issues, sometimes it looks like i have 2 opengl
   surfaces swapping from each other after a resume.
   i'm gonna implement your modifications and tell you the effect on the
   N1
   Thanks a lot for everything, my work would have never exists without
   yours ! (and sorry for my poor english ;) )
 
   On 6 avr, 22:58, Robert Green rbgrn@gmail.com wrote:
 
That occasional lock-up started happening constantly to me.  I messed
around with a few things and found that the Droid really doesn't like
to have its Display and Context destroyed all the time.
 
I modified the code so that it would reuse the display and context as
much as possible.  I looked through my GLES book and it doesn't say
explicitly that you should always destroy them when your surface
changes so I have to assume that it must be ok.  Even if it's not -
this works and it wasn't working before, so I'm using it.
 
Here are the code modifications:
 
In EglHelper:
 
public void start() {
Log.d(EglHelper + instanceId, start());
if (mEgl == null) {
Log.d(EglHelper + instanceId, getting new EGL);
/*
 * Get an EGL instance
 */
mEgl = (EGL10) EGLContext.getEGL();
} else {
Log.d(EglHelper + instanceId, reusing EGL);
}
 
if (mEglDisplay == null) {
Log.d(EglHelper + instanceId, getting new display);
/*
 * Get to the default display.
 */
mEglDisplay =
mEgl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
} else {
Log.d(EglHelper + instanceId, reusing display);
}
 
if (mEglConfig == null) {
Log.d(EglHelper + instanceId, getting new config);
/*
 * We can now initialize EGL for that display
 */
int[] version = new int[2];
mEgl.eglInitialize(mEglDisplay, version);
mEglConfig = mEGLConfigChooser.chooseConfig(mEgl,
mEglDisplay);
} else {
Log.d(EglHelper + instanceId, reusing config);
}
 
if (mEglContext == null) {
Log.d(EglHelper + instanceId, creating new context);
/*
 * Create an OpenGL ES context. This must be done only

[android-developers] Re: DatePicker: years before 2000

2009-12-17 Thread Seb
  Hi,

I've got users with the same problem with the same Samsung Moment
Phone.
The date can only be set from 2000 to 2090.
If the user sets manually 1984, then when he'll go back in the
DatePickerDialog, the date is 2098.

After a little search, it appears that the DatePicker widget have 2
attributes startYear and endYear that can be set as following to
limit for example from 1900-2010

DatePicker xmlns:android=http://schemas.android.com/apk/res/android;
android:id=@+id/datePicker
android:padding=5dip
android:layout_gravity=center_horizontal
android:layout_width=wrap_content
android:layout_height=wrap_content
android:startYear=1900
android:endYear=2010/

But the DatePicker widget is not accessible from the DatePickerDialog
and so, thoses values can not be set.

So, as I was using DatePickerDialog, I have reimplement this class by
using the original code and sets the attributes in the layout xml file
as shown.

Hope this help someone...

-- 
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] WidgetLayout inside PreferenceActivity displays new then old bitmap...

2009-10-23 Thread Seb

  Hi,

I have a PreferenceActivity designed with a .xml file
Inside the .xml, I have:

...
Preference
  android:key=picture
  android:title=Picture
  android:widgetLayout=@layout/picture
/
...

The widgetLayout xml file is a linearlayout with a ImageView inside.
I have set a default drawable src attribute to the ImageView:

android:src=@drawable/test


When launching, the PreferenceActivity is displayed. The test drawable
as well. Everything is ok.

When I click on the Preference, I have specify to modify the bitmap
inside this widgetLayout as following:

ImageView img = (ImageView) findViewById(R.id.picture_img);
img.setImageBitmap(null);
System.gc();
img.setImageBitmap(newBitmap);


The newBitmap is then well displayed inside the widgetLayout.
I scroll the Preference list (and hide the line that own the
widgetLayout) and then scrolling back to make the line reappear.
Then, the old bitmap is displayed (@drawable/test)  - KO, it
should still display the new bitmap.

I tried to add:
getListView().destroyDrawingCache();
img.invalidate();

But nothing changed...

Can someone help me please ?

Thanks,
Seb.

--~--~-~--~~~---~--~~
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: launching m3u playlist with intent

2009-08-17 Thread Seb

Hi Marco,

Thank you very much for the response. You give me the key to find the
solution.

I had to study the code of PlaylistBrowserActivity to find the
solution.

I give it here if someone else search the solution:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setComponent(new ComponentName
(com.android.music,com.android.music.PlaylistBrowserActivity));
intent.setType(MediaStore.Audio.Playlists.CONTENT_TYPE);
intent.setFlags(0x1000);
intent.putExtra(oneshot, false);
intent.putExtra(playlist, playlistid);
startActivity(intent);

and to retrieve the playlistid:
Cursor cursor = getContentResolver().query
(MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI, null, null, null,
null);
if (cursor != null) {
 if (cursor.moveToFirst()) {
  do {
 playlistid = cursor.getString(cursor.getColumnIndex
(MediaStore.Audio.Playlists._ID));
 playList.add(playlist);
 } while (cursor.moveToNext());
 cursor.close();
 }
}


On 16 août, 21:29, Marco Nelissen marc...@android.com wrote:
 Well, OK, that's not entirely true. While you can't play an arbitrary
 m3u file, you can play playlists that are in the database (which may
 have come from m3u files originally, in which case there path is in
 the _data column).
 To see how, you can look at what happens when you put a shortcut to a
 playlist on the home screen and then launch it.

 On Sun, Aug 16, 2009 at 12:21 PM, Marco Nelissenmarc...@android.com wrote:
  On Sun, Aug 16, 2009 at 6:11 AM, Sebsxercav...@gmail.com wrote:

  Hi,

  Is there a way to launch a playlist whith intent?

  No.

  I can retrieve the path of the m3u playlist with:
  Cursor cursor = context.getContentResolver().query
  (MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI, null, null, null,
  null);
  cursor.getString(cursor.getColumnIndex
  (MediaStore.Audio.Playlists.DATA));

  But, I can't launch this m3u file neither with Intent nor with
  MediaPlayer.

  Is there a way to do this?

  Thanks in advance


--~--~-~--~~~---~--~~
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] launching m3u playlist with intent

2009-08-16 Thread Seb

Hi,

Is there a way to launch a playlist whith intent?

I can retrieve the path of the m3u playlist with:
Cursor cursor = context.getContentResolver().query
(MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI, null, null, null,
null);
cursor.getString(cursor.getColumnIndex
(MediaStore.Audio.Playlists.DATA));

But, I can't launch this m3u file neither with Intent nor with
MediaPlayer.

Is there a way to do this?

Thanks in advance


--~--~-~--~~~---~--~~
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] Memory leak - heap size (again)

2009-08-10 Thread Seb
): bee3f4a4  ac03c7c4  /system/
lib/libsgl.so
08-10 18:03:53.133: INFO/DEBUG(3979): bee3f4a8  0050
08-10 18:03:53.133: INFO/DEBUG(3979): bee3f4ac  afe0e940  /system/
lib/libc.so
08-10 18:03:53.133: INFO/DEBUG(3979): bee3f4b0  0050
08-10 18:03:53.133: INFO/DEBUG(3979): bee3f4b4  afe3c980
08-10 18:03:53.143: INFO/DEBUG(3979): bee3f4b8  00dc
08-10 18:03:53.143: INFO/DEBUG(3979): bee3f4bc  2bb0
08-10 18:03:53.143: INFO/DEBUG(3979): bee3f4c0  
08-10 18:03:53.143: INFO/DEBUG(3979): bee3f4c4  
08-10 18:03:53.143: INFO/DEBUG(3979): bee3f4c8  df002777
08-10 18:03:53.143: INFO/DEBUG(3979): bee3f4cc  e3a070ad
08-10 18:03:53.143: INFO/DEBUG(3979): #00 bee3f4d0  afe39dd0
08-10 18:03:53.153: INFO/DEBUG(3979): bee3f4d4  31d4
08-10 18:03:53.153: INFO/DEBUG(3979): bee3f4d8  00d2000c
08-10 18:03:53.153: INFO/DEBUG(3979): bee3f4dc  ac051e20  /system/
lib/libsgl.so
08-10 18:03:53.153: INFO/DEBUG(3979): bee3f4e0  001ddc60  [heap]
08-10 18:03:53.153: INFO/DEBUG(3979): bee3f4e4  001c93d8  [heap]
08-10 18:03:53.153: INFO/DEBUG(3979): bee3f4e8  000c
08-10 18:03:53.153: INFO/DEBUG(3979): bee3f4ec  afd00979  /system/
lib/libstdc++.so
08-10 18:03:53.153: INFO/DEBUG(3979): #01 bee3f4f0  
08-10 18:03:53.163: INFO/DEBUG(3979): bee3f4f4  ac0538a8  /system/
lib/libsgl.so
08-10 18:03:54.333: INFO/ActivityManager(64): Process
com.myapplication (pid 4238) has died.


Is there a way to monitor the native heap Size for my application?
(not just the Java heap size wich is not growing a lot)

Just for information, this is the BaseAdapter I use for my gallery:

/**
 * Gallerie
 *
 * @author seb
 */
public class ImageAdapter extends BaseAdapter {

static int mGalleryItemBackground = 0;
private Context mContext;
private Cursor mCursor;

public PContext pContext;

Gallery.LayoutParams param = new Gallery.LayoutParams(256,
LayoutParams.FILL_PARENT);

HashMapString, Drawable map = new HashMapString, Drawable();

public ImageAdapter(Cursor cursor, Context c, PContext pContext) {
this.pContext = pContext;
mContext = c;
mCursor = cursor;
// See res/values/attrs.xml for the  defined values here for 
styling
TypedArray a = mContext.obtainStyledAttributes
(R.styleable.Gallery1);
if(mGalleryItemBackground==0)
mGalleryItemBackground = a.getResourceId
(R.styleable.Gallery1_android_galleryItemBackground, 0);
a.recycle();
a = null;
}

public int getCount() {
return mCursor.getCount();
}

public Object getItem(int position) {
return position;
}

public long getItemId(int position) {
return position;
}

/**
 * Called repeatedly to render the View of each item in the gallery.
 */
ImageViewGallery i;
public View getView(int position, View convertView, ViewGroup parent)
{
i = new ImageViewGallery(mContext);
if (convertView == null) {
mCursor.requery();
mCursor.moveToPosition(position);
int id = mCursor.getInt(mCursor.getColumnIndexOrThrow
(MediaStore.Images.ImageColumns._ID));
Uri uri = Uri.withAppendedPath
(MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI, +id);
try {
i.setDrawingCacheEnabled(false);
i.setImageURI(uri);
i.setScaleType(ImageView.ScaleType.FIT_XY);
i.setLayoutParams(param);
i.setBackgroundResource(mGalleryItemBackground);
} catch (Exception e) {
pContext.getRootActivity().showInformation(e);
}
}
return i;
}

protected void finalize() throws Throwable {
try {
Log.e(FINALIZE, this.toString());
} finally {
super.finalize();
}
}
}

Thanks for any help



--~--~-~--~~~---~--~~
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: Memory leak - heap size (again)

2009-08-10 Thread Seb

I think I found a side effect in the native free resources liberation
wich could explain some unexpected java.lang.OutOfMemoryError: bitmap
size exceeds VM budget when we work with large bitmap.

In my application, I work with a lot of big bitmap, a lot of icones,
thumbnail and drawable ressources.
To remove the heap size problem, I work with just one Bitmap at the
same time and when I want to replace this Bitmap in my view, I replace
first the view with a little bitmap (very small in the heap and to
avoid the ondraw error trying to use a recycled bitmap), then I make
a recycle in the big Bitmap and then I replace the big Bitmap with the
new one.
Despite this, I can have a bitmap size exceeds VM budget.

I think this is because when I make a recyle, the ressource are
deleted from the dalvik VM but not immediately from the native heap
size.
I suppose the native memory is remove only if I manualy make a
System.gc()

The problem is maybe that the dalvik VM make a gc if the resources are
missing in the dalvik VM but maybe not if the resources are missing in
the native heap size. You can have a VM wich is low in memory and a
lot of ressources which are growing in the native heap because the GC
is not properly called (that's just an assumption )

You can reproduce the bitmap size exceeds VM budget error easily if
you don't make explicitely System.gc(); just after bitmap.recycle()
(and the error occurs even with only one Bitmap). It work only with
big picture (you can download the project with source and large bitmap
here: http://www.sxercavins.com/AndroidTest.zip ):


public class AndroidTest extends Activity {

ImageView imageView;
Bitmap bitmap;
public static final int NB_ITERATION = 10;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
imageView = (ImageView) findViewById(R.id.iconeAppli);

Button buttIterate = (Button) findViewById
(R.id.iterateWithoutGC);
buttIterate.setOnClickListener(new OnClickListener(){
public void onClick(View v) {
iterate(R.drawable.photo, false);
}});

Button buttIterate2 = (Button) findViewById
(R.id.iterateWithGC);
buttIterate2.setOnClickListener(new OnClickListener(){
public void onClick(View v) {
iterate(R.drawable.photo, true);
}});
}

public void iterate(int ressource, boolean isRunGC){
int iteration = 0;
while(true  iterationNB_ITERATION){
try {
if(bitmap!= null  !bitmap.isRecycled()){
bitmap.recycle();
if(isRunGC)
System.gc();
Log.d(bitmap is recycled, bitmap is 
recycled);
}
/*
 * crash here after some iterations if the bitmap size 
is big
 * even if we do a recycle() and if there no System.gc()
 */
bitmap = 
BitmapFactory.decodeResource(getApplicationContext
().getResources(), ressource);
imageView.setImageBitmap(bitmap);
imageView.invalidate();
Log.d(iteration, +iteration++);
System.gc(); //to force the GC and be sure the heap
probleme does not come from the VM
} catch (Exception e) {
e.printStackTrace();
Log.d(IOException, IOException);
}
}
}

}

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---