Android - How to show a clock in a TimePickerDialog on API19 - android

How is it possible to show a clock when opening a TimePickerDialog on preAPI21? I'm using appcompat-22 and I even found a way to show the new switch widget. I know how to change it in a regular layout: timePickerMode="clock/spinner" but couldn't find how to do it when opening a TimePickerDialog on API 19.
Please advice

Related

C++ Builder Tokyo 10.2.3 FMX Android application crash if I dont click on Next button on virtual keyboard

I use C++ Builder Tokyo 10.2.3 and trying to do something very simple on Android like typing some text into an Edit box.
If I press Next or Done key on virtual keyboard everything is fine.
If I press an Exit Button to go back the previous form it looks it is fine but then if I press Android Back button application crash.
It took me hours to identify the problem but couldn't find any solution but trying to disable all other objects when user clicks in an Edit box and enable them if user click on Next..
It seems to me a bug but need to make sure before report it to Embarcadero.
Thanks
I found the problem and a solution. In short, there is a bug in C++ Builder Tokyo 10.2.3 as if virtual keyboard on Android hide/close because of focus change on a form virtual keyboard doesn't take it as it is hidden properly.. FormVirtualKeyboardHidden working fine but I don't know somehow application crashes.
So, the solution is to using platform services. Just hide the keyboard manually on FormFocusChanged event.
void __fastcall TForm1::FormFocusChanged(TObject *Sender)
{
di_IFMXVirtualKeyboardService VirtualKeyboardService;
if(TPlatformServices::Current->SupportsPlatformService(__uuidof(IFMXVirtualKeyboardService), &VirtualKeyboardService))
{
VirtualKeyboardService->HideVirtualKeyboard();
}
}

datepicker dialog can't swich to spinner on Android 7.0 device

Before Android N, I can use the code below to instance a spnnier mode datepicker dialog:
new DatePickerDialog(getContext(), AlertDialog.THEME_HOLO_LIGHT, null, 2016, 9, 18);
but the above code is not work on Android N device, it always show the calander mode, is there something different in Android N? How can I instance a spinner mode datepicker dialog?
Have you tried something like : yourDatePickerDialog.getDatePicker().setCalendarViewShown(false);

Activity Background change dynamic

I have just started developing an android weather app and I was wondering how to change activity background automatically. For example, in daytime it should show day time or in the night it should show night photos.
This is the app of Sony which has a feature (mentioned above)
Check the screenshots.
Okay Credit goes to SteD;so for you check this(beginner's guide)
Follow this
//set an ID for Relative Layout in content_main.xml(Android Studio)
RelativeLayout rlayout=(RelativeLayout)findViewById(R.id.rlayout);
if(something){Drawable drawble=getResource().getDrawable(R.drawable.your_image);rlayout.setBackgroundDrawable(drawable);}
//If it works,destroy the upvote
The only automatic way is the newly released (Day/Night theme for android app)
For finer control you check the condition yourself and call the normal Java methods, like this:
if(something) {
getWindow()
.setBackgroundDrawable(ContextCompat.getDrawable(this, R.drawable.image));
}
of if you don't care about the newly introduced context themed styling, you just call the deprecated method (which will keep working without issues for all the foreseeable future)
if(something) {
getWindow()
.setBackgroundDrawable(
getResources().getDrawable(R.drawable.image));
}

TimePickerDialog not showing AM/PM button in Gingerbread using SDK v22

I've recently begun updating my app to use appcompat-v22. One thing I've noticed is that on a Gingerbread emulator, the timepicker dialog is missing the AM/PM button.
I can click the empty space (inside the red circle in the below picture), and it will alternate between AM/PM, but I still can't see the actual button on the dialog.
Is this a bug in the SDK / compatability libraries, or maybe I did something horribly wrong when creating the dialog?
Edit: I didn't originally include my code, as it is very simple, I am not editing dialog themes at all. Note that it works as expected when using SDK v21 as the target.
TimePickerDialog timePickerDialog = new TimePickerDialog(adapter.getContext(), new TimePickerDialog.OnTimeSetListener() {
#Override
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
// do stuff
}
}), reminderItem.hour, reminderItem.minute, false);
timePickerDialog.setTitle(R.string.createReminder);
timePickerDialog.show();
Fixed in Support Library 22.1.0

How to customize UI of a dialog returned from GooglePlayServicesUtil.getErrorDialog?

I have an android app where I have customized the activity layouts with my required themes/colors/title bars/etc.
I need to depend on Google Play services. So, I do the following:
int resultCode =
GooglePlayServicesUtil.
isGooglePlayServicesAvailable(this);
...
Dialog errorDialog = GooglePlayServicesUtil.getErrorDialog(
resultCode,
this,
CONNECTION_FAILURE_RESOLUTION_REQUEST);
The problem is, the dialog appears as a blank one, meaning all white. I want to customize this dialog to look like the rest of my UI - blue colored header, grey background, etc.
I am unable to find a way to do the above. Could you please provide any input ?
Any pointers will be highly appreciated.
EDIT: I missed to say that my app needs to run on devices with API version 8 and higher.

Categories

Resources