Re: [android-developers] Re: VectorDrawable/BitmapDrawable in custom view.

2015-02-23 Thread Sérgio Faria
Maybe if you move face.png to drawable-nodpi-v17 it will work
If it doesn't work you can use the inflate method to force it.

2015-02-23 21:44 GMT+00:00 Nathan nathan.d.mel...@gmail.com:
 No ideas?

 In Android Wear, it is definitely using the vector drawable.

 In Nexus, 9, it is definitely using a raster one and there appears to be now
 way to force it.

 Nathan

 --
 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
 ---
 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.
 For more options, visit https://groups.google.com/d/optout.

-- 
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
--- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [android-developers] Re: NullPointerException in java.io.File.fixSlashes?

2015-02-19 Thread Sérgio Faria
Well, either the stack trace is wrong or the source is not the one I linked 
to (android-2.3.4_r1) or you're doing new File((String) null)

Let's see:

3 at java.io.File.init(File.java:139)
138. public File(String path) {
139. init(path);

2 at java.io.File.init(File.java:189)

186. private void init(String dirtyPath) {
187. // Cache the path and the absolute path.
188. // We can't call isAbsolute() here (http://b/2486943).
189. String cleanPath = fixSlashes(dirtyPath);

1 at java.io.File.fixSlashes(File.java:205)
202. private String fixSlashes(String origPath) {
203. // Remove duplicate adjacent slashes.
204. boolean lastWasSlash = false;
205. char[] newPath = origPath.toCharArray();

On Thursday, February 19, 2015 at 9:59:30 AM UTC, Fran wrote:

 Except I am not doing it...

 On Wed, Feb 18, 2015, 15:26 Sérgio Faria sergi...@gmail.com javascript: 
 wrote:

 Given the stack above, it seems you're doing new File(null)

 https://android.googlesource.com/platform/libcore/+/
 android-2.3.4_r1/luni/src/main/java/java/io/File.java

 2015-02-18 11:45 GMT+00:00 Fran fmma...@gmail.com javascript::
  It seems this problem persists more than three years after. I am
  experiencing the same problem right now, all of them with Android 2.3.4
 
 
  On Sunday, June 5, 2011 at 4:21:31 PM UTC+2, Derek wrote:
 
  Hi all,
 
  We get crash reports with the following error:
  java.lang.NullPointerException
  at java.io.File.fixSlashes(File.java:234)
 
  It appears on File file = new File(path/subfolder);
  on some devices only.
 
  We cannot reproduce it. Where could this problem from from?
 
  Cheers.
 
 
  --
  You received this message because you are subscribed to the Google
  Groups Android Developers group.
  To post to this group, send email to android-d...@googlegroups.com 
 javascript:
  To unsubscribe from this group, send email to
  android-developers+unsubscr...@googlegroups.com javascript:
  For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en
  ---
  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 javascript:.
  For more options, visit https://groups.google.com/d/optout.

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-d...@googlegroups.com 
 javascript:
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com javascript:
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en
 ---
 You received this message because you are subscribed to a topic in the 
 Google Groups Android Developers group.
 To unsubscribe from this topic, visit https://groups.google.com/d/
 topic/android-developers/b3XY_KvU7g4/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to 
 android-developers+unsubscr...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/d/optout.



-- 
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
--- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [android-developers] Re: NullPointerException in java.io.File.fixSlashes?

2015-02-18 Thread Sérgio Faria
Given the stack above, it seems you're doing new File(null)

https://android.googlesource.com/platform/libcore/+/android-2.3.4_r1/luni/src/main/java/java/io/File.java

2015-02-18 11:45 GMT+00:00 Fran fmmar...@gmail.com:
 It seems this problem persists more than three years after. I am
 experiencing the same problem right now, all of them with Android 2.3.4


 On Sunday, June 5, 2011 at 4:21:31 PM UTC+2, Derek wrote:

 Hi all,

 We get crash reports with the following error:
 java.lang.NullPointerException
 at java.io.File.fixSlashes(File.java:234)

 It appears on File file = new File(path/subfolder);
 on some devices only.

 We cannot reproduce it. Where could this problem from from?

 Cheers.


 --
 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
 ---
 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.
 For more options, visit https://groups.google.com/d/optout.

-- 
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
--- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [android-developers] can I get DhcpInfo - for Ethernet? instead of WiFi?

2014-08-21 Thread Sérgio Faria
If you're willing to go the JNI route, here are some pointers:

http://man7.org/linux/man-pages/man3/getifaddrs.3.html
https://github.com/kmackay/android-ifaddrs
https://stackoverflow.com/questions/4951257/using-c-code-to-get-same-info-as-ifconfig

2014-08-21 11:37 GMT+01:00 Mihai Badea rumbur...@gmail.com:
 Thank you. But I was looking for a solution to work on 3.1 - 4.4 (Where
 Ethernet is).
 At the moment 100% of the users of my app are on 2.3 - 4.4 and I got a few
 1 star for lacking Ethernet support.
 I don't foresee many people switching to Android L soon to use this API :-)

 On Friday, August 15, 2014 2:16:49 AM UTC+1, Robert Greenwalt wrote:

 There will be API to access this in the next release.  I think even the
 previous release from Google I/O may have had API in the ConnectivityManager
 to access a LinkProperties object for each network (or the current default
 network) which would contain this information.

 --
 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
 ---
 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.
 For more options, visit https://groups.google.com/d/optout.

-- 
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
--- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [android-developers] Menu icon position

2014-07-31 Thread Sérgio Faria
2014-07-31 5:08 GMT+01:00 TreKing treking...@gmail.com:
 For example, this won't be there on device with Menu Buttons, despite it
 being phased out.

You have ViewConfigurator#hasPermanentMenuKey()
https://developer.android.com/reference/android/view/ViewConfiguration.html#hasPermanentMenuKey%28%29
to check for 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
--- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [android-developers] ObjectAnimator starting with a frame jump on Android 4.4 (nexus 5) but not in 4.1 device

2014-07-13 Thread Sérgio Faria
My guess would be that you're starting the animation before the view is ready.
You can use an old Animation or try to start the Animator in
OnPreDrawListener or in onResume().

2014-07-13 10:44 GMT+01:00 saex elpablos...@gmail.com:
 I have a simple activity that shows an animation with ObjectAnimator. The
 animation is created and started in onCreate method of the activity, it is a
 very simple animation:

 cloudAnim = ObjectAnimator.ofFloat(cloud1ImageView, x, sw);
 cloudAnim.setDuration(35000);
 cloudAnim.setRepeatCount(ValueAnimator.INFINITE);
 cloudAnim.setRepeatMode(ValueAnimator.RESTART);
 cloudAnim.setInterpolator(null);
 cloudAnim.start();

 it simply displays a cloud on the left of the screen and moves from the left
 to the right.

 The problem is that in my nexus 5 (android 4.4 lastet version) the cloud is
 doing a frame jump when the activity starts.

 This jump is only visible in my nexus 5, because i'm testing the app also in
 a huawei ascend y300 devide with android 4.1 and the jump is not visible,
 the movement is very smooth.

 What is wrong with ObjectAnimator and Android 4.4?

 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
 ---
 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.
 For more options, visit https://groups.google.com/d/optout.

-- 
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
--- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [android-developers] ObjectAnimator starting with a frame jump on Android 4.4 (nexus 5) but not in 4.1 device

2014-07-13 Thread Sérgio Faria
Doesn't the same thing happens when the animation restarts?

Shouldn't your cloud start fully hidden because when the animation
resets, it will show the whole view on the left at once.

int start = cloud1ImageView.getLeft() -
cloud1ImageView.getRight(); // start  0
cloudAnim = ObjectAnimator.ofFloat(cloud1ImageView, View.X, start, sw);

I'm assuming the cloud is clipped if x  0.
Also this won't work in onCreate because the view dimensions are
unknown. It will work in OnPreDrawListener.

2014-07-13 12:40 GMT+01:00 saex elpablos...@gmail.com:
 Hi

 thanks for your answer, i tryed it, and not working :(

 El domingo, 13 de julio de 2014 12:34:53 UTC+2, Sérgio Faria escribió:

 My guess would be that you're starting the animation before the view is
 ready.
 You can use an old Animation or try to start the Animator in
 OnPreDrawListener or in onResume().

 2014-07-13 10:44 GMT+01:00 saex  an animation with ObjectAnimator. The
  animation is created and started in onCreate method of the activity, it
  is a
  very simple animation:
 
  cloudAnim = ObjectAnimator.ofFloat(cloud1ImageView, x, sw);
  cloudAnim.setDuration(35000);
  cloudAnim.setRepeatCount(ValueAnimator.INFINITE);
  cloudAnim.setRepeatMode(ValueAnimator.RESTART);
  cloudAnim.setInterpolator(null);
  cloudAnim.start();
 
  it simply displays a cloud on the left of the screen and moves from the
  left
  to the right.
 
  The problem is that in my nexus 5 (android 4.4 lastet version) the cloud
  is
  doing a frame jump when the activity starts.
 
  This jump is only visible in my nexus 5, because i'm testing the app
  also in
  a huawei ascend y300 devide with android 4.1 and the jump is not
  visible,
  the movement is very smooth.
 
  What is wrong with ObjectAnimator and Android 4.4?
 
  Thanks
 
  --
  You received this message because you are subscribed to the Google
  Groups Android Developers group.
  To post to this group, send email to
  To unsubscribe from this group, send email to
  For more options, visit this group at
  ---
  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

 --
 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
 ---
 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.
 For more options, visit https://groups.google.com/d/optout.

-- 
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
--- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [android-developers] Re: IllegalAccessError occur in a receiver,when a new version apk replaced a older one!

2014-07-13 Thread Sérgio Faria
On Dalvik you'll get that error if you use a custom ClassLoader that
loads classes from other ClassLoader(s) (eg. the API of a plugin).
If you're using this, you have two options: either dont export the
symbols or remove them at runtime[1] (you'll need to move the class
definitions and zero out the remaining space).

[1]: https://source.android.com/devices/tech/dalvik/dex-format.html

2014-07-13 14:00 GMT+01:00 shiqun.shi shiqunshi...@163.com:

 I notice this two methods, handleReceiver() and makeApplication()。

 In which case,packageInfo.makeApplication(false, mInstrumentation); was
 called and mApplication == null? Which will make a receiver be
 instantiated(by cl.loadClass(component).newInstance())before
 packageInfo.makeApplication(false, mInstrumentation); and
 instrumentation.callApplicationOnCreate(app);.



  private void handleReceiver(ReceiverData data) {

 // If we are getting ready to gc after going to the background,
 well

 // we are back active so skip it.

 unscheduleGcIdler();



 String component = data.intent.getComponent().getClassName();



 LoadedApk packageInfo = getPackageInfoNoCheck(

 data.info.applicationInfo, data.compatInfo);



 IActivityManager mgr = ActivityManagerNative.getDefault();



 BroadcastReceiver receiver;

 try {

 java.lang.ClassLoader cl = packageInfo.getClassLoader();

 data.intent.setExtrasClassLoader(cl);

 data.setExtrasClassLoader(cl);

 receiver =
 (BroadcastReceiver)cl.loadClass(component).newInstance();

 } catch (Exception e) {

 if (DEBUG_BROADCAST) Slog.i(TAG,

 Finishing failed broadcast to  +
 data.intent.getComponent());

 data.sendFinished(mgr);

 throw new RuntimeException(

 Unable to instantiate receiver  + component

 + :  + e.toString(), e);

 }



 try {

 Application app = packageInfo.makeApplication(false,
 mInstrumentation);



 if (localLOGV) Slog.v(

 TAG, Performing receive of  + data.intent

 + : app= + app

 + , appName= + app.getPackageName()

 + , pkg= + packageInfo.getPackageName()

 + , comp= + data.intent.getComponent().toShortString()

 + , dir= + packageInfo.getAppDir());



 ContextImpl context = (ContextImpl)app.getBaseContext();

 sCurrentBroadcastIntent.set(data.intent);

 receiver.setPendingResult(data);

 receiver.onReceive(context.getReceiverRestrictedContext(),

 data.intent);

 } catch (Exception e) {

 if (DEBUG_BROADCAST) Slog.i(TAG,

 Finishing failed broadcast to  +
 data.intent.getComponent());

 data.sendFinished(mgr);

 if (!mInstrumentation.onException(receiver, e)) {

 throw new RuntimeException(

 Unable to start receiver  + component

 + :  + e.toString(), e);

 }

 } finally {

 sCurrentBroadcastIntent.set(null);

 }



 if (receiver.getPendingResult() != null) {

 data.finish();

 }

 }





 public Application makeApplication(boolean forceDefaultAppClass,

 Instrumentation instrumentation) {

 if (mApplication != null) {

 return mApplication;

 }



 Application app = null;



 String appClass = mApplicationInfo.className;

 if (forceDefaultAppClass || (appClass == null)) {

 appClass = android.app.Application;

 }



 try {

 java.lang.ClassLoader cl = getClassLoader();

 ContextImpl appContext = new ContextImpl();

 appContext.init(this, null, mActivityThread);

 app = mActivityThread.mInstrumentation.newApplication(

 cl, appClass, appContext);

 appContext.setOuterContext(app);

 } catch (Exception e) {

 if (!mActivityThread.mInstrumentation.onException(app, e)) {

 throw new RuntimeException(

 Unable to instantiate application  + appClass

 + :  + e.toString(), e);

 }

 }

 mActivityThread.mAllApplications.add(app);

 mApplication = app;



 if (instrumentation != null) {

 try {

 instrumentation.callApplicationOnCreate(app);

 } catch (Exception e) {

 if (!instrumentation.onException(app, e)) {

 throw new RuntimeException(

 Unable to create application  +
 app.getClass().getName()

 + :  + e.toString(), e);

 }

 }

 }



 

[android-developers] Re: How to open or register a new file extension in Android?

2013-09-09 Thread Sérgio Faria


 I don't see this getting fixed unless Google opens up the system mime 
 registry.  (I haven't found any documented API to extend what's returned 
 from e.g.

MimeTypeMap mapper = MimeTypeMap.getSingleton();
String kmlmime = mapper.getMimeTypeFromExtension(gpx);


Have a look at libcore.net.MimeUtils, theres System env 
content.types.user.table (.properties file) or (java.home = 
/system)/lib/content-types.properties.
However, in Android 4.3, the class is already loaded when 
Application#onCreate() is called, so you cannot use 
content.types.user.table for your own app.
So if you have root, you can add mappings for apps that use MimeTypeMap by 
creating/editing /system/lib/content-types.properties and rebooting.

-- 
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
--- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


[android-developers] Re: GLSurfaceView lag/delay on Galaxy S3.

2013-08-04 Thread Sérgio Faria
I'm of the same opinion as Nobu Games, it might be a concurrency issue. 
Canvas works because it runs on the UI Thread.

Edvinas, try this (in your sample):

// replace x and y with a single volatile variable or use synchronized
private volatile long mCoords;

//...
public boolean onTouch(View view, MotionEvent motionEvent) {
float x = motionEvent.getRawX();
float y = motionEvent.getRawY();
mCoords = ((long) Float.floatToIntBits(x)  32) | 
Float.floatToIntBits(y);
return true;
}

public void onDrawFrame(GL10 gl) {
//...
long coords = mCoords;
float x = Float.intBitsToFloat((int) (coords  32));
float y = Float.intBitsToFloat((int) coords);
//...
}

Sexta-feira, 2 de Agosto de 2013 20:20:03 UTC+1, Nobu Games escreveu:

 Hi Edvinas,

 I need to ask again, because I think that may be the cause of the delay: 
 how do you communicate the touch events to your rendering thread? Because 
 Android can bombard your UI thread with lots of touch events in no time. 
 But your rendering thread needs to peek before updating the game state in 
 regular intervals into the current state of touch input. It's your game 
 loop / rendering thread that needs to dictate the rhythm in order to 
 synchronize the whole experience.

 What I do in my game is the following:

 1. Touch input event handler receives all motion events on UI thread
 --- converts motion event data into a custom data structure and puts it 
 into one queue that belongs to UI thread

 2. Simultaneously the game loop / render thread updates the game state and 
 checks for input first:
 --- It requests the data from touch handler in a thread safe manner 
 (synchronized)
 --- Touch handler internally swaps motion data queue A with a 
 secondary motion data queue B
 --- Touch handler returns queue A to game loop
 --- Game loop / render thread processes queue data and recycles all 
 motion data structures (so they can be re-used in order to avoid garbage 
 collection activity)

 And that repeats like this and these two queues get always swapped. That 
 way you let your game loop determine the pace.

 On Thursday, August 1, 2013 4:30:57 AM UTC-5, Edvinas Kilbauskas wrote:

 OK, I did that. And yes. It doesn't have the delay anymore! But the 
 problem is... It's Canvas. I don't need canvas, it doesn't fulfill my 
 needs. I need OpenGL.
 What the hell could be wrong? This is REALLY strange. OpenGL ES 1.0 has 
 delay, ES 1.1 has delay, ES 2.0 has delay. Canvas - no delay!
 This should be other way around, because as far as I know canvas uses 
 software rendering, while OpenGL uses hardware, which should be way faster!
 Any more ideas?



-- 
-- 
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
--- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




[android-developers] Re: Customized Soft keyboard

2012-06-27 Thread Sérgio Faria
Have a look at 
KeyboardViewhttps://developer.android.com/reference/android/inputmethodservice/KeyboardView.html.
 
You define the keyboard using a XML file like this:

Keyboard xmlns:android=http://schemas.android.com/apk/res/android;
android:keyHeight=50dp
android:keyWidth=16.66%p 

Row
Key
android:codes=8
android:keyLabel=1 /
...

Then, in code, all you need to do is set the keyboard and set a keyboard 
listener to handle key presses.
If you manage to get the right keycodes for all keys, then you only need to 
implement this part to make it work:

protected class KeyboardListener implements OnKeyboardActionListener {

@Override
public void onKey(int primaryCode, int[] keyCodes) {
long eventTime = System.currentTimeMillis();

KeyEvent event = new KeyEvent(eventTime, eventTime,
KeyEvent.ACTION_DOWN, primaryCode, 0, 0, 0, 0,
KeyEvent.FLAG_SOFT_KEYBOARD | 
KeyEvent.FLAG_KEEP_TOUCH_MODE);

getActivity().dispatchKeyEvent(event);
}
...
}

Terça-feira, 26 de Junho de 2012 17:21:38 UTC+1, Harish escreveu:

 Hello Friends,
  
 For my Android tablet application I'm looking a customize keyboard, 
 customize in the sense I have many list view in my application and to 
 filter data in list I need keyboard with just 26 letter and 9 number,(list 
 will only have character or numbers)
 I see many post where people are trying to develop entire keyboard, 
 however I'm looking for some solution where I can control keys of existing 
 keyboard. 
 I do not wants to enter in complexity of handling input methods or writing 
 some thing complex.
 I see that in numeric keyboard it's possible to give keys which we wants 
 to show, is there any similar solution where I can just give list of keys I 
 wants to show,
  
 appreciate 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: How to enable Bluetooth programmatically

2012-06-15 Thread Sérgio Faria
You were doing some thing like thi and doesn't work?
BluetoothAdapter.getDefaultAdapter().enable();

Remeber that you need  the android.Manifest.permission.BLUETOOTH_ADMIN 
permission.
Sometimes Bluez fails to start it the first time, you can try to enable 
after some delay, it should end up working.

private final Runnable mBluetoothEnabler = new Runnable() {

@Override
public void run() {
if (!mBluetoothAdapter.isEnabled()) {
if (!mBluetoothAdapter.enable()) {
mHandler.postDelayed(mBluetoothEnabler, 200L);
}
} else {
onBluetoothEnabled();
}
}
};

Quarta-feira, 13 de Junho de 2012 9:20:53 UTC+1, İsacan Akkoca escreveu:

 Hi everyone,
 I want open bluetooth from my application but i didn't open. Can you show 
 how to work this?


-- 
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: Controlling a SAXParser using buttons

2012-06-15 Thread Sérgio Faria
I think a 
FileChannelhttps://developer.android.com/reference/java/nio/channels/FileChannel.htmlis
 quite close to what you need. Get the FileChannel from a 
RandomAccessFilehttps://developer.android.com/reference/java/io/RandomAccessFile.htmlthen
 you can use the 
Channelshttps://developer.android.com/reference/java/nio/channels/Channels.htmlclass
 to convert it to an InputStream for the parser.

The problem is getting the *right* positions from within the Handler. I've 
no idea if its possible, its depends on the parser internals I guess (eg. 
buffering).

Sexta-feira, 15 de Junho de 2012 1:56:41 UTC+1, r4f4 escreveu:

  Use Document, which stores the data in memory, allowing you to traverse 
 the 
  hierarchy in any order. 

 That could work, but I forgot to mention that the file has something 
 like 8 Mb. 

 Isn't that too big to keep in memory ? 



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

[android-developers] Re: How to resize width fragment

2012-06-12 Thread Sérgio Faria
This is completely untested code, but should work (with some typos fixed):
-First wrap the fragment in a FrameLayout like this:

FrameLayout
android:id=@+id/fragMenuFrame 
android:layout_width=200dp 
android:layout_height=match_parent 
fragment 
android:id=@+id/fragMenu 
android:layout_width=match_parent 
android:layout_height=match_parent 
android:background=@color/GREY 
class=com.viettel.vinamilk.view.main.ListFrag / 
/FrameLayout

-Then get hold of the container with findViewById, and get the 
LayoutParams. Note that when casting to a more specific class, use the 
parent LayoutParams class, not FrameLayout.LayoutParams...

ViewGroup.LayoutParams params = menuFrame.getLayoutParams();
params.width = ViewGroup.FILL_PARENT;
requestLayout();

Sexta-feira, 8 de Junho de 2012 8:15:28 UTC+1, Huynh Ngoc Bang escreveu:

 Hi everyone! 
 I have layout same as: 
 LinearLayout xmlns:android=http://schemas.android.com/apk/res/ 
 android 
 android:layout_width=fill_parent 
 android:layout_height=fill_parent 
 android:background=@color/WHITE 
 android:orientation=horizontal  

 fragment 
 android:id=@+id/fragMenu 
 android:layout_width=200dp 
 android:layout_height=match_parent 
 android:background=@color/GREY 
 class=com.viettel.vinamilk.view.main.ListFrag / 

 FrameLayout 
 android:id=@+id/fragDetail 
 android:layout_width=0px 
 android:layout_height=match_parent 
 android:layout_weight=1/ 

 /LinearLayout 



 I would like to resize fragment (id = fragMenu) when runing app. 
 Who can help me! 


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