[TOOL] android style optimizer - Android Software Development

Hi,
if you usually create your layout styles in styles files in various resource groups (hdpi, ldpi, ...), and end up having the same style declaration in various files with just slightly different values, you might find the little tool of mine handy.
It's really just a small open source python script that combines style declarations and extracts different values (eg. different layout withds in dp) into variables that are kept in the original xml files.
example:
let's say you have the following sample_style defined in values-xlarge and values-xhadpi.
in values-xlarge/styles.xml:
<style name="sample_style">
<item name="android:layout_width">100dp</item>
<item name="android:layout_height">100dp</item>
<style>
in values-xhadpi/styles.xml
<style name="sample_style">
<item name="android:layout_width">200dp</item>
<item name="android:layout_height">100dp</item>
<style>
the optimize process would create a styles.xml file in values containing:
<style name="sample_style">
<item name="android:layout_width">@dimen/SampleStyle_layoutWidth</item>
<item name="android:layout_height">100dp</item>
<style>
and two styles.xml file in values-xlarge and values-xhdpi, resp.
values-xlarge/styles.xml:
<dimen name="SampleStyle_layoutWidth">100dp</dimen>
values-xhdpi/styles.xml:
<dimen name="SampleStyle_layoutWidth">200dp</dimen>
give it a try:
https://github.com/PMelch/Android-Style-Optimizer
feedback is welcome.
Cheers

No tool, no link. Is this simply an edit or an actual tool that people can download from somewhere?

spc_hicks09 said:
No tool, no link. Is this simply an edit or an actual tool that people can download from somewhere?
Click to expand...
Click to collapse
Dude ,its an XML value you use in an XML file,open source python script.

It's a Python script downloadable from the mentioned github page.
Sent from my GT-I9100 using xda app-developers app

Related

Reg tweak making BuildOS report error..

Hey there
First of all iam not sure if this is the correct section ! Iam very sorry if its not! Maybe a section just for cooking questions would be good ?
Well.. Heres my question ..
Iam cooking a rom for HD, and i would like to add some reg tweaks.. So i have added a bunch but one of my tweaks makes BuildOS come with an error stating that it couldn't build the registry..
I have made a OEM package containing the following reg key..
Code:
REGEDIT4
[HKEY_CURRENT_USER\Software\HTC\Manila]
"CachedBackgroundPath"=""
"HomeBackgroundPath"="\Windows\Wall.jpg"
The file is named : "1a073e70-e2a0-11dd-ad8b-0800200c9a66.rgu", saved as "Unicode" and with an empty line at the bottom.. And the folder is also containing a file with the same name as above, just with ".dsm" as file extension. This file is empty
I have also added a "option.xml" file with the following inside it:
Code:
<?xml version="1.0" encoding="UTF-16" standalone="yes"?>
<Items>
<Item name="Personal Reg tweaks" group="Programs" checked="true">
<Tip></Tip>
<Guid type="p">1a073e70-e2a0-11dd-ad8b-0800200c9a66</Guid>
</Item>
</Items>
and an empty initflashfiles.txt file..
But as soon as i include this package in BuildOS i get the error that it couldn't create the registry ..
What have i done wrong? The package is in the OEM folder..
~D
[HKEY_CURRENT_USER\Software\HTC\Manila]
"CachedBackgroundPath"=""
"HomeBackgroundPath"="\\Windows\\Wall.jpg"
use double \\ in paths
dan-htc-touch said:
[HKEY_CURRENT_USER\Software\HTC\Manila]
"CachedBackgroundPath"=""
"HomeBackgroundPath"="\\Windows\\Wall.jpg"
use double \\ in paths
Click to expand...
Click to collapse
Thanks ! That worked..
I have another question.. If i want to replace the defualt netframework in my rom with the newest 3.5 what do i have to do ?
I have deleted the original NETCF folder in SYS and replaced with one from a cab that i've converted to a OEM using Package Tools 2.7.. But it dosn't work! When i try to start some software that uses netcf 3.5 it comes up with an error..

[DEV][TOOL][PROJECT] Android APK Translation [CMD + GUI]

Android APK Translation - CMD Line Tool
CMD Line - The Idea
Files involved: "strings.xml", "arrays.xml", "plurals.xml"
translated files:
strings.xml - http://pastebin.com/embed_iframe.php?i=5u40nHZP
arrays.xml - http://pastebin.com/embed_iframe.php?i=93v9vZUk
plurals.xml - http://pastebin.com/embed_iframe.php?i=GwBuFdmW
original files:
strings.xml - http://pastebin.com/embed_iframe.php?i=r2W4yYvh
arrays.xml - http://pastebin.com/embed_iframe.php?i=Lfff9Pur
plurals.xml - http://pastebin.com/embed_iframe.php?i=eSe8yf4S
1) Get translated files from a translator.
2) Sort & delete tags/nodes with duplicate attributes from the translated files.
3) Get original files from the ROM.
4) Sort & delete tags/nodes with duplicate attributes from the original files.
5) Merge translated files with original files
(Optional) Discard all XML tags/nodes with attributes that doesn't exist in the original XML
Suggested Tool Syntax
Code:
apktrans [OPTS] --i rom/strings.xml --t translated/strings.xml --o merged/strings.xml
OPTS:
-s - sort xml nodes
-d - delete duplicate xml nodes
-m - discard xml nodes not present in the source xml
Notes
The node is considered a duplicate if there is another node with the same attributes, no matter how many children it have inside of it.
The node with more children overwrites the node with less.
Needed Tool Features
sort xml tags by attribute name
delete duplicate xml tags by attribute name
preserve node properties - ability to work on any kind of tags (string & arrays - children) - see example
should work with UTF-8
Android APK Translation - GUI Tool
GUI - The Idea
Original idea and source code: APK Translation Wizard
For the purpose of explanation, its assumed we want to translate from English source files to Vietnamese without a region code
File Structure
Code:
/
/apks-compiled - holds the apk files after encoding
/apks-frameworks - holds the framework files
/apks-source - holds the apk files for decoding/translation
/apks-translation - holds the apk files after encoding (with the translated files)
/core - holds the application files (binaries, scripts, etc...)
/i18n-crowdin - holds the translation files from the [URL="http://crowdin.net/project/miui-rom-translation"]MIUI translation project[/URL]
/i18n-other - holds the other translation files (drawable, raw, xml, etc...)
Decode Window - APK Decoding
Selectbox: Select which APK files you want to decode - apk files should be present inside the "/apks-source" directory
Selectbox: Select which framework file to use for APK decoding - framework file should be present inside "/apks-frameworks" directory
Button: Decode APK files - using APKTool​
Config Window - Tool Configuration
Button: Load original files - /res/values/strings.xml, /res/values/arrays.xml, /res/values/plurals.xml
Seletbox: Select destination locale - required - vi
Selectbox: Select destination region - optional - rVI
Button: Start Translation Process - set up /res/values-vi (and /res/values-vi-rVI if selected)​
Translation - strings.xml
View: APK_NAME | ATTRIBUTE_NAME | ORIGINAL STRING | TRANSLATED STRING
APK_NAME - name of the decoded apk
ATTRIBUTE_NAME - name of the tag's attribute we are translating
ORIGINAL STRING - the original string for translation
TRANSLATED STRING - the translated string*
*as appears in the /res/values-vi/strings.xml file OR /res/values-vi-rVI/strings.xml file OR empty if none
Button: Sort all tags - sorts all tags by attribute name
Button: Delete duplicate tags - delete tags with duplicate attribute name
Button: Import an XML patch - imports an XML file and merges the tags that have the same attributes
Button: Commit Translation - writes the translated xml file - /res/values-vi(-rVI)/strings.xml
Description
The user will be able to edit the TRANSLATED STRING column only.
The use will be able to edit tags which present only inside the source xml file (the decoded file) so to avoid adding tags which doesn't exist in the application we are translating.
If a tag is present in the XML patch but is missing in the source file; it will be discarded.
Translation - arrays.xml
View: APK_NAME | ATTRIBUTE_NODE_NAME | ORIGINAL STRINGS LIST | TRANSLATED STRINGS LIST
APK_NAME - name of the decoded apk
ATTRIBUTE_NODE_NAME - name of the tag/node's attribute we are translating
ORIGINAL STRINGS LIST - a list of the node's children which includes the original strings for translation
TRANSLATED STRINGS LIST - a list of the node's children which includes the translated strings*
*as appears in the /res/values-vi/arrays.xml file OR /res/values-vi-rVI/arrays.xml file OR empty if none
Button: Sort all nodes - sorts all nodes by attribute name - should NOT sort the children b/c their order is important!
Button: Delete duplicate nodes - delete nodes with duplicate attribute names
Button: Import an XML patch - imports an XML file and merges the nodes that have the same attributes
Button: Commit Translation - writes the translated xml file - /res/values-vi(-rVI)/arrays.xml
Description
ORIGINAL STRINGS LIST & TRANSLATED STRINGS LIST column will have a list of all properties (children) which belong to a specific ATTRIBUTE_NODE_NAME.
The user will be able to edit the TRANSLATED STRINGS LIST column only.
The user will be able to edit nodes which present only inside the source xml file (the decoded file) so to avoid adding nodes which doesn't exist in the application we are translating.
If a node is present in the XML patch but is missing in the source file; it will be discarded.
If a node in the XML patch includes more children then a node in the source file; All additional children will be discarded.
Translation - plurals.xml
View: APK_NAME | PLURAL_ATTRIBUTE_NODE_NAME | ATTRIBUTE_NAME | ORIGINAL STRING | TRANSLATED STRING
APK_NAME - name of the decoded apk
PLURAL_ATTRIBUTE_NODE_NAME - name of the plural's node attribute we are translating
ATTRIBUTE_NAME - name of the plural's node tag attribute we are translating
ORIGINAL STRING - original string for translation
TRANSLATED STRING - translated string*
*as appears in the /res/values-vi/plurals.xml file OR /res/values-vi-rVI/plurals.xml file OR empty if none
Button: Sort all plural nodes - sorts all nodes by attribute name - should NOT sort the children b/c their order is important!
Button: Delete duplicate plural nodes - delete nodes with duplicate attribute names
Button: Import an XML patch - imports an XML file and merges the nodes that have the same attributes
Button: Commit Translation - writes the translated xml file - /res/values-vi(-rVI)/plurals.xml
Description
The user will be able to edit the TRANSLATED STRING column only.
The user will be able to edit nodes which present only inside the source xml file (the decoded file) so to avoid adding nodes which doesn't exist in the application we are translating.
If a node is present in the XML patch but is missing in the source file; it will be discarded.
If a node in the XML patch includes more children then a node in the source file; All additional children will be discarded.
Encode Window - APK Encoding
Selectbox: Select which APK files you want to encode - will be taken from the "/projects" directory
Selectbox: Select which framework file to use for APK encoding - framework file should be present inside "/apks-frameworks" directory
Checkbox: Replace "Resources.arsc" - after compilation, the compiled APK will be unzipped, the Resources.arsc file will be taken out and put inside the original APK*.
Button: Encode APK files - using APKTool
*this is to avoid signature issues within the APK files.​
Android Localization - Useful Resources
Android SDK Guide on Localization
http://developer.android.com/guide/topics/resources/localization.html
http://developer.android.com/guide/topics/resources/providing-resources.html#BestMatch
http://developer.android.com/guide/topics/resources/providing-resources.html#table2
Mobile Country Codes (MMC)
http://en.wikipedia.org/wiki/List_of_mobile_country_codes
List of ISO-639-1 Codes (Country Codes)
http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
List of ISO-3166-1-alpha-2 Codes (Region Codes)
http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2​
Examples of Usage
Note: trimmed due to forum length limits, notice that the xml tags are not sorted.
translated strings.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="common_minutes_ago">%s minutter siden</string>
<string name="common_hours_ago">%s timer siden</string>
<string name="common_days_ago">%s dage siden</string>
<string name="app_name">Browser</string>
</resources>
original strings.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="common_minutes_ago">%s minutes ago</string>
<string name="common_hours_ago">%s hours ago</string>
<string name="common_days_ago">%s days ago</string>
<string name="app_name">Browser</string>
<string name="app_settings">Settings</string>
<string name="urltitlebar_gotourl">GO</string>
<string name="urltitlebar_hint">Search or type in a URL</string>
<string name="search_description">Bookmarks, History, Google suggestions</string>
</resources>
final strings.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="common_minutes_ago">%s minutter siden</string>
<string name="common_hours_ago">%s timer siden</string>
<string name="common_days_ago">%s dage siden</string>
<string name="app_name">Browser</string>
<string name="app_settings">Settings</string>
<string name="urltitlebar_gotourl">GO</string>
<string name="urltitlebar_hint">Search or type in a URL</string>
<string name="search_description">Bookmarks, History, Google suggestions</string>
</resources>
Duplicate lines are always right after each other, right? I could throw together a script to delete the second line I think. I don't have time right now, but if no one has posted anything by this afternoon, I'll give it a shot for you.
SifJar said:
Duplicate lines are always right after each other, right? I could throw together a script to delete the second line I think. I don't have time right now, but if no one has posted anything by this afternoon, I'll give it a shot for you.
Click to expand...
Click to collapse
there is no need to create a script.
There are many text editors that can do that.
e.g. Notepad++
line 64-65
Code:
<string name="car_mode_disable_notification_message">برای خروج از حالت خودرو انتخاب کنید.</string>
<string name="car_mode_disable_notification_message">برای خروج از حالت خودرو انتخاب کنید</string>
in the above example there is a dot (.) more in 1st line, and for that reason a program will not recognise it as duplicate.
In notepad++ you can check for specific content, mark the duplicated and then delete the marked lines.
We need to delete a duplicate line of "<string name="car_mode_disable_notification_message">" so we make it in notepad++ to search for duplicates that have this pattern
Code:
<string name=" ">
and delete duplicate lines.
I am sure that this can be done because i have used it in the past (long ago).
I'll search some more to remember and post the way to do it.
Merged with Post#1
Merged with Post#1
Useful Resources
Merged with Post#1
Well, I decided to go ahead and throw together this:
deldupe.exe
Basically, pass the XML to deldupe.exe (drag the XML and drop it on EXE, or run it from command line like this: "deldupe.exe example.xml"). It'll delete all the lines with the same "name" attribute. It'll leave the first one. I tested it on the example XML you posted in your first post, got this as a result:
test.xml
Seems about right I think.
Dunno if you actually need this or not anymore, but it only took a few minutes to make, so I figured I may as well.
EDIT: It's also probably easier than messing with a text editor's settings. Just drag and drop, job done.
Merged with Post#1
I have to be honest, I'm not really sure what you mean. In the first file you linked, in reference to XML nodes, I can't see any duplication...
And the second part, I'm not really sure what you want. I understand you want to delete the duplicate lines from each version of each file. But I don't get the bit about merging. What is the final result you want to achieve?
I'm probably just being stupid here, but I can't really work out what it is you want the tool to do. If you could try and explain it in another way or something, I might be able to help.
EDIT: With the nodes stuff: Do you mean deleting a whole array when it is duplicated? If so, I think that could be trickier, but I could try it. I won't until I get confirmation though, don't want to waste time on something that isn't right
Also, seeing as they couldn't be sorted, it would probably be a longer process.
Merged with Post#1
Ah I think I got you now. This seems a LOT more complicated than what the app I posted already does. I might be able to do this, but I most likely won't I'm afraid. I will see what I can do though.
I have some ideas of stuff that might work. I'll start working on a few of them now.
EDIT: I have modified my previous script to now delete elements with duplicate "name" attributes, regardless of position in file. i.e. if an element with attribute is found a second time, it will be ignored. The next step is to modify the app to do this for two files, and then attempt to make it merge the results. I will look into nodes following that. I have made more progress than I had expected to be able to, I am now more hopeful about the chances of being successful.
OK, here is a new, updated EXE. This one takes two inputs, an original XML and a translated XML. It deletes duplicates from both (from anywhere, don't have to be line after each other), then merges all translated strings into the original XML, and saves it. You need to run it from the command line, something like this:
Code:
apk-trans.exe trans.xml orig.xml dest.xml
Gives this output with the two shortened XML fragments you posted: dest.xml (even with me manually duplicating some lines, in random places)
Here's the EXE: apk-trans.exe
I'll work on removing duplicate nodes next, then make it a little more user friendly (e.g. usage instructions built it, some sort of sign it is doing something, maybe an optional GUI [it would appear if app was run with no parameters, so command line usage would still work]).
I reckon removing duplicate nodes could be the hardest part. I may now stop working on this for today and resume tomorrow.
EDIT: At this point, this should work for files like strings.xml. plurals.xml and arrays.xml will both not work. Not actually sure how it would handle files like that. The duplicate deletion stuff shouldn't change them at all. Not sure what the merging will do. Probably also nothing. I'll test now though. EDIT: I tested, spits out the original (untranslated) XML, almost unchanged (spacing at start of line is slightly different, but that shouldn't matter at all)
EDIT: Updated the EXE, noticed it output XMLs with the wrong encoding, fixed that.
EDIT: Saw updated first post - this EXE does pretty much what the command line tool described at the start describes, for strings.xml. It doesn't sort, but it automatically deletes duplicates and those not not present in the original XML.
I've updated the first post with the most recent info and examples so that newcomers can easily get all the info they need.
Hopefully we can turn this into a serious project, next thing I'm going to create a couple of GUI images to better portray how and what the application should do.
@SifJar
Thanks a lot for your help so far my dear friend. I'm hopeful that we can achieve all the required features and make Android translation process an easier experience No doubt that it will catch a lot of attention as soon as its done!
EDIT:
I've tried the tool with the following files and I think I found a bug, the tool hangs...
Please see attached file.
First post have been updated again to better fit the new section
Thanks to the mods for moving it!
Huh. Dunno why it doesn't work with those files. I will look into it more a bit later on.
EDIT: It does work. It just takes a while and there is no visible sign the program is running. That is one of the things I mentioned above as needing to work on. I was focusing more on the functionality for the time being.
SifJar said:
Huh. Dunno why it doesn't work with those files. I will look into it more a bit later on.
EDIT: It does work. It just takes a while and there is no visible sign the program is running. That is one of the things I mentioned above as needing to work on. I was focusing more on the functionality for the time being.
Click to expand...
Click to collapse
Hmm weird, I'm on a Quad-Core Q6600 and I let it run for 10min but it didn't finish yet How much time did it take on your machine?
Thanks!
I didn't time it, but it took a while. I added some command line output to reassure that it is doing something, here's an updated binary:
{see below}
Usage is as before, only now you must add |more to the end of the command, or you won't get any command line output. (Limitation of the scripting language I use seemingly).
EDIT: Seems to take less than 10 mins on my computer, which is lower spec than yours. I'll add a GUI with a progress bar now to show proper progress.
EDIT: OK, here's a new .exe (again). This time, if you add a fourth parameter (can be anything, but I use "gui"), a progress bar will be shown, to show how the tool is progressing. Seems to work nicely for me. Usage is something like this:
Code:
apk-trans.exe t_strings.xml s_strings.xml dest.xml gui |more
The |more gives command line output, the "gui" parameter gives progress bar. You can have both. |more is not necessary if you just want the progress bar (has info on what is currently being done under progress bar on window, same info as is output to cmd line).
Here's the EXE: http://d.pr/f/VmwC
Obviously I will improve the GUI in future, this is just a quick thing thrown together in a few minutes.
Can you please make it so it will generate a proper exit code (0) and get rid of the pop-up if not in GUI mode?
Since it will be used mainly in bash a graphical GUI will be rarely used...
Btw, which language are you using?
EDIT:
Perhaps you could create a GIT for it on Github or similar so others can share their input...
Aternus said:
Can you please make it so it will generate a proper exit code (0) and get rid of the pop-up if not in GUI mode?
Since it will be used mainly in bash a graphical GUI will be rarely used...
Btw, which language are you using?
EDIT:
Perhaps you could create a GIT for it on Github or similar so others can share their input...
Click to expand...
Click to collapse
There should be no pop up if not in GUI mode. And no, I can't change the way it exits, sorry.
I am using AutoHotKey (AHK). Maybe I'll stick up the source somewhere. Give me a minute.
https://github.com/SifJar/apk-trans

App crashes when implementing Action Bar support v7 library for android 2.3 and above

I have successfully created an app in Eclipse and it works for android 4.0 and above. Now I want to make it compatible also for android 2.3 and above. In my app I have used action bar, so I have added the android-support-v7-appcompat library project in my workset in my workspace. After following the instructions from Google, now I have 'android-support--v7-appcompat.jar' and 'android-support-v4.jar'under my projects Android Private Libraries section. Also I have the jar files under libs folder of my project.
In my Main Activity, I have imported:
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBar;
In AndroidManifest.xml file, I have declared:
<application android:allowBackup="true"
android:label="@string/app_name"
android:theme="@style/Theme.AppCompat"
Also, for different activities, declared as:
<activity android:
android:uiOptions="splitActionBarWhenNarrow"
Previously my AndroidManifest.xml was like this:
<application android:allowBackup="true"
android:label="@string/app_name"
android:theme="@style/AppTheme"
and the styles.xml under res>values folder was like this:
<resources >
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
</resources>
used
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
<!-- API 11 theme customizations can go here. -->
</style>
in values-v11 folder and
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<!-- API 11 theme customizations can go here. -->
</style>
in values-v14 folder.
I have now included all the styles_base.xml and themes_base.xml files from the library project to my project. Also changed styles.xml file by replacing Theme with App.Compat.
Everytime I run the app, I face crashing, now even for 4.0 and later android versions. The message:
java.main.NoClassDefFounderError: android.support.v7.appcompat.R$styleable
at android.support.v7.app.ActionBarActivityDelegate.onCreate
I am yet to find out what's the best policy to implament support library for action bar
Try that in your activity tags:
Code:
<activity android:theme="@style/Theme.AppCompat.Light" ... >
(http://developer.android.com/guide/topics/ui/actionbar.html#Adding)
and that's how to implement a split ActionBar:
Code:
<activity uiOptions="splitActionBarWhenNarrow" ... >
<meta-data android:name="android.support.UI_OPTIONS"
android:value="splitActionBarWhenNarrow" />
</activity>
(http://developer.android.com/guide/topics/ui/actionbar.html#Adding)
Read that: http://developer.android.com/guide/topics/ui/actionbar.html#Adding
At least in Android Studio you need to add the support repository as a module, too.
It is quite different than using ActionBarSherlock, but it is great and easier if you understand it. To me it seems to be faster, too.
EDIT: And please put your code into
Code:
tags. ;)
Re:
My Bad. I couldn't find out the
Code:
tag.
I tried android:theme= [user=262514]@style[/user]/AppTheme" in manifest.xml and defined in stules.xml:
[CODE]<resources >
<style name="AppTheme" parent= [user=262514]@style[/user]/Theme.AppCompat.Light">
<item name = "actionBarStyle">
[user=262514]@style[/user]/Widget.Styled.ActionBar
</item>
</style>
</resources>
Showing "error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.AppCompat.Light'."
Just to mention, I can see the two library jar files I have in 3 different locations. Under Android Private Libraries, under Referenced Libraries and under libs folder. Do I keep all the jar files or should I delete some.
PallabIslam said:
My Bad. I couldn't find out the
Code:
tag.
I tried android:theme= [user=262514]@style[/user]/AppTheme" in manifest.xml and defined in stules.xml:
[CODE]<resources >
<style name="AppTheme" parent= [user=262514]@style[/user]/Theme.AppCompat.Light">
<item name = "actionBarStyle">
[user=262514]@style[/user]/Widget.Styled.ActionBar
</item>
</style>
</resources>
Showing "error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.AppCompat.Light'."
Just to mention, I can see the two library jar files I have in 3 different locations. Under Android Private Libraries, under Referenced Libraries and under libs folder. Do I keep all the jar files or should I delete some.
Click to expand...
Click to collapse
//Removed as it was wrong.
Yeah, it didn't find that for me, too. That's why I needed to add the support repository as a module in AndroidStudio.
A tutorial for doing that in Eclipse: http://stackoverflow.com/questions/17856531/android-actionbarcompat-library (This step is important!)
If it says it can't retrieve the style when using @style/Theme.AppCompat.Light, then you probably have only imported the android-support-v7.jar file, but not the library itself (I did the same mistake the day it was out).
You need to import it from your sdk's /extras/android/support/v7/AppCompat folder.
Otherwise you're missing all the resources. Its /src dir is actually empty but needed for the build system to work properly.
EDIT: my bad, misread your post, as nikwen said, you want to retrieve the style from your project's namespace, not the android namespace, so remove the android: prefix
If you got 5 minutes to spend, watch this video and you'll be all set:
If you're still using Eclipse (booh!^^), you can use the Maven plugin to retrieve the library's artifact, otherwise all the steps are the same.
Androguide.fr said:
If it says it can't retrieve the style when using @style/Theme.AppCompat.Light, then you probably have only imported the android-support-v7.jar file, but not the library itself (I did the same mistake the day it was out).
You need to import it from your sdk's /extras/android/support/v7/AppCompat folder.
Otherwise you're missing all the resources. Its /src dir is actually empty but needed for the build system to work properly.
EDIT: my bad, misread your post, as nikwen said, you want to retrieve the style from your project's namespace, not the android namespace, so remove the android: prefix
If you got 5 minutes to spend, watch this video and you'll be all set:
If you're still using Eclipse (booh!^^), you can use the Maven plugin to retrieve the library's artifact, otherwise all the steps are the same.
Click to expand...
Click to collapse
Yeah, exactly. He needs to add that. That's what my link is about.
//Removed as it was wrong.
Android Studio is great.
nikwen said:
Yeah, exactly. He needs to add that. That's what my link is about.
//Removed as it was wrong.
Android Studio is great.
Click to expand...
Click to collapse
Yeah, once you get used to gradle it's awesome. Even more after getting rid of the horrid blurry icon :angel:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Androguide.fr said:
Yeah, once you get used to gradle it's awesome. Even more after getting rid of the horrid blurry icon :angel:
Click to expand...
Click to collapse
Thanks for the video above. I implented ActionBarCompat without that video. It would have saved me some time.
My icon is looking really ugly. Where can I get your icon from?
nikwen said:
Thanks for the video above. I implented ActionBarCompat without that video. It would have saved me some time.
My icon is looking really ugly. Where can I get your icon from?
Click to expand...
Click to collapse
Here you go, it's attached to this post.
Just drop it in the /bin folder of your studio install, then open a shell and do:
Code:
gnome-desktop-item-edit Desktop --create-new
It will open a visual daemon, name it whatever you want, point it to the /bin/studio.sh file of your install and click on the icon to select mine. (If you didn't put it in /bin too the icon would be the ugly one when the app is opened)
You'll then have a desktop shortcut you can drop to your sidebar.
Androguide.fr said:
Here you go, it's attached to this post.
Just drop it in the /bin folder of your studio install, then open a shell and do:
Code:
gnome-desktop-item-edit Desktop --create-new
It will open a visual daemon, name it whatever you want, point it to the /bin/studio.sh file of your install and click on the icon to select mine. (If you didn't put it in /bin too the icon would be the ugly one when the app is opened)
You'll then have a desktop shortcut you can drop to your sidebar.
Click to expand...
Click to collapse
I have already created a *.desktop file for the sidebar. I just need to change that one line with the icon.
Thank you very much! :good:
EDIT: It is just bad that ActionBarCompat does not provide a version of a PreferenceActivity or a support PreferenceFragment.
nikwen said:
I have already created a *.desktop file for the sidebar. I just need to change that one line with the icon.
Thank you very much! :good:
EDIT: It is just bad that ActionBarCompat does not provide a version of a PreferenceActivity or a support PreferenceFragment.
Click to expand...
Click to collapse
Yeah... same for custom layouts in menus (android:actionLayout & MenuItem.getActionView()), I'm actually now using both ActionBarCompat and ActionBarSherlock as I'm too lazy to rollback just yet^^
Androguide.fr said:
Yeah... same for custom layouts in menus (android:actionLayout & MenuItem.getActionView()), I'm actually now using both ActionBarCompat and ActionBarSherlock as I'm too lazy to rollback just yet^^
Click to expand...
Click to collapse
They said something really interesting on the I/O:
http://www.youtube.com/watch?v=Jl3-lzlzOJI&feature=youtu.be&t=3m47s
EDIT: Their workaround for the Preferences: Using the ActionBarCompat themes, the title bar is hidden on old platform versions.
Androguide.fr said:
Yeah... same for custom layouts in menus (android:actionLayout & MenuItem.getActionView()), I'm actually now using both ActionBarCompat and ActionBarSherlock as I'm too lazy to rollback just yet^^
Click to expand...
Click to collapse
It's not like they've done something new with ActionBarCompat regular ABS will serve us for as long as there is a need to support 2.x devices.
radical_thinking said:
It's not like they've done something new with ActionBarCompat regular ABS will serve us for as long as there is a need to support 2.x devices.
Click to expand...
Click to collapse
Even Google admits that: http://www.youtube.com/watch?v=Jl3-lzlzOJI&feature=youtu.be&t=3m47s
:laugh:
Google...
nikwen said:
Even Google admits that
:laugh:
Click to expand...
Click to collapse
Yea Roman talks about it in a few of Android Design in Action episodes how it's just a wrapper around the real actionbar on ICS+ so I guess once we get to that time we will need Jake to develop a new library that will backport functionality from Android 5.0 back to 4.0 because Google wont have time to do that for at least a year and a half...
The style not found issue is a bug in the XML source editor in the IDE. The app should still build just fine.
http://code.google.com/p/android/issues/detail?id=58075
Kelex24 said:
The style not found issue is a bug in the XML source editor in the IDE. The app should still build just fine.
http://code.google.com/p/android/issues/detail?id=58075
Click to expand...
Click to collapse
Yeah, I saw a link to this at Stackoverflow. However, there are two sides.
There is this error in the IDE. However, it cannot build without the support repository. That might be the issue here.

AdMob Issues - Logcat

Hello Frieds,
Today while I tried to integrate Admob in my app...
Im Facing this error while running the app in Emulator.
http://pastebin.com/Tbg06tdR
This is the code that I have put up in my XML.
Code:
<com.google.ads.AdView
android:id="@+id/adView"
android:layout_alignParentBottom="true"
android:layout_below="@+id/gridView"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
ads:adUnitId="a155465208dx522s"
ads:adSize="BANNER"
ads:loadAdOnCreate="true"
/>
You have an error at line 27. Want a hint? For integrate AdMob into your Android application follow this method:
Into your layout insert
Code:
<LinearLayout
android:id="@+id/ads"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:gravity="bottom"/>
Into your Activity insert
Code:
AdView adView = new AdView(this, AdSize.BANNER, "your_id");
LinearLayout layout = (LinearLayout)findViewById(R.id.ads);
layout.addView(adView);
adView.loadAd(new AdRequest());
This is a very quickly and efficient way to integrate AdMob.
CrotaNexus said:
You have an error at line 27. Want a hint? For integrate AdMob into your Android application follow this method:
Into your layout insert
Code:
<LinearLayout
android:id="@+id/ads"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:gravity="bottom"/>
Into your Activity insert
Code:
AdView adView = new AdView(this, AdSize.BANNER, "your_id");
LinearLayout layout = (LinearLayout)findViewById(R.id.ads);
layout.addView(adView);
adView.loadAd(new AdRequest());
This is a very quickly and efficient way to integrate AdMob.
Click to expand...
Click to collapse
Thanks that worked...Actually the main issue was that the SDK was not properly getting integrated in the app.
Solution
Go to Project Properties :
Then Built Path : Order and Export and select AdMob SDK there...
Click to expand...
Click to collapse
But I will be going Java way only. Just 1 thing any suggestion for using this for every layout as I dont want to create the Layout in every xml file as well as repeating the code in every java file too.
coolbud012 said:
Just 1 thing any suggestion for using this for every layout as I dont want to create the Layout in every xml file as well as repeating the code in every java file too.
Click to expand...
Click to collapse
I have never tried but you can make a layout that has the LinearLayout inside and after, into the desidered layout, include it with include tag. For the Java code, instead, you can try to do a method and pass the LinearLayout. I don't know if these solutions work. Try yourself.
CrotaNexus said:
I have never tried but you can make a layout that has the LinearLayout inside and after, into the desidered layout, include it with include tag. For the Java code, instead, you can try to do a method and pass the LinearLayout. I don't know if these solutions work. Try yourself.
Click to expand...
Click to collapse
I know about include..Trying to figure it out what should I do exactly...
BTW thanks
coolbud012 said:
I know about include..Trying to figure it out what should I do exactly...
BTW thanks
Click to expand...
Click to collapse
Make a custom view which extends LinearLayout ( or maybe FrameLayout would be better?) And have it create the adview as child with id and stuff you need. Then you just need to copy paste the XML tag into every layout file.

need help with increasing the limit on SMS

i want to increase the limit on character from 160 to more than that using stock messaging app
i read about editing the featureset.xml and others.xml but i could not find the folders or the files
saw this thread https://forum.xda-developers.com/showthread.php?t=2799239
saying
for everyone facing the sms problem with character length limitation to "80" or failing to send a concatenated sms message which converts to mms automatically do the following steps
1. Find the file featureset.xml in system/etc and open in text editor (Need root access then use root explorer for example)
2. Change the following values
Find <item name="KREncodingScheme">true</item> change to <item name="KREncodingScheme">false</item>
Find <item name="max_user_data_bytes_ex">80</item> change to <item name="max_user_data_bytes_ex">160</item>
Find <item name="limit_user_data_septets">160</item> change to <item name="limit_user_data_septets">1384</item>
3. Save and close then reboot
Did not help me at all
i have galaxy S8 OREO
please help
I am willing to offer compensation for the time and experties of anyone can help

Categories

Resources