[android-developers] Get RSSI of surrounding wireless networks

2011-02-02 Thread Schoel
Hi,

Is it possible to get the RSSI of surrounding wireless networks
without doing a full scan? I need periodic updates about surrounding
networks perhaps every 5 seconds. Can't do a scan that often. Using
aidl would work if the info is available anywhere.

/Schoel

-- 
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] ImageButton drawable size

2011-01-13 Thread Schoel
Hello,

I have created a 9patch image which I would like to use as border on
ImageButtons and ImageViews. However, when I set the drawable (with
setImageResource) to a drawable that's larger than the ImageButton
size, the border (which is set with android:background) the border
gets hidden behind the drawable. I've set the optional Padding box in
the 9patch and it seems this is not respected by the ImageButton. Any
ideas on how I can solve this?

/Schoel

-- 
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: ImageButton drawable size

2011-01-13 Thread Schoel
Setting the scaleType to centerInside did the trick. Sorry if I wasted
your time!

On 13 Jan, 12:27, Schoel samuelsson.j...@gmail.com wrote:
 Hello,

 I have created a 9patch image which I would like to use as border on
 ImageButtons and ImageViews. However, when I set the drawable (with
 setImageResource) to a drawable that's larger than the ImageButton
 size, the border (which is set with android:background) the border
 gets hidden behind the drawable. I've set the optional Padding box in
 the 9patch and it seems this is not respected by the ImageButton. Any
 ideas on how I can solve this?

 /Schoel

-- 
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: Theme.Dialog bug in 2.1?

2011-01-12 Thread Schoel
Is the topmost activity intended to occupy the screen without being
visible? I don't mind the entire activity stack popping up when this
happens, but the topmost dialog is not even visible but it's still
there. This is not the case when using 2.2, like I described above, so
something has been changed.

On 12 Jan, 09:13, Dianne Hackborn hack...@android.com wrote:
 That is the intended behavior and has been the case since 1.0.  The common
 case is that you have one application with one task that goes together.  If
 you want to split it into separate tasks, you need to explicitly do so.



 On Tue, Jan 11, 2011 at 11:27 PM, Schoel samuelsson.j...@gmail.com wrote:
  Thank you very much, Dianne Hackborn! That helped. Still seems like a
  bug though, doesn't it? Maybe a fixed one at that since it seems to
  work in 2.2.

  On 11 Jan, 18:33, Dianne Hackborn hack...@android.com wrote:
   This is because all activities in an .apk are given the same task
  affinity
   by default, so they will try to stay together on the same stack.  You can
   use android:taskAffinity on an activity to change this.  Use  if you
  don't
   want a task affinity for an activity (probably what you want for the
   dialog).

   There is some description of this here:
 http://developer.android.com/guide/topics/fundamentals.html#afftask

   On Tue, Jan 11, 2011 at 4:52 AM, Schoel samuelsson.j...@gmail.com
  wrote:
Hello,

I have found some weird behaviour which might be a bug. I found it
while developing a quite large application but I've been able to
reproduce the behaviour in a minimal approach so that I can provide
source code.

I have a service that is constantly running and at certain times it
pops up an activity with Theme.Dialog as theme for the user.
Everything works fine if the main activity of the program has been
destroyed (via back button) or if the main activity is currently
running.

However, if the main activity of the app has been created and then
minimized (e.g. via Home button), the main activity shows up. It is
not possible to click the buttons of the main activity because it
seems to be hidden behind an invisible dialog activity. It is possible
to click the buttons of the dialog if you know where they are and if
you click the back button, you can see the dialog flashing by as it
disappears and it is then possible to click the main activity buttons.

I've tested this on HTC Desire 2.2, HTC Wildfire 2.1, HTC Legend 2.1,
Sony x10 mini pro 2.1 and on emulators 2.1 and 2.2. The behaviour
described happens on all 2.1 devices and emulator but not on emulator
2.2 nor on the Desire with 2.2.

Source code is provided below. There are 2 buttons in the main
activity, the first, called Finish asks the service to popup the
dialog in 3 seconds and then finishes the main activity. This button
is for illustrative purposes only, it works fine. The second button,
called Post later just asks the service to popup the dialog in 3
seconds. If the second button is clicked and before the 3 seconds have
passed, the home button is clicked, the bug appears.

Source code:
Main.java:
--
package com.myapp.DialogBugTest;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;

public class Main extends Activity
{
   private Handler handler = new Handler();

   private final Runnable runnable = new Runnable()
   {
       public void run()
       {
           DialogBugTestService.getInstance().showDialog();
       }
   };

   /** Called when the activity is first created. */
  �...@override
   public void onCreate(Bundle savedInstanceState)
   {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.main);

       startService(new Intent(this, DialogBugTestService.class));
   }

   public void onFinishButton(View aView)
   {
       handler.postDelayed(runnable, 3000);
       finish();
   }

   public void onLaterButton(View aView)
   {
       handler.postDelayed(runnable, 3000);
   }
}
--
main.xml:
--
?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

       Button
               android:id=@+id/finish_button
           android:layout_width=fill_parent
           android:layout_height=wrap_content
           android:text=Finish
           android:onClick=onFinishButton
           /
       Button

[android-developers] Theme.Dialog bug in 2.1?

2011-01-11 Thread Schoel
Hello,

I have found some weird behaviour which might be a bug. I found it
while developing a quite large application but I've been able to
reproduce the behaviour in a minimal approach so that I can provide
source code.

I have a service that is constantly running and at certain times it
pops up an activity with Theme.Dialog as theme for the user.
Everything works fine if the main activity of the program has been
destroyed (via back button) or if the main activity is currently
running.

However, if the main activity of the app has been created and then
minimized (e.g. via Home button), the main activity shows up. It is
not possible to click the buttons of the main activity because it
seems to be hidden behind an invisible dialog activity. It is possible
to click the buttons of the dialog if you know where they are and if
you click the back button, you can see the dialog flashing by as it
disappears and it is then possible to click the main activity buttons.

I've tested this on HTC Desire 2.2, HTC Wildfire 2.1, HTC Legend 2.1,
Sony x10 mini pro 2.1 and on emulators 2.1 and 2.2. The behaviour
described happens on all 2.1 devices and emulator but not on emulator
2.2 nor on the Desire with 2.2.


Source code is provided below. There are 2 buttons in the main
activity, the first, called Finish asks the service to popup the
dialog in 3 seconds and then finishes the main activity. This button
is for illustrative purposes only, it works fine. The second button,
called Post later just asks the service to popup the dialog in 3
seconds. If the second button is clicked and before the 3 seconds have
passed, the home button is clicked, the bug appears.

Source code:
Main.java:
--
package com.myapp.DialogBugTest;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;

public class Main extends Activity
{
private Handler handler = new Handler();

private final Runnable runnable = new Runnable()
{
public void run()
{
DialogBugTestService.getInstance().showDialog();
}
};

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

startService(new Intent(this, DialogBugTestService.class));
}

public void onFinishButton(View aView)
{
handler.postDelayed(runnable, 3000);
finish();
}

public void onLaterButton(View aView)
{
handler.postDelayed(runnable, 3000);
}
}
--
main.xml:
--
?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

Button
android:id=@+id/finish_button
android:layout_width=fill_parent
android:layout_height=wrap_content
android:text=Finish
android:onClick=onFinishButton
/
Button
android:id=@+id/later_button
android:layout_width=fill_parent
android:layout_height=wrap_content
android:text=Post later
android:onClick=onLaterButton
/
/LinearLayout
--
DialogBugTestService.java:
--
package com.myapp.DialogBugTest;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.util.Log;

public class DialogBugTestService extends Service
{
private static DialogBugTestService instance = null;
@Override
public void onCreate()
{
super.onCreate();
instance = this;
}

@Override
public int onStartCommand(Intent intent, int flags, int startId)
{
return START_STICKY;
}


public static DialogBugTestService getInstance()
{
if (instance == null)
{
Log.e(service, instance is null!);
}
return instance;
}

public void showDialog()
{
Intent intent = new Intent(this, DialogBugDialog.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}

@Override
public IBinder onBind(Intent arg0)
{
return null;
}
}
--
DialogBugDialog.java:
--
package com.optimobile.DialogBugTest;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;


public class DialogBugDialog extends Activity
{

@Override

[android-developers] Re: Theme.Dialog bug in 2.1?

2011-01-11 Thread Schoel
This is a phone application, and the popup only comes up if the user
has actively selected set the option for it (disabled on default). I
am aware of people's (and my own!) opinions on popups :)

On 11 Jan, 17:16, Streets Of Boston flyingdutc...@gmail.com wrote:
 It looks like a bug, but you should rethink showing a dialog from a
 background service.

 Users rellly don't like pop-up dialogs or other screens suddenly
 popping up when they are busy doing something else. The only screen
 that can get away with this is the phone-application.

 Instead, consider putting a notification in the top status-bar. Then
 when the user clicks this notification, start the necessary activity
 that is appropriate for your application.

 On Jan 11, 7:52 am, Schoel samuelsson.j...@gmail.com wrote:

  Hello,

  I have found some weird behaviour which might be a bug. I found it
  while developing a quite large application but I've been able to
  reproduce the behaviour in a minimal approach so that I can provide
  source code.

  I have a service that is constantly running and at certain times it
  pops up an activity with Theme.Dialog as theme for the user.
  Everything works fine if the main activity of the program has been
  destroyed (via back button) or if the main activity is currently
  running.

  However, if the main activity of the app has been created and then
  minimized (e.g. via Home button), the main activity shows up. It is
  not possible to click the buttons of the main activity because it
  seems to be hidden behind an invisible dialog activity. It is possible
  to click the buttons of the dialog if you know where they are and if
  you click the back button, you can see the dialog flashing by as it
  disappears and it is then possible to click the main activity buttons.

  I've tested this on HTC Desire 2.2, HTC Wildfire 2.1, HTC Legend 2.1,
  Sony x10 mini pro 2.1 and on emulators 2.1 and 2.2. The behaviour
  described happens on all 2.1 devices and emulator but not on emulator
  2.2 nor on the Desire with 2.2.

  Source code is provided below. There are 2 buttons in the main
  activity, the first, called Finish asks the service to popup the
  dialog in 3 seconds and then finishes the main activity. This button
  is for illustrative purposes only, it works fine. The second button,
  called Post later just asks the service to popup the dialog in 3
  seconds. If the second button is clicked and before the 3 seconds have
  passed, the home button is clicked, the bug appears.

  Source code:
  Main.java:
  --
  package com.myapp.DialogBugTest;

  import android.app.Activity;
  import android.content.Intent;
  import android.os.Bundle;
  import android.os.Handler;
  import android.view.View;

  public class Main extends Activity
  {
      private Handler handler = new Handler();

      private final Runnable runnable = new Runnable()
      {
          public void run()
          {
              DialogBugTestService.getInstance().showDialog();
          }
      };

      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState)
      {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);

          startService(new Intent(this, DialogBugTestService.class));
      }

      public void onFinishButton(View aView)
      {
          handler.postDelayed(runnable, 3000);
          finish();
      }

      public void onLaterButton(View aView)
      {
          handler.postDelayed(runnable, 3000);
      }}

  --
  main.xml:
  --
  ?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
      
          Button
                  android:id=@+id/finish_button
              android:layout_width=fill_parent
              android:layout_height=wrap_content
              android:text=Finish
              android:onClick=onFinishButton
              /
          Button
                  android:id=@+id/later_button
              android:layout_width=fill_parent
              android:layout_height=wrap_content
              android:text=Post later
              android:onClick=onLaterButton
              /
  /LinearLayout
  --
  DialogBugTestService.java:
  --
  package com.myapp.DialogBugTest;

  import android.app.Service;
  import android.content.Intent;
  import android.os.IBinder;
  import android.util.Log;

  public class DialogBugTestService extends Service
  {
      private static DialogBugTestService instance = null;
      @Override
      public void onCreate

[android-developers] Re: Theme.Dialog bug in 2.1?

2011-01-11 Thread Schoel
Thank you very much, Dianne Hackborn! That helped. Still seems like a
bug though, doesn't it? Maybe a fixed one at that since it seems to
work in 2.2.

On 11 Jan, 18:33, Dianne Hackborn hack...@android.com wrote:
 This is because all activities in an .apk are given the same task affinity
 by default, so they will try to stay together on the same stack.  You can
 use android:taskAffinity on an activity to change this.  Use  if you don't
 want a task affinity for an activity (probably what you want for the
 dialog).

 There is some description of this 
 here:http://developer.android.com/guide/topics/fundamentals.html#afftask



 On Tue, Jan 11, 2011 at 4:52 AM, Schoel samuelsson.j...@gmail.com wrote:
  Hello,

  I have found some weird behaviour which might be a bug. I found it
  while developing a quite large application but I've been able to
  reproduce the behaviour in a minimal approach so that I can provide
  source code.

  I have a service that is constantly running and at certain times it
  pops up an activity with Theme.Dialog as theme for the user.
  Everything works fine if the main activity of the program has been
  destroyed (via back button) or if the main activity is currently
  running.

  However, if the main activity of the app has been created and then
  minimized (e.g. via Home button), the main activity shows up. It is
  not possible to click the buttons of the main activity because it
  seems to be hidden behind an invisible dialog activity. It is possible
  to click the buttons of the dialog if you know where they are and if
  you click the back button, you can see the dialog flashing by as it
  disappears and it is then possible to click the main activity buttons.

  I've tested this on HTC Desire 2.2, HTC Wildfire 2.1, HTC Legend 2.1,
  Sony x10 mini pro 2.1 and on emulators 2.1 and 2.2. The behaviour
  described happens on all 2.1 devices and emulator but not on emulator
  2.2 nor on the Desire with 2.2.

  Source code is provided below. There are 2 buttons in the main
  activity, the first, called Finish asks the service to popup the
  dialog in 3 seconds and then finishes the main activity. This button
  is for illustrative purposes only, it works fine. The second button,
  called Post later just asks the service to popup the dialog in 3
  seconds. If the second button is clicked and before the 3 seconds have
  passed, the home button is clicked, the bug appears.

  Source code:
  Main.java:
  --
  package com.myapp.DialogBugTest;

  import android.app.Activity;
  import android.content.Intent;
  import android.os.Bundle;
  import android.os.Handler;
  import android.view.View;

  public class Main extends Activity
  {
     private Handler handler = new Handler();

     private final Runnable runnable = new Runnable()
     {
         public void run()
         {
             DialogBugTestService.getInstance().showDialog();
         }
     };

     /** Called when the activity is first created. */
    �...@override
     public void onCreate(Bundle savedInstanceState)
     {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.main);

         startService(new Intent(this, DialogBugTestService.class));
     }

     public void onFinishButton(View aView)
     {
         handler.postDelayed(runnable, 3000);
         finish();
     }

     public void onLaterButton(View aView)
     {
         handler.postDelayed(runnable, 3000);
     }
  }
  --
  main.xml:
  --
  ?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

         Button
                 android:id=@+id/finish_button
             android:layout_width=fill_parent
             android:layout_height=wrap_content
             android:text=Finish
             android:onClick=onFinishButton
             /
         Button
                 android:id=@+id/later_button
             android:layout_width=fill_parent
             android:layout_height=wrap_content
             android:text=Post later
             android:onClick=onLaterButton
             /
  /LinearLayout
  --
  DialogBugTestService.java:
  --
  package com.myapp.DialogBugTest;

  import android.app.Service;
  import android.content.Intent;
  import android.os.IBinder;
  import android.util.Log;

  public class DialogBugTestService extends Service
  {
     private static DialogBugTestService instance = null;
    �...@override
     public void onCreate()
     {
         super.onCreate();
         instance = this;
     }

    �...@override
     public int onStartCommand(Intent intent, int

[android-developers] Re: Thread problems

2010-12-23 Thread Schoel
Thank you for insightful answers! I have now found the reason for my
problem and feel kinda stupid for not thinking about it. The UI thread
makes a call to the engine which spawns a thread and calls
queryUserThread, however, the call to the engine is still synchronous
and the UI thread waits for a reply. So when i try to startActivity,
the UI thread is busy waiting for it's function call and thus a
deadlock is created.

 You didn't include information on what s_Semaphore is, but I'm guessing
 it's from java.concurrent.

This is correct.

 Although I'm not too familiar with this package, the docs say this:

 http://download.oracle.com/javase/1.5.0/docs/api/java/util/concurrent...

  Conceptually, a semaphore maintains a set of permits. Each acquire()
  blocks if necessary until a permit is available, and then takes it.

 If you constructed the semaphore with 1 for permits, then what you
 are seeing is as designed - the semaphore will block on second acquire.
 It's not reentrant, the way synchronized blocks are (which can be owned
 multiple times by the same thread).

That's what I did and also what I intended. The call to queryUserSave
SHOULD block until onQueryUserSaveResult is called (this is just a
worker thread, not the UI thread).

 - Rewrite the code using only the language's built-in synchronization

I should have mentioned I also tried this with the same result.

-- 
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] Thread problems

2010-12-22 Thread Schoel
I have a function call from a large engine (which I can not change)
which asks the user whether to save or not. Before this function call
returns, I need an answer from the user whether to save.

There is, as far as I know, no way to start an activity (or show a
dialog) that synchronously returns an answer. Therefore I did like
this (code is not complete but should be enough for understanding):

int queryUserSave()
{
   s_Semaphore.acquire();
   startActivity(QueryUserSaveActivity);
   s_Semaphore.acquire();
   s_Semaphore.release();
   return s_nQueryUserSaveResult;
}

void onQueryUserSaveResult(int aResult)
{
   s_nQueryDialingLineResult = aResult;
   s_Semaphore.release();
}


The problem is, on the second acquire, the program halts (as intended)
without spawning the QueryUserSaveActivity (not as intended). The idea
was that the QueryUserSaveActivity would be spawned and the second
acquire would block until onQueryUserSaveResult is called.
I've checked the thread id of the thread in which queryUserSave is
called and the thread id in which the QueryUserSaveActivity is started
(if I don't use any semaphores) and they are not the same. I thus
conclude that startActivity starts the activity in another thread (the
UI thread) and therefore shouldn't care about the second acquire call.
I also tried setting the startActivity in its own thread and start
that thread with the same result as above.
Do you have any ideas what I can do to solve this?

Appriciate any help,
Schoel

-- 
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: View width and calculated text width doesn't match

2010-12-15 Thread Schoel
That might be an idea, thanks. I wish the API would be more clear
about these things.

Yes, it is a subclass of TextView.

On 15 Dec, 09:12, Kostya Vasilyev kmans...@gmail.com wrote:
 The mismatch is by a factor of 1.5.

 Which kinda looks like a mismatch between pixel and dp units of an hdpi
 (240 dpi) device.

 In what context is this code run? Is this a subclass of TextView?

 I'd recommend you take a look at the source, to see if these methods
 actually scale text size, you might discover something interesting.

 In particular, TextView getSize returns pixels, but setSize assumes the
 value is in SP units, and scales it.

 http://netmite.com/android/mydroid/1.0/frameworks/base/core/java/andr...

 -- Kostya

 15.12.2010 10:45, Schoel пишет:



  I can provide some additional information here:
  m_TestPaint = new Paint();
  m_TestPaint.set(getPaint());
  m_MaxTextSize = getTextSize();
  m_TestPaint.setTextSize(m_MaxTextSize);
  Log.e(FintFit, Paint text size:  + m_TestPaint.getTextSize());
  Log.e(FintFit, Text text size:  + getTextSize());

  This outputs 42.0 and 63.0 respectively. That doesn't seem right, does
  it? Why isn't the Paint respecting the size I set to it?

  Zsolt: Thanks for the offer but I can't send you my .apk as this code
  is part of a closed source project.

  BR,
  Schoel

 --
 Kostya Vasilyev -- WiFi Manager + pretty widget 
 --http://kmansoft.wordpress.com

-- 
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: View width and calculated text width doesn't match

2010-12-15 Thread Schoel
That indeed seems to be the issue, on the emulator, they both return
the same size (whereas on my phone, they do not).
Trying to browse the source for Paint, I found that getTextSize is a
native function with a quite useless comment about it returning the
text size. Any idea where I can find C source code?

BR,
Schoel

On 15 Dec, 09:12, Kostya Vasilyev kmans...@gmail.com wrote:
 The mismatch is by a factor of 1.5.

 Which kinda looks like a mismatch between pixel and dp units of an hdpi
 (240 dpi) device.

 In what context is this code run? Is this a subclass of TextView?

 I'd recommend you take a look at the source, to see if these methods
 actually scale text size, you might discover something interesting.

 In particular, TextView getSize returns pixels, but setSize assumes the
 value is in SP units, and scales it.

 http://netmite.com/android/mydroid/1.0/frameworks/base/core/java/andr...

 -- Kostya

 15.12.2010 10:45, Schoel пишет:



  I can provide some additional information here:
  m_TestPaint = new Paint();
  m_TestPaint.set(getPaint());
  m_MaxTextSize = getTextSize();
  m_TestPaint.setTextSize(m_MaxTextSize);
  Log.e(FintFit, Paint text size:  + m_TestPaint.getTextSize());
  Log.e(FintFit, Text text size:  + getTextSize());

  This outputs 42.0 and 63.0 respectively. That doesn't seem right, does
  it? Why isn't the Paint respecting the size I set to it?

  Zsolt: Thanks for the offer but I can't send you my .apk as this code
  is part of a closed source project.

  BR,
  Schoel

 --
 Kostya Vasilyev -- WiFi Manager + pretty widget 
 --http://kmansoft.wordpress.com

-- 
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] View width and calculated text width doesn't match

2010-12-14 Thread Schoel
Hello,

I am trying to create a view that fits a text into a given text view.
I've done a new view that has a custom XML attribute called
minTextSize that is a dimension. Whenever text is set on the text
view, it tries with all sizes from the desired (specified in the xml)
down to minTextSize until it finds one that fits. This works perfectly
on an emulator, I get the desired behaviour but when I try it on my
HTC Desire, the calculated text width and the calculated width of the
text view doesn't seem to match.
I've tried both Paint.measureText, Paint.getTextWidths and
Paint.getTextBounds, all with the exact same result. Around 9
characters fit in the view but I have to write around 18 characters
before it starts making the font size smaller.
I use View.getWidth to measure the width of the view and it seems to
be correct since it claims to take 392 pixels out of the 480 available
(which looks about right).
The only thing I can think of is that measureText and getWidth uses
different units. Could that be the case? Do you have any other ideas
for me?
I've tried Stack Overflow and all answers I've seen uses one of the
three methods in Paint mentioned above.

I appriciate any help,
Schoel

-- 
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: View width and calculated text width doesn't match

2010-12-14 Thread Schoel
I can provide some additional information here:
m_TestPaint = new Paint();
m_TestPaint.set(getPaint());
m_MaxTextSize = getTextSize();
m_TestPaint.setTextSize(m_MaxTextSize);
Log.e(FintFit, Paint text size:  + m_TestPaint.getTextSize());
Log.e(FintFit, Text text size:  + getTextSize());

This outputs 42.0 and 63.0 respectively. That doesn't seem right, does
it? Why isn't the Paint respecting the size I set to it?

Zsolt: Thanks for the offer but I can't send you my .apk as this code
is part of a closed source project.

BR,
Schoel

-- 
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: Overriding the home button

2010-10-28 Thread Schoel

 So if I want to ignore a call without outright rejecting it (so the caller
 doesn't know I rejected it) I have to sit there and let it ring out, even if
 I was in the middle of something I want to get back to ASAP?

Good point, didn't think of that. However, there's no way to
accomplish what I wanted to anyway :)

-- 
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] Overriding the home button

2010-10-27 Thread Schoel
Hello,

I am trying to override the home button in my application. I am aware
that this is not recommended behaviour and all links I've found about
this says that it is actually not possible. However, the native dialer
of HTC Sense as well as the dialer for Sony Ericsson (tested on X10
mini) both ignore the home button press on incomming calls. How can I
do the samein my app?

/Schoel

-- 
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: Variable number of settings

2010-09-08 Thread Schoel
The idea I've gotten so far is to extend the PreferenceScreen class
and make a PresenceScreen which fills itself with whatever has been
saved to it when it loads. This idea still feels a bit to vague though
and I would appriciate any help! If anyone knows where to get the
source code for the WiFi selector that would also be most helpful.

Thanks,
/Schoel

On 7 Sep, 17:54, Schoel samuelsson.j...@gmail.com wrote:
 Hello,

 I'd like to make a preference screen with a variable number of
 preferences, very much like the WiFi selector. A number of profiles
 should be clickable and possible to edit and in the bottom there
 should be an add profile button. Has anyone got any tips on how to
 accomplish this?
 All I've found is 
 this:http://groups.google.com/group/android-developers/browse_thread/threa...

 and that reply unfortunately doesn't help me very much.

 /Schoel

-- 
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] Variable number of settings

2010-09-07 Thread Schoel
Hello,

I'd like to make a preference screen with a variable number of
preferences, very much like the WiFi selector. A number of profiles
should be clickable and possible to edit and in the bottom there
should be an add profile button. Has anyone got any tips on how to
accomplish this?
All I've found is this:
http://groups.google.com/group/android-developers/browse_thread/thread/e45bb1c0d373be45

and that reply unfortunately doesn't help me very much.

/Schoel

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