[Q] onSizeChanged (dev Question) - Android Q&A, Help & Troubleshooting

I want to know the sizes of view is my app. Most forums say override the onSizeChanged method, but Netbeans isn't finding the method to override like it usually does. How can I get it to?

why not use eclipse? it can quickly find and auto generate the method related code that you mention

Wrote lots of custom views, and never had any issue with onSizeChanged(). Except that Android can be tricky on you and calling it with height and width set to zero if the layout has not been completed by the inflater (then just wait for another callback with non-zero values.)
Using Eclipse.

Alright guys. I'll betray my first Java IDE for Eclipse. =P
I should have done it earlier. This isn't my first problem for not using Eclipse.

Related

Best practice for storing configurations

Hello everyone,
I'm new to Android development. I've written my first little "get my feet wet" ap and am looking to expand on it. One thing I would like to do it give the user more options of things they can configure and I'm wondering about the best way to store that information.
At what point does it become worthwhile to start using mySQL vs just using string data in the prefrences? Or is there another option I've missed (maybe an xml file, but I'm not sure where that would be stored?).
In my case, I'm thinking I have fewer than 100 instances of an object (or objects) that would have 3 or 4 properties associated with them.
Thanks!
Use the SharedPreferences class, is the easiest way to achieve your goal (BTW, SharedPreferences generate a xml file to storing your preferences).
SharedPrefrences is what I used for my basic version, but my understanding is that it allows for name-value pairs right? That works well when you have a predetermined set of prefrences, but what if it's more fluid?
Say I want to allow the user to configure his widgits, and each widget has a number of properties - say "color", "number", and "size". Maybe one user will configure 3 widgets and another user might configure 25.
I can think of a couple of different ways to parse this out into name-value pairs, but is that the best way?
Yep... for me that is the best way. For each user you can put the values using someting like this:
UserName+WidgetID+"PreferenceName"
And thats all... the preferences will be unique for each case, without parsing and 0 errors
Ok, cool. That's one of the options I had considered but didn't know if that would be the most efficient. Of course I'd also have to have a list of all the "Widget ID's" stored in a preference to loop through as well.
I assume the maximum amount of data that can be stored in one prefrence is just whatever the Java max string length is...is that correct?
Yes, you're right

Problems with a spinner

Hi ! I'm developing an app which uses a webview with a local HTML. First, I need to set the nationality of the user then pass it to a variable that'll be saved in a js onto the SDCard. That part is done.
But for the moment, i put the variable by hand. I'd like to insert the variables thanks to a spinner. And i don't know how i could do that. Shoud I make another layout and then go into the main webview layout ? Will the variable still pass between those two ?
I followed a tutorial but my app crashes when it starts.
I haven't got a freaking clue of how to make it. Thank you a lot !!!
Looking forward to receiving,
Raphaël MASRI

[Q] Debug/Disassemble Running Process

Hi All,
I have googled this issue and searched the forums, forgive me if I haven't followed the rules (which I have read).
I have a premium app (not mine, 3rd parties), i am not looking to hack it, I have bought it.
I am trying to work out how it does some background calculations with not much luck, it uses ( I am led to believe the NDK was used, so can't be decompiled in the usual way, it has a .so library and the decompiled java doesn't show much.).
So my thought have been turned to the asm of it, and I was wondering if there was a way to attach a debugged to a running android process and be able to disassemble that running process so I can "watch" the calculation happen.
I have a rooted android device, and like I say own the game.
I believe in the iOS world with xcode and a JB device you'd would need to attach a debugger to a running process, then put a hardware watchpoint on the offset you know is the value you need then you continue, do something in the game to trigger reading that value.
I just can't find anything similar for android.
Any help would be appreciated.
If this isnt the right place to ask a question like this can anyone point towards the right place?

[MOD][Xposed][4.4] Graffiti Height Fix

Update (Feb. 2016): ACCESS CO. released an official update for the Graffiti Pro app (v1.0.3) that addresses the height issue. So this module is no longer needed.
The classic handwriting recognition software from Palm, known as Graffiti™, is still available as a text input method for Android on the Play Store. Sadly, the publisher, Access Co., LTD., seems to have abandoned development and hasn't released any updates since 2011.
As a result, on modern Android devices with high resolution screens, the input area was too small to be useful... until now.
Graffiti Height Fix is an Xposed Framework module that makes the Graffiti™ input area taller on high resolution screens.
REQUIREMENTS
Rooted Android device
Xposed Framework
Graffiti™ 2.0.6 or Graffiti™ Pro 1.0.2 by ACCESS CO., LTD.
I am not affiliated with nor sponsored by ACCESS CO., LTD., I'm just a long time user of Graffiti since the old Palm days, who still finds it doing a much better job than any other text input method for handheld devices.
Source code on GitHub.
Also available on the Google Play Store.
Edit: if your device is really big and you don't want the text input area to be so large, see post #10 for half-height and two-thirds-height versions.
non root solution?
I am a long time graffitti user and unhappy that it doesn't work well on my LG G3. I'm excited by this solution, but concerned about rooting my phone. Will it mess up my Verizon service any? Is there another solution that doesn't require rooting?
The only ways I can think of to fix Graffiti without the need to root, are:
1) Official app updates from Access Co. (sadly unlikely at this point).
2) Modifying the app directly (something the Graffiti EULA explicitly forbids).
Just rooting won't cause any trouble with service. However, it might void the warranty or insurance, and you probably won't be able to install official Android OS updates from LG or Verizon while the device is rooted.
graffiti window height please...
I use graffiti since apple newton! This is the only keyboard which allows to enter text without paying attention to the screen. One request - with the fix ON the text field i too high now - can you please make it selectable height or simply half and/or 2/3 of the full size- I have got used to the already narrow strip of standard graffiti used at full HD resolution
Thank You for the idea!
I am not advanced enough to do it myself unfortunately even if the sources are available..
lukasz said:
I use graffiti since apple newton! This is the only keyboard which allows to enter text without paying attention to the screen. One request - with the fix ON the text field i too high now - can you please make it selectable height or simply half and/or 2/3 of the full size- I have got used to the already narrow strip of standard graffiti used at full HD resolution
Thank You for the idea!
I am not advanced enough to do it myself unfortunately even if the sources are available..
Click to expand...
Click to collapse
I can't build the module right now, but it should be enough to edit https://github.com/Nephiel/android-...hiel/graffitiheightfix/GraffitiHeightFix.java and change the lines
Code:
/*
* Consider a 480x800 px screen where Graffiti area is 232 px high,
* use the same aspect ratio for other resolutions.
*/
private static final double ASPECT_RATIO_PORTRAIT = 3.448; // (800/232) (approx.)
private static final double ASPECT_RATIO_LANDSCAPE = 2.069; // (480/232) (approx.)
to this for half-height
Code:
/*
* Consider a 480x800 px screen with a Graffiti area 116 px high,
* use the same aspect ratio for other resolutions.
*/
private static final double ASPECT_RATIO_PORTRAIT = 6.896; // (800/116) (approx.)
private static final double ASPECT_RATIO_LANDSCAPE = 4.137; // (480/116) (approx.)
or this for 2/3
Code:
/*
* Consider a 480x800 px screen with a Graffiti area 116 px high,
* use the same aspect ratio for other resolutions.
*/
private static final double ASPECT_RATIO_PORTRAIT = 5.161; // (800/155) (approx.)
private static final double ASPECT_RATIO_LANDSCAPE = 3.096; // (480/155) (approx.)
and recompile.
Adding a user-selectable setting would be a good solution, but that means adding a preference screen to the module - I don't know how to do that yet.
Hello! Thank You for the quick answer!
I will try to replace the text in the file, the only thing left is that I need to google "how to recompile"
little progress...
Hello,
I have modified GraffitiHeightFix.java for "half size"
installed JDK,
added "path" variable,
attempted to compile,
and ended with 14 errors:
Katalog: C:\temp3\src\net\nephiel\graffitiheightfix
2015-08-17 02:16 <DIR> .
2015-08-17 02:16 <DIR> ..
2015-08-17 01:30 2*962 GraffitiHeightFix.java
1 plik(ów) 2*962 bajtów
2 katalog(ów) 79*646*793*728 bajtów wolnych
C:\temp3\src\net\nephiel\graffitiheightfix>javac GraffitiHeightFix.java
GraffitiHeightFix.java:3: error: package de.robv.android.xposed does not exist
import static de.robv.android.xposed.XposedHelpers.findAndHookMethod;
^
GraffitiHeightFix.java:3: error: static import only from classes and interfaces
import static de.robv.android.xposed.XposedHelpers.findAndHookMethod;
^
GraffitiHeightFix.java:4: error: package android.content does not exist
import android.content.Context;
^
GraffitiHeightFix.java:5: error: package android.graphics does not exist
import android.graphics.Point;
^
GraffitiHeightFix.java:6: error: package android.view does not exist
import android.view.Display;
^
GraffitiHeightFix.java:7: error: package android.view does not exist
import android.view.View;
^
GraffitiHeightFix.java:8: error: package android.view does not exist
import android.view.WindowManager;
^
GraffitiHeightFix.java:9: error: package de.robv.android.xposed does not exist
import de.robv.android.xposed.IXposedHookLoadPackage;
^
GraffitiHeightFix.java:10: error: package de.robv.android.xposed does not exist
import de.robv.android.xposed.XC_MethodHook;
^
GraffitiHeightFix.java:11: error: package de.robv.android.xposed.callbacks.XC_Lo
adPackage does not exist
import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam;
^
GraffitiHeightFix.java:13: error: cannot find symbol
public class GraffitiHeightFix implements IXposedHookLoadPackage {
^
symbol: class IXposedHookLoadPackage
GraffitiHeightFix.java:26: error: cannot find symbol
public void handleLoadPackage(LoadPackageParam lpparam) throws Throwable
{
^
symbol: class LoadPackageParam
location: class GraffitiHeightFix
GraffitiHeightFix.java:33: error: cannot find symbol
XC_MethodHook setMeasuredDimensionHook = new XC_MethodHook() {
^
symbol: class XC_MethodHook
location: class GraffitiHeightFix
GraffitiHeightFix.java:33: error: cannot find symbol
XC_MethodHook setMeasuredDimensionHook = new XC_MethodHook() {
^
symbol: class XC_MethodHook
location: class GraffitiHeightFix
14 errors
C:\temp3\src\net\nephiel\graffitiheightfix>
Sounds like you are missing the Android SDK and the XposedBridge API. You could start here https://developer.android.com/sdk/installing/index.html
A good tutorial for creating Xposed modules is here https://github.com/rovo89/XposedBridge/wiki/Development-tutorial
Nephiel said:
Sounds like you are missing the Android SDK and the XposedBridge API. You could start here https://developer.android.com/sdk/installing/index.html
A good tutorial for creating Xposed modules is here https://github.com/rovo89/XposedBridge/wiki/Development-tutorial
Click to expand...
Click to collapse
I have installed android studio.... and went as far as opening modified copy of Your c:\temp3\src\net\nephiel\graffitiheightfix\GraffitiHeightFix.java
I have no experience with programming nor with compilation... I will read but this seems to be slightly complex to get it right.
No chances that You may have the chance to compile ? just in case - my email is: [email protected]
I have built two alternate versions of the module - one with a half-height text input area, and one with a 2/3rds height.
You can find them here:
Half-height version
2/3rds height version
Nothing else has changed other than the height difference and using an updated version of the Android SDK to build.
Please test and let me know if it doesn't work.
Thank You, It Works!
Nephiel said:
I have built two alternate versions of the module - one with a half-height text input area, and one with a 2/3rds height.
You can find them here:
Half-height version
2/3rds height version
Nothing else has changed other than the height difference and using an updated version of the Android SDK to build.
Please test and let me know if it doesn't work.
Click to expand...
Click to collapse
Thank You a lot for Your work! Fix works really well, for me 1/2 height is just perfect - slightly higher than the already reduced height Grafitti window on the Note 3. XDA developers allow great worldwide cooperation! Thank You for the clever concept and fixing one of the first text entry solutions for mobile devices!
Just a heads up: ACCESS CO. recently released an official update for the Graffiti Pro app that addresses the height issue. So this module is no longer needed. :victory:
Apparently the ad-supported free version is gone and the Pro version is now available for free.
Since the Palm days, through my HTC Wallaby and on to my current Note GT-N7000, I was just fine with Graffiti, later Graffiti Pro.
For the last several years I have been aware that a new update of Graffiti Pro would saddle my poor Note with a HUGE (shouting capitals intended) Graffiti input screen blocking out nearly half of my Note's viewable area. Diligently I avoided updating, but now Google has suddenly forced an unwanted update on me, in spite of my having selected No Automatic Updates. And so I now have an unwanted HUGE (shouting capitals intended) Graffiti input area.
Can anyone help me with:
1) an .apk for the older Graffiti Pro version with normally sized input area;
2) a way of completely blocking unwanted app updates from Google?
Yes I hear all the approval of the new size from all the up-to-date owners of "huge" new 'phones - Note 9 and suchlike - but it is not fair to the likes of me who were just fine with their original Galaxy Notes, that we can't readjust our Graffiti back to what it was. Of course it (including Google forced update policy) is all intended to force us to buy ever bigger, faster and more expensive devices. I realise that.
And now that there is a wonderful new HUGE (shouting capitals intended) version from Access Co. on Google, your "Graffiti Height Fix" doesn't work any more.
Perhaps you could develop a fix for this?
Ironic footnote: one AdamOutler once flamed me in these very fora for advocating such a "large" phone as the GT-N7000! Wonder what he thinks of the Note 9!
Update: Praise be for Titanium Backup! I was able to restore my old version of Graffiti Pro from an earlier backup after deleting the unwanted update.
I also discovered that with a recent pretty turbulent and large (42 MB) update to Open Street Maps from Google Play, said software site had taken it upon itself to update all my settings to "Automatic Update". I have now switched off every option which includes the word "automatic", so we'll see how that goes.
I would still be interested to hear from any developer with ways to restrain Google's unbridled lust for making us automatically lay all we have bare to their thirst for control of and data from our systems, such as forced updates.
As for Graffiti Height Control, I would describe it as useless, and I defend that. I do not use the term in today's lazy postmillennial sense as a catch-all for "bad", but simply because GHC does not function in any way. After installation it does not show as an app. It offers no modification whatever to Graffiti Pro 1.0.5's settings, which are obsessed with all things Japanese but little else. I really don't need a Japanese dictionary; this is not a language I ever intend to use, certainly not with Graffiti.
"Graffiti Height Control" does nothing, it has no use, i.e. it is useless.
By way of historical info, back in the days of The O2 XDA (or HTC Wallaby), which is how this whole forum started, Graffiti was part of the accompanying Windows OS. In a comfortably proportionate size. The Wallaby included a pen built into the aerial.
syncopath said:
"Graffiti Height Control" does nothing, it has no use, i.e. it is useless.
Click to expand...
Click to collapse
Graffiti Height Fix is a Xposed module that required Xposed to function, as it was clearly stated in this thread, in the Play Store app description, and in Xposed Repository.
But that is moot, since Access Co. updated Graffiti to address the height issue long ago, rendering this module unnecessary.
syncopath said:
By way of historical info, back in the days of The O2 XDA (or HTC Wallaby), which is how this whole forum started, Graffiti was part of the accompanying Windows OS. In a comfortably proportionate size. The Wallaby included a pen built into the aerial.
Click to expand...
Click to collapse
Windows never had Graffiti. It may have had a similar input method, but not the same. Graffiti was Palm OS only, Xerox patent shenanigans ensued, and finally Access Co. ended up with the rights.
syncopath said:
Update: Praise be for Titanium Backup! I was able to restore my old version of Graffiti Pro from an earlier backup after deleting the unwanted update.
Click to expand...
Click to collapse
I'm glad you found a solution that worked for you. Titanium Backup is a really useful tool indeed.
1. I have Xposed (for XPrivacy) but was still unable to do anything in the awful new version of Graffiti Pro about the excessive height.
2. Oh yes it did! If I could get it to start, I could show you my XDA from O2, running Windows Mobile, using Graffiti!
3. Titanium Backup is useful, but I am still scared that somehow I will lose my precious older version of Graffiti, which looks just as it did on Windows Mobile in 2002.
---------- Post added at 03:52 PM ---------- Previous post was at 03:50 PM ----------
Re: Windows Mobile, when I get home in June 2019 I will try to reanimate my HTC Wallaby and send you a screenshot.
---------- Post added at 04:44 PM ---------- Previous post was at 03:52 PM ----------
You may care to peruse the Wikipedia entry for Graffiti at https://en.wikipedia.org/wiki/Graffiti_(Palm_OS), where you will find the link you need on the words "Windows Mobile".
In the end I reinstalled the previous version of Graffiti Pro from the .apk and then deleted Google and Google services from my device. This stopped automatic update of Graffiti to the unwanted new version, freed up a whole lot of space, but also sadly cut me off from ever acquiring any more software from Google Play or whatever it is called nowadays on that GT-N7000 device. So be it then.
My one GT-N7000 is now suffering from recharging socket problems and is almost 10 years old, at which point I have promised myself a new 'phone as 10 years is the lifetime I consider I have a right to expect from a device so expensive and complicated as these.
So now I have purchased a second-hand Note 8 and am interested to see what I can do with it to extend my XDA experience. I sincerely hope "Knox Bit" will not destroy everything. Root privileges are essential to 50% of my programmes (sorry "apps").
@Nephiel, did you ever find the Windows Mobile OS I referred you to? You will see that Graffiti is much older than you may have realised.
syncopath said:
did you ever find the Windows Mobile OS I referred you to? You will see that Graffiti is much older than you may have realised.
Click to expand...
Click to collapse
I did find it. It dates back to '94. Windows Mobile was called CE then. It may have had Block Recognizer, but not Graffiti, even if only in name.
Funny thing is, I got an iPaq Pocket PC myself (got it for free as a hand-me down) back then, and now that I think about it, it had a similar input method, but it wasn't enabled by default. I don't even remember actually using it.

CameraX and Camera2Config Extender, Camera2Interop... stuck there, help needed :)

Hi all,
I1m developing a camera-using application in Java, and stuck at a point where i need to control the camera settings. Any help will be appreciated...
The main problem is that i need to lock white balance (or turn it on a fix state, as daylight, etc.). I found that there are 2 methods : Camere2Config Extender and Camera2Interop. The app needs to display a preview, and do some image analysis, which is already working. The WB control is enough to apply to the analysis, but as i understand, if i apply to the preview/config the camera, it will also affect the analyzer, as it gets the same frames.
Camera2Interop seems to be easier, but i cannot import (in Android Studio). Simply does not understand the "interop" in
Code:
import androidx.camera.camera2.interop.Camera2Interop;
import androidx.camera.camera2.interop.ExperimentalCamera2Interop;
What can i do to let the Studio import these?
Second, i tried Camera2Config.Extender. But cannot figure out how to extend the configuration, and which? The preview config seems to be the good choice.
But when i try :
Code:
PreviewConfig pConfig = new PreviewConfig.Builder().setTargetAspectRatio(aspectRatio).setTargetRotation(0).build();
Camera2Config.Extender camera2Extender = new Camera2Config.Extender(pConfig);
Preview preview = new Preview(pConfig);
I get a "error: incompatible types: PreviewConfig cannot be converted to ExtendableBuilder Camera2Config.Extender camera2Extender = new Camera2Config.Extender(pConfig);" message. It builds when i remove the Extender.
If anybody knows how to get rid of these, i'll be thankful

Categories

Resources