ADT18 update but some style have mistake - android

i have update my ADt18.when i run my early app and sdk2.3,the eclipse give me mistake,the mistake appear at res\value\style, the detail is:
<style name="RatingBarSmall" parent="#android:Widget.RatingBar.Small">
<style name="ListSeparator" parent="#android:style/Widget.TextView.ListSeparator.White">
i found the RatingBar.Small have not support,how to modify it. why update the adt
the style not to useful

Google doesn't allow anymore these kind of parents...
http://daniel-codes.blogspot.com.es/2011/08/new-to-android-more-style-restrictions.html

Related

KivyMD, can't see icons in android but works on linux

I'm just created .apk file with buildozer.But as i said in topic, can't see any icon on device.Everything works and looks fine in Linux. But in device,all icons are blank. This is my buildozer.init requirements: (my ndk,sdk,minapi,ndk_api values are default)
requirements = python3,kivy==1.11.1,https://github.com/kivymd/KivyMD/archive/master.zip
If i use kivymd==0.104.1, i can see icons in android but can't use some commands like : MDTab.get_tab_list() , MDTab.switch_tab() (I asked that problem before in here.So i have to use master branch version because i need to switch MDTabs after some button clicks.But now,i can't see any icon.Is that bug or can someone help me ? Thank you..
(Last note: Im removing .buildozer file before change requirements versions.)
Set correct dependencies in buildozer.spec- https://github.com/kivymd/KivyMD/commit/df73810cc725e4575c93bc4cbbb72f67ff568dc1

Convert an old style Android menu to work on newer phones

My old app has one simple menu on the main activity. It has only a few simple options, for instance "About" causing a popup with some info about the app.
It works perfectly on emulator Nexus One (API23), because there is an emulated physical menu button.
However, on most modern phones, there is no button, which means that my menus cannot be accessed.
I actually vaguely remember running it on a phone years ago which didn't have a menu button, yet somehow one could still access the menus. I may remember wrong.
(I started digging into this some days ago, and started modifying my code, the main activity inheriting from something more posh than Activity, which then caused some older API versions to be left out - and things quickly spun out of control. After hours of "maven gradle settings" and "Support Library" stuff and many pages of "AAPT2 errors" and messing up my whole system trying to fix that, I had to throw everything away and get a fresh clone from the repo. Fortunately I could also repair the other changes I had made to the system.)
How does one convert an old-style app menu to work on modern phones? It doesn't have to be fancy.
/** Setup menu */
#Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main, menu);
return true;
}
/** Handle menu clicks */
#Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle item selection
switch (item.getItemId()) {
case R.id.action_about:
final SpannableString s =
new SpannableString(getApplicationContext().getText(R.string.about));
Linkify.addLinks(s, Linkify.ALL);
AlertDialog d = new AlertDialog.Builder(this)
.setIcon(android.R.drawable.ic_dialog_info)
.setTitle("About")
.setMessage(s)
//.setView(message)
.show();
((TextView)d.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance());
return true;
default:
new AlertDialog.Builder(this)
.setIcon(android.R.drawable.ic_dialog_info)
.setTitle("Currently not used.")
.show();
return super.onOptionsItemSelected(item);
}
}
I'll admit that I no longer understand all the details above from years ago.. it worked, so I never paid it much attention. It looks a bit wordy... probably there are simpler ways to do it.
This is menu/main.xml
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="#+id/action_settings"
android:orderInCategory="100"
android:title="#string/action_settings"/>
<item
android:id="#+id/action_about"
android:orderInCategory="3"
android:title="About"/>
<item
android:id="#+id/action_manual"
android:orderInCategory="4"
android:title="Manual"/>
</menu>
Maybe there is some "theme" to just add somewhere that makes the menu button show up somewhere on the screen, and that's that? (I know I am optimistic. :))
Everything looks fine.
I think your problem is because you are extending Activity.
change Activity to AppComatActivity.
and change your appThem to android:theme="#style/Theme.AppCompat.Light.DarkActionBar"
Note:
To use the AppCompatActivity, make sure you have the Google Support Library downloaded (you can check this in your Tools -> Android -> SDK manager). Then just include the gradle dependency in your app's gradle.build file:
compile 'com.android.support:appcompat-v7:27.0.2'
SOLUTION:
The only way to a solution that I could find was to create a completely new project with default settings in the latest Android Studio. This gives a "latest fashion" setup. Then I moved code in from the old project manually.
Everything now works perfectly!
ISSUES / REASONS:
As mentioned in the comment section above, every attempt I made to modernize the code resulted in a maze of problems. It was an old project, from way back when Android Studio was not even in Beta stage. Hence, it was based on Eclipse. The current Android version back then was Jelly Bean (Kitkat was just released).
In summary, we had an ancient project based on an older IDE. Perhaps it would be doable to convert a modern Eclipse project into Android Studio. Perhaps it would be doable to convert an older AS project into a modern one. However, performing both these major jumps at the same time was too great a challenge for me.
Another issue which has nothing to do with the old code, but which confused the matter greatly is that something called AAPT2 currently for whatever reason assumes american characters only in the search path to the .gradle directory. I use the word "assumes", because if the characters are anything else, you get pages of errors in the build log. None of the errors point very clearly to the reason.
AFAIK I don't even use AAPT2! After some sleepless nights, I solved it by changing the global setting in Android Studio to simply use another path.

In my Android app, Digits theme not working after upgrading digits (by Twitter's Fabric) to version 2.0.0

[Disclaimer: DEPRECATED - Digits has changed implementation and ownership. The question/answer is outdated]
I have been using Digits in my Android production app for few months now without any issues. Recently Digits was upgraded to version 2.0.0. I tried upgrading my implementation for the same by following Digits upgrade guide. Everything is working as expected but theme.
My implementation:
In my app, in the activity which extends Application, I have initialized digits as given in docs, and post that used the following code to set theme:
new Digits.Builder().withTheme(R.style.CustomDigitsTheme).build();
where CustomDigitsTheme is:
<style name="CustomDigitsTheme" parent="Theme.AppCompat.Light">
<item name="android:textColorPrimary">#color/text_primary</item>
<item name="android:textColorSecondary">#color/text_hint</item>
<item name="android:textColorLink">#color/accent</item>
<item name="dgts__accentColor">#color/accent</item>
<item name="dgts__logoDrawable">#drawable/logo</item>
</style>
Note that Digits provide another way to set theme (using DigitsAuthButton). But I can't use it because in my implementation I'm using regular Button.
[Disclaimer: DEPRECATED - Digits has changed implementation and ownership. The question/answer is outdated]
Solved.
Silly to put this code:
new Digits.Builder().withTheme(R.style.CustomDigitsTheme).build();
instead of:
Fabric.with(this, new TwitterCore(twitterAuthConfig), new Digits.Builder().withTheme(R.style.CustomDigitsTheme).build());

what does "?" mean in Android styles.xml files mean?

in Android Framework source code ~/core/res/res/values/styles.xml
there's one line:
<item name="android:textColor">?textColorPrimaryInverse</item>
Could anyone tell me:
What does "?textColorPrimaryInverse" mean?
Where is "textColorPrimaryInverse" referenced ?
Please check this link. So, you can get the idea about the textColorPrimaryInverse: http://developer.android.com/reference/android/R.attr.html#textColorPrimaryInverse

Styling the DatePicker

I have been trying very hard to style the text size and colour on android 3.2. When attempting to override the default style with
<item name="android:numberPickerInputTextStyle">#style/numberPickerInputText</item>
I always get this error:
error: Error: No resource found that matches the given name: attr 'android:numberPickerInputTextStyle'.
Why is this so? I am pretty sure I selected the correct style to override (dug it from the platform 13 API folder)
I looked in these places.. seems like it cant be helped!
http://code.google.com/p/android/issues/detail?id=18659#c8
No resource found that matches the given name '#android:style/AlertDialog' error after the latest android 3.2 sdk update
This blog below said something about importing the styles into my application. How is it supposed to be done? examples?
http://daniel-codes.blogspot.com/2011/08/new-to-android-more-style-restrictions.html
Can someone please point me to the right direction? Thanks!
Quick and dirty way.. apply it after you show the dialog. Not a good solution but it works.. still looking for other solutions :)
//Should'nt be here but well..
public static void changeDialogTextSize(Dialog dialog) {
TextView tvMessage = (TextView)dialog.findViewById(android.R.id.message);
if (tvMessage != null)
{
tvMessage.setTextSize(25f);
tvMessage.setTextColor(Color.WHITE);
}
}

Categories

Resources