[android-developers] Margins acting wierd

2009-09-11 Thread loctarar

Hello!

I have a question about margins. From what I noticed if a
RelativeLayout (and probably not only) doesn't know it's size at
measurement time, some child margins are ignored. In my case it's the
bottom margin of the last child, above the bottom border of the
RelativeLayout when the height of the layout is WRAP_CONTENT / I don't
place the layout between some fixed vertical limits.
Why is this happening? If I ask explicitly for a margin it should also
be included in the parent's WRAP_CONTENT specification when measuring
or maybe taken somehow into account.

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] Fullscreen IME problem

2009-08-28 Thread loctarar

Hello!

I have some problems with custom editable views on devices that don't
poses a hardware keyboard. Setting the device in landscape mode
enables the fullscreen IME to show up. This one covers my custom view
but instead provides it's on view on the top of the screen for preview
(?). It initially contains the hint assigned in the EditorInfo
class.
Using an EditableInputConnection + EditText enables the preview to
synchronize with what I type on the keyboard. Using my custom view it
doesn't and all I can see is just the hint text. However the key
presses are recorded by my custom view.
I looked through the sources of EditText and EditableInputConnection
but I couldn't find anything that suggests how to make the preview to
work.

Any type of guidance would be really helpful. As I stated in my
previous posts I can't use the TextView widgets and solving this is a
must :(.

Thanks,
Andrei
--~--~-~--~~~---~--~~
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: Fullscreen IME problem

2009-08-28 Thread loctarar

Fixed :). I read the doc in
http://developer.android.com/reference/android/inputmethodservice/InputMethodService.html
. I had to also implement the getExtractedText method.
Sorry for wasting space on the group servers :P.

On Aug 28, 3:19 pm, loctarar andrei.bu...@gmail.com wrote:
 Hello!

 I have some problems with custom editable views on devices that don't
 poses a hardware keyboard. Setting the device in landscape mode
 enables the fullscreen IME to show up. This one covers my custom view
 but instead provides it's on view on the top of the screen for preview
 (?). It initially contains the hint assigned in the EditorInfo
 class.
 Using an EditableInputConnection + EditText enables the preview to
 synchronize with what I type on the keyboard. Using my custom view it
 doesn't and all I can see is just the hint text. However the key
 presses are recorded by my custom view.
 I looked through the sources of EditText and EditableInputConnection
 but I couldn't find anything that suggests how to make the preview to
 work.

 Any type of guidance would be really helpful. As I stated in my
 previous posts I can't use the TextView widgets and solving this is a
 must :(.

 Thanks,
 Andrei
--~--~-~--~~~---~--~~
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] Architecture dilema

2009-08-20 Thread loctarar

Hello!

This may sound a little silly. Let's say I want to build a game with a
menu, an options screen, a form screen (for the user to insert some
data) and the game screen. The usual approach would be to have an
activity for each case (correct me if I'm wrong). What if I do another
thing... and code four views for each case and swap them using
setContentView() in the same activity? Suppose that I'll override the
onSaveInstanceState() to save the state of the views in all the four
cases.

What is the disadvantage in this approach besides having a huge
activity that I'm sure it gets closed every time the system is low in
memory?

I haven't tested it yet, but I didn't find anything in the docs that
could stop this approach to work. The reasons for avoiding the usual
implementation is that I need to convert an application from J2ME and
having multiple activities raises some difficulties in the porting
process.

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] setSoftInputMode() and addFlags()

2009-08-18 Thread loctarar

Hello!

I've noticed some incompatibility between these two functions.
public void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 this.getWindow().addFlags
(WindowManager.LayoutParams.FLAG_FULLSCREEN);
 this.getWindow().setSoftInputMode
(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
 .
}

Enabling the fullscreen flag seems to disable the soft input adjust
mode. I looked through the source code of the two functions but I
coulnd't find anything that might cause this.

Any suggestions?
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] Re: setSoftInputMode() and addFlags()

2009-08-18 Thread loctarar

If I think better, maybe that's the way it should act. The FULL_SCREEN
flag makes my window to cover the entire screen so basically it can't
be shrinked. A workaround to my problem would be a solution to how to
hide the status bar besides the FULL_SCREEN flag.

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] Displaying virtual keyboard

2009-08-14 Thread loctarar

Hello!

I need help with showing the integrated virtual keyboard on-screen. I
extended a View class and I implemented these two methods (most of it
is just stub code; for now I only want to display the keyboard):
@Override
public InputConnection onCreateInputConnection (EditorInfo outAttrs)
{
BaseInputConnection fic = new BaseInputConnection(this, true);

outAttrs.actionLabel = null;
outAttrs.hintText = Insert the test text;
outAttrs.initialCapsMode = 0;
outAttrs.initialSelEnd = outAttrs.initialSelStart = -1;
outAttrs.label = Test text;
outAttrs.inputType = InputType.TYPE_CLASS_NUMBER |
InputType.TYPE_NUMBER_FLAG_DECIMAL;
outAttrs.imeOptions = EditorInfo.IME_ACTION_DONE;

return fic;
}

@Override
public boolean onCheckIsTextEditor() {
return true;
}

In the onCreate method of my activity I have :

InputMethodManager imm = (InputMethodManager)this.getSystemService
(Context.INPUT_METHOD_SERVICE);
imm.showInputMethodPicker();

imm.showSoftInput(editor, InputMethodManager.SHOW_FORCED);

Where editor is an instance of my View. I noticed in the debugger that
my onCreateInputConnection() is executed but after that the keyboard
is not displayed on the screen.
Using the TextView widtget and it's subclasses is not an option.

Thank you!
--~--~-~--~~~---~--~~
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's Drawable.Callback

2009-08-10 Thread loctarar

Hello!

I have a small curiosity. How does a generic View use the
Drawable.Callback interface? Only for the background?
This question aroused from the need to make a more special animation
(neither tween nor frame) that should be drawn inside a View. I did
the following:
1. I made a class that extended Drawable and implemented Runnable. In
run() I placed my animation logic.
2. I overridden scheduleDrawable() and invalidateDrawable() methods in
a View class so that schedule would postDelayed the Runnable defined
above and invalidate would invalidate the view where the animation
should modify the window. I also set my View class to be Callback for
the Drawable.
3. In the draw() method of Drawable I used scheduleSelf with a certain
delay to animate the Drawable.

It works, but I don't understand why if in my implementation
scheduleDrawable() I call super.scheduleDrawable() on the first line
the postDelayed function doesn't work anymore (and neither the
animation). So to resume my questions:
Is it ok what I did and what is the default implementation of
Drawable.Callback in a View?

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] Re: PopupWindow animation

2009-08-09 Thread loctarar

Hello!

Yes, it seems I have the same problem. I'll test it on a G1 device
tommorow at work and tell you if it works.

On Aug 9, 10:46 am, skink psk...@gmail.com wrote:
 On Aug 8, 4:46 pm, loctarar andrei.bu...@gmail.com wrote:

  Solved :). If anyone is interested the styles.xml should look like
  this:

  resources
          style name=Animation.Popup parent=android:Animation
          item name=android:windowEnterAnimation@anim/popup_in/
  item
          item name=android:windowExitAnimation@anim/popup_out/
  item
      /style
  /resources

 hi loctarar,

 thanks for sharing!

 i had the same problem some time ago when using your first solution
 and since the lack of documentation for that matter and lack of my
 time i gave up...

 now it works, but still, i have some minor issue: when i change my
 enter/exit animatiins the changes are not applied. somehow my original
 animations are shown.

 booting the emulator cures this

 did you have such behavior?

 pskink
--~--~-~--~~~---~--~~
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] PopupWindow animation

2009-08-08 Thread loctarar

Hello! I have some issues with making PopupWindows animate when
showing. The setAnimationStyle takes parameter a resource ID to what
exactly? I took a look through the android resources and built my own
animation style using the values/styles.xml as an example.

My styles.xml file:
resources
style name=Animation parent=android:Animation
/style
style name=Animation.Popup
item name=android:windowEnterAnimation@anim/popup_in/
item
item name=android:windowExitAnimation@anim/popup_out/
item
/style
/resources

where popup_* looks like this:
scale xmlns:android=http://schemas.android.com/apk/res/android;
android:fromXScale=0.0
android:toXScale=1.0
android:fromYScale=0.0
android:toYScale=1.0
android:pivotX=50%
android:pivotY=50%
android:duration=1000 /

Then I call popupWindowObject.setAnimationStyle
(R.style.Animation_Popup). How am I wrong? A solution to my problem
would be very helpful as it would really ease my application
development process (otherwise I'll need to find a solution to
simulate a PopupWindow with scale effect).

Thanks a lot 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] Re: PopupWindow animation

2009-08-08 Thread loctarar

Solved :). If anyone is interested the styles.xml should look like
this:

resources
style name=Animation.Popup parent=android:Animation
item name=android:windowEnterAnimation@anim/popup_in/
item
item name=android:windowExitAnimation@anim/popup_out/
item
/style
/resources


On Aug 8, 11:56 am, loctarar andrei.bu...@gmail.com wrote:
 Hello! I have some issues with making PopupWindows animate when
 showing. The setAnimationStyle takes parameter a resource ID to what
 exactly? I took a look through the android resources and built my own
 animation style using the values/styles.xml as an example.

 My styles.xml file:
 resources
     style name=Animation parent=android:Animation
     /style
     style name=Animation.Popup
         item name=android:windowEnterAnimation@anim/popup_in/
 item
         item name=android:windowExitAnimation@anim/popup_out/
 item
     /style
 /resources

 where popup_* looks like this:
 scale xmlns:android=http://schemas.android.com/apk/res/android;
         android:fromXScale=0.0
     android:toXScale=1.0
     android:fromYScale=0.0
     android:toYScale=1.0
     android:pivotX=50%
     android:pivotY=50%
     android:duration=1000 /

 Then I call popupWindowObject.setAnimationStyle
 (R.style.Animation_Popup). How am I wrong? A solution to my problem
 would be very helpful as it would really ease my application
 development process (otherwise I'll need to find a solution to
 simulate a PopupWindow with scale effect).

 Thanks a lot 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] RelativeLayout question

2009-08-04 Thread loctarar

Hello!
I would like to build a layout with this structure (I used buttons
only as an example in the XML file):


BCCD
BCCD
BCCD
BCCD
BCCD

Where A = Button01, B = Button02, D=Button03 and C is a ScrollView/
another layout.

The XML is the following:
?xml version=1.0 encoding=utf-8?

RelativeLayout android:id=@+id/RelativeLayout01
android:layout_width=fill_parent android:layout_height=fill_parent
xmlns:android=http://schemas.android.com/apk/res/android;
Button android:text=Button01 android:id=@+id/Button01
android:layout_height=wrap_content
android:layout_alignParentTop=true
android:layout_width=fill_parent/Button
ScrollView android:id=@+id/ScrollView01
android:layout_height=fill_parent android:layout_below=@+id/
Button01 android:layout_alignParentBottom=true
android:layout_toLeftOf=@+id/Button03 android:layout_toRightOf=@+id/
Button02 android:layout_width=wrap_content
Button android:text=Button04 android:id=@+id/Button04
android:layout_width=wrap_content
android:layout_height=wrap_content/Button
/ScrollView
Button android:layout_width=wrap_content android:id=@+id/
Button03 android:text=Button03 android:layout_height=fill_parent
android:layout_alignParentBottom=true android:layout_below=@+id/
Button01 android:layout_toRightOf=@+id/ScrollView01
android:layout_alignParentRight=true/Button
Button android:layout_width=wrap_content android:id=@+id/
Button02 android:text=Button02 android:layout_height=fill_parent
android:layout_alignParentBottom=true android:layout_below=@+id/
Button01 android:layout_toLeftOf=@+id/ScrollView01
android:layout_alignParentLeft=true/Button
/RelativeLayout

The problem is that Button03 fills all the space under the Button01,
even though the layout_width of the ScrollView is fill_parent (I'm not
sure if this value is correctly chosen). I tried to set up the
relations between the views as exactly as possible. Where am I wrong?

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] Folder issues

2009-07-30 Thread loctarar

Hello!

I have the following piece of code:

File recordDir = currentContext.getDir(recordPath,
Context.MODE_PRIVATE);
...
String[] fileList = recordDir.list();

I surrounded the getDir call with try/catch blocks and seems to
succede. However, fileList is null. Also, recordDir.exists() returns
true but recordDir.isDirectory() returns false. Is this normal?

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] Re: Folder issues

2009-07-30 Thread loctarar

UPDATE: IT works on the emulator, but not on the device. The OS is up
to date. I can't figure out why it's not functioning properly.on the
physical device (T-Mobile G1).

On Jul 30, 10:41 am, loctarar andrei.bu...@gmail.com wrote:
 Hello!

 I have the following piece of code:

 File recordDir = currentContext.getDir(recordPath,
 Context.MODE_PRIVATE);
 ...
 String[] fileList = recordDir.list();

 I surrounded the getDir call with try/catch blocks and seems to
 succede. However, fileList is null. Also, recordDir.exists() returns
 true but recordDir.isDirectory() returns false. Is this normal?

 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] ContentProvider questions

2009-07-26 Thread loctarar

I have some questions about how the ContentProvider works behind the
scenes.
1. The ContentProvider class is registered in the kernel when the
application is installed and then what? Or how do the other
applications exactly manage to access the application data?
2. When is actually onCreate called? The documentation is pretty
vague...
3. What happens if two applications register the same provider class?
(I have more applications that must communicate between eachother.
The
content provider must be registered, of course, along with the first
application installed on the system. The problem here is that I don't
know which one will be, so I want to deliver the ContentProvider with
all the applications)

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