Comments (19)
Hi @IvoPereira
Are you using Titanium 4.0.X ?
Maybe it's a bug. Your code looks good. I wonder if providing a density-independent image resource would solve this because the same thing is working in the example. I'd need to change how to resolve the image then. Could be worth a try.
from actionbarextras.
Hello @manumaticx,
I'm using Titanium Studio v. 3.4.1.201410281727 and Titanium SDK 3.5.1.GA.
I'm testing on a 4.2.2 device.
That snippet is working in the example, however the example does not use MVC and its folder structure (controllers, models, views), and is only based in an app.js file at root. Possibly may be that related to the problem locating the files?
As soon as I get office I will try with some density-independent image resources, and I'll let you know the result.
Thanks.
from actionbarextras.
There shouldn't be a difference when using Alloy because Alloy creates a classic project with the same folder structure.
I've just tested an fixed-density image and I do get the same error:
ActionbarextrasModule: (main) [2,3204] Couldn't resolve /images/icon_menu.png
I recommend you using res-mdpi
, res-hdpi
, res-xhdpi
, res-xxhdpi
resources for icons. This will solve your issue.
But I also will try to resolve resources within the /images/
directory.
from actionbarextras.
Hey @manumaticx,
Thanks for the feedback. I was trying to follow your suggestion, so I've put the image inside all of the folders you mentioned, using the path:
/PROJECT_NAME/app/assets/images/res-hdpi
/PROJECT_NAME/app/assets/images/res-mdpi
/PROJECT_NAME/app/assets/images/res-xhdpi
/PROJECT_NAME/app/assets/images/res-xxhdpi
However, it seemed to change something in the location where it was looking for the file, but it was still not able to find it (and the files were moved to Resources folder as expected).
from actionbarextras.
Hm, I'm not sure what's going on here!
I've just created a fresh new Alloy app with Titanium 3.5.1.GA and ABX 1.6.3 to test this. But I am not able to reproduce this error.
The resource path in your log is also very strange. It should actually log the path that was passed to setHomeAsUpIcon
, not the resolved path. I will have to do some more testing in order to fix this. Hopefully I can come up with a solution here.
If you find anything that could help me to find the reason for this, please let me know.
from actionbarextras.
I'll be happy to assist you debugging the problem @manumaticx.
I've tried with a live device LG-G2 using Ti-Shadow (and without it - through TitaniumStudio directly).
The image I'm using is this one: http://i.imgur.com/AR7zIc8.png
Let me know if you need anything else.
from actionbarextras.
@manumaticx strange but I get a similar error
[ERROR] ActionbarextrasModule: (main) [1441,2453] Couldn't resolve ic_menu_black_24dp.png
and the ic_menu_black_24dp.png is in app/assets/android. Also tried with a / prefix and still not found
from actionbarextras.
@ndastur as stated in the above comment I'd recommend using res-mdpi
, res-hdpi
, res-xhdpi
, res-xxhdpi
- this probably solves the error
from actionbarextras.
@manumaticx thanks. I have been looking into the code and I think it is because you are using the getResourceId helper function. Looking deeper into the Appc source this seems to be a deeper level function.
Looking at how Appc resolve the setIcon in their actionbar implementation
https://github.com/appcelerator/titanium_mobile/blob/master/android/titanium/src/java/org/appcelerator/titanium/proxy/ActionBarProxy.java
I think some higher level SDK helper function is required.
from actionbarextras.
Specific bit of code that might help is
private Drawable getDrawableFromUrl(String url)
{
TiUrl imageUrl = new TiUrl((String) url);
TiFileHelper tfh = new TiFileHelper(TiApplication.getInstance());
return tfh.loadDrawable(imageUrl.resolve(), false);
}
from actionbarextras.
@ndastur Thank you for this. Do you think there is a chance that you could build the module and test this?
from actionbarextras.
Unable to setHomeAsUpIcon with titanium 4.0.X
Can any one help me out.
from actionbarextras.
@ChanakyaSrinivas Hi there, I need some more info! This is not considered as a bug until you instruct me how to reproduce the issue.
from actionbarextras.
Environments:
Tiatanium sdk 4.1.0
MVC Alloy 1.6.2
output:
Not getting any error related to setHomeAsUpIcon.
But Icon is not visible left side corner.
from actionbarextras.
@ChanakyaSrinivas try adding actionBar.displayHomeAsUp = true;
before the line where you set the icon
if (actionBar){
actionBar.displayHomeAsUp = true;
abx.setTitle("Example");
abx.setHomeAsUpIcon("/images/drawericon.png");
}
from actionbarextras.
As per your suggestion changed my code.
It's working fine.
from actionbarextras.
Great. Nice to hear.
So I think I can close this issue here since setHomeAsUpIcon
works as expected and the behavior described in the original question is not reproducible.
Please feel free to reopen if you can provide test code to reproduce this issue.
from actionbarextras.
Hi All,
Module is not working for Titanium SDK 5.3.1GA and Alloy 1.8.7
Environments:
Npm Version = 2.11.3
Titanium CLI Version = 5.0.8
Titanium SDK Version = 5.3.1.GA
Alloy Version = 1.8.7
Error:
[ERROR] : TiApplication: java.lang.ClassCastException: org.appcelerator.titanium.TiActivity cannot be cast to android.support.v7.app.ActionBarActivity [ERROR] : TiApplication: at com.alcoapps.actionbarextras.ActionbarextrasModule.getActionBar(ActionbarextrasModule.java:117) [ERROR] : TiApplication: at com.alcoapps.actionbarextras.ActionbarextrasModule.handleSetHomeAsUpIcon(ActionbarextrasModule.java:523) [ERROR] : TiApplication: at com.alcoapps.actionbarextras.ActionbarextrasModule.handleMessage(ActionbarextrasModule.java:175) [ERROR] : TiApplication: at android.os.Handler.dispatchMessage(Handler.java:98) [ERROR] : TiApplication: at android.os.Looper.loop(Looper.java:148) [ERROR] : TiApplication: at android.app.ActivityThread.main(ActivityThread.java:5417) [ERROR] : TiApplication: at java.lang.reflect.Method.invoke(Native Method) [ERROR] : TiApplication: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) [ERROR] : TiApplication: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
from actionbarextras.
@ChanakyaSrinivas Try updating the Module
from actionbarextras.
Related Issues (20)
- Can you please updated for Ti. SDK 5.2.0GA+ HOT 5
- Support for different layouts HOT 5
- Title center, left-side button and shadow HOT 11
- Render simple HTML in title and subtitle HOT 2
- setActionbarImage makes the app close HOT 5
- menuhandling crashes app HOT 1
- Module is incompatible with Titanium SDK 6.0.0 HOT 1
- Icons do not appear HOT 3
- Not supported by Titanium 5.5.1 HOT 2
- Actionbarextras menuItem visible/not visible.
- Get HomeAsUpIcon click HOT 2
- Integrate this module into Titanium HOT 5
- SetUpColor always set an "back arrow" icon HOT 2
- Error on onHomeIconItemSelected
- setMenuItemIcon not working with TabGroup
- New build 2.0.1? HOT 9
- setNavigationbarColor doesn't work HOT 1
- which Ti SDK Version is needed? HOT 1
- cannot change the title when back from another window
- Menu Icon on Android 9 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from actionbarextras.