Hey guys!
I wanted to add a new imagebutton to the stock app's layout, so I modified it adding the said imageb. . Now I want to access it to add an onClickListener to it, but whenever I try to access it I get a Null Pointer Exception. (Accessing with
layoutInflatedParam.view.findViewById( layoutInflatedParam.res.getIdentifier(*name of the new imageb.*, "id", *packagename of the app*)); )
My question is that what is the correct way accessing the newly added ImageButton?
Thanks for reading thru!
Sent from my GT-I9305 using XDA Free mobile app
You should provide more info on how you added that button to the layout.
If you created an instance of button dynamically in inflate layout hook, and added it using addView to the layout, one of the possibility
is to set some tag of that button instance (setTag method). You can later find it using findViewWithTag instead of findViewById.
C3C076 said:
You should provide more info on how you added that button to the layout.
If you created an instance of button dynamically in inflate layout hook, and added it using addView to the layout, one of the possibility
is to set some tag of that button instance (setTag method). You can later find it using findViewWithTag instead of findViewById.
Click to expand...
Click to collapse
Simply grabbed the layout from the original apk and added the imageview to it, then I forward the original one to my midified one with initPackageResourcesParam.res.setReplacement.
Sent from my GT-I9305 using XDA Free mobile app
I don't have experience with replacing whole layouts but have you tried:
layoutInflatedParam.view.findViewById(R.id.idOfMyButton) ?
C3C076 said:
I don't have experience with replacing whole layouts but have you tried:
layoutInflatedParam.view.findViewById(R.id.idOfMyButton) ?
Click to expand...
Click to collapse
Thanks, it worked!
Sent from my GT-I9305 using XDA Free mobile app
Related
Just found out can remap n-button by changing "HOME" on the line:
Code:
key 102 HOME WAKE_DROPPED
in /system/usr/keylayout/gpio-keys.kl
Tested can pull out menu by replacing "HOME" with "MENU".
Does anyone know how (if possible) to map to my launcher? Thanks in advance.
Follow-up:
1. It is quite obvious that the power button can also be remapped by changing the line:
Code:
key 116 POWER WAKE
Just tested that and it worked.
2. I use Home Switcher to set the default Home app to my launcher (Zeam). Button Savoir's home button can get me back to Zeam, but the n-button cannot. I've also tried Softkeys, but with no luck. So it appears that the HOME key handler is hard-coded into the kernel (google search seems to say that is an android quirk). A possible hack is to map the n-button to some unused key and then write an app running on the background to handle that key event (or modify /system/app/Home.apk to pass the control to say Zeam if one has the source codes). My android coding is not good enough to do either. Is there any simpler hack? Can we simply change the path of com.bn.nook.home from /system/app/Home.apk to Zeam in /data/system/packages.xml? I ain't brave enough to try that before backing up my current ROM. Also it seems that /data/system/packages.xml gets rewritten from time to time. Any suggestion will be appreciated.
take a look at the source, maybe that can reveal whether its hardcoded or posible with a simple edit.
Progress?
Any progress with n-button remapping to make it act like usual HOME-button?
I don't know how to "Say Thank You" properly, but thank you, nooktouch.
...edit: so, you have to post something before you can thank someone?
Grave digger
Searching old threads... has anyone ever managed to remap the n key?
I'd actually like to use it inside an app (although remapping it in general would be handy too).
Anders
Ummm. This is the nook color forum. Not the nook touch forum.
Sent from my NookColor using xda app-developers app
---------- Post added at 06:26 PM ---------- Previous post was at 06:25 PM ----------
Oh, this is a REALLY old post. Nvm.
Sent from my NookColor using xda app-developers app
I want to launch recent apps when the physical home key is pressed. Any ideas?
Sent from my GT-N7000 using xda premium
rlaw said:
I want to launch recent apps when the physical home key is pressed. Any ideas?
Sent from my GT-N7000 using xda premium
Click to expand...
Click to collapse
I can launch it when hone key is pressed and I'm on PA v0.3 with navigation bar on....you should really be searching PA thread if you're having trouble..
Sent From My Paranoid Note Baby!!
Yeah, I can change a key press of it to launch recents instead of going to home but that isn't what I'm looking for.
I want to remap long press functionality which is a more involved process.
Thank you.
Sent from my GT-N7000 using xda premium
rlaw said:
Yeah, I can change a key press of it to launch recents instead of going to home but that isn't what I'm looking for.
I want to remap long press functionality which is a more involved process.
Thank you.
Sent from my GT-N7000 using xda premium
Click to expand...
Click to collapse
I'm trying to get this to work as well. I'm trying to map it to the menu button. All threads I can find, tutorials included, are remapping to single press too. I've been checking out the key layouts folder in system/usr but I can't find anything referring to long presses. Have you made any progress?
If I remember correctly for the HW long press the DPI of the handset needs to be set to 'Phone' rather then 'Tablet' if you are using the latest version of PA.
StalkS
Can anyone skillful add the 3-dot menu button as a fourth button ? :victory:
Hmm. I had a quick go at this by changing the visibility in the xml but it's still not there until it's needed. This may need a smali edit.
Sent Using XDA Premium..
Have you Tickled Your Android lately?
(tinyurl.com/ticklemyandroid)
It ought be a setting in the rom to always display it or only if it's needed....
I need it to stay in the button bar permanently as it sometimes appears at the top and this is a huge screen to overcome in order to reach it.
Ticklefish said:
Hmm. I had a quick go at this by changing the visibility in the xml but it's still not there until it's needed. This may need a smali edit.
Sent Using XDA Premium..
Have you Tickled Your Android lately?
(tinyurl.com/ticklemyandroid)
Click to expand...
Click to collapse
any news ? :fingers-crossed: i think this button would start Thanks button press mania :laugh::silly:
redThd said:
It ought be a setting in the rom to always display it or only if it's needed....
I need it to stay in the button bar permanently as it sometimes appears at the top and this is a huge screen to overcome in order to reach it.
Click to expand...
Click to collapse
I totally agree ! Would be a great/usefull option.
I've tried getting the menu button to stay in the nav bar but it seems to.be beyond my skill. It looks like this isn't an xml edit but a smali one.
And I'm no good with smali yet.
However..would it help if it could be in the statusbar as well as the nav bar? That's very possible..
Sent from my Xperia Z using XDA Premium
..Have you tried Tickle My Android yet?
Ticklefish said:
I've tried getting the menu button to stay in the nav bar but it seems to.be beyond my skill. It looks like this isn't an xml edit but a smali one.
And I'm no good with smali yet.
However..would it help if it could be in the statusbar as well as the nav bar? That's very possible..
Sent from my Xperia Z using XDA Premium
..Have you tried Tickle My Android yet?
Click to expand...
Click to collapse
well using lmt 1.91 with single button > menu button is easier for you and for my use so maybe someone with smali skills could do it later
PS: menu button in statusbar is not much comfortable to use
would love this. any news?
Hi all,
Ever since I have a GSA I have been searching for an option to change what happens when i press the menu button. Before i had a HTC One S and i really loved its application switcher. I was wondering if there is any way to get the application switcher open on pressing the menu button, and then show the menu on longpressing. I know that the CM10 diego is working on supports it but it is still in ALPHA so i do not want to install it for daily use. Anybody any idea how I would achieve this on any other ROM?
Thanks
System/usr.
Find keylayout file and edit it.
I do not respond to tech support via PM
Sorry, should have mentioned. I already tried to do it through that file, but first of all. I couldn't find the key mapping that corresponds to our hardware key, and second, that leaves me without any functionality to get the options menu to appear since longpress is not handled in that file
Sent from my GT-I9070 using xda app-developers app
Now that there is a pretty good cm10 build this issue has been solved for me
Sent from my GT-I9070 using xda app-developers app
Hi,
Anyone able to remove the camera shortcut from the bottom? That is the least function I even use on my "Phone"!
I can move it between the four position, I can put it in a folder but I can't remove it. I would love to put my gmail there instead (along with phone, message and browser), I use gmail 1000 times more then the camera
This is the one bit about the one I don't like. The app draw is confusing. You have to go into the app draw. Long press on the app you want in the draw and drag it to the bottom.
Sent from my Nexus 4 using xda app-developers app
I now find that it makes sense to organize the bottom shortcuts in the app drawer.. it's just a new feature for old souls to get used to, but I like it now.
Sent from my HTC One using xda premium
It does take a couple of goes to get used to but I like the way htc have done it, it's good to be different.
Sent from my HTC One using xda app-developers app
ste1164 said:
This is the one bit about the one I don't like. The app draw is confusing. You have to go into the app draw. Long press on the app you want in the draw and drag it to the bottom.
Sent from my Nexus 4 using xda app-developers app
Click to expand...
Click to collapse
Got it now. Thanks
I don't really like the new sense, sense 4.5 are much better...
Sent from my HTC One using xda app-developers app
I like how they implement it. Making it only removeable on the app drawer makes it more secure to accidental touches. I usually hold my phone when screen is on and there are times I get my homescreen messed up due to these long presses that moves it accidentally.
Custome shortcuts can't be added
Riyal said:
I like how they implement it. Making it only removeable on the app drawer makes it more secure to accidental touches. I usually hold my phone when screen is on and there are times I get my homescreen messed up due to these long presses that moves it accidentally.
Click to expand...
Click to collapse
The issue I've found with this, is that I can no longer add a custom shortcut that I've created from apps like Quickshortcutmaker. After creating a unique shortcut, it adds the shortcut to my home screen. From that point on, I cannot add it as a lockscreen shortcut, as that requires that I open up the app drawer (which does not show my custom shortcut).
I've been scrambling around to figure out how to add a custom shortcut. I don't think it's possible without rooting. On the HTC Evo LTE, etc.. I used to have a custom shortcut to the Voice Search feature to go directly there without having to click more than once.