JavaFxPorts TextField Issue - Android Keyboard wont function - android

I developed a simple javafx application to be ported in Android Environment, however I cant type any characters in the TextField. I guess its a bug, how to fix this one?
Th problem on galaxy S5 android 5.0.1 is not present but on galaxy tab 4 android 5.0.2 it doesn't work i type but none is displyed.
Tried with normal textfield. And the problem persist also I have added the properties .
Another strange rhig is that the space where recognizer. And the del button . The text not
THe code by example is very easy
Rectangle2D visualBounds = Screen.getPrimary().getVisualBounds();
double width = visualBounds.getWidth();
double height = visualBounds.getHeight();
TextField tt= new TextField();
tt.setTranslateY(-150);
StackPane stackPane = new StackPane();
stackPane.getChildren().addAll(tt);
borderpane.setCenter(stackPane);
Scene scene = new Scene(borderpane, width, height);
stage.setScene(scene);

Assuming that CustomTextField is just a custom TextField, this is a known issue, not related to the CustomTextField itself, given that it works in other device.
If you debug it:
./adb logcat -v threadtime
you surely find an exception that explains the issue: a StackOverFlow exception.
On older devices it can be solved adding this: create a java.custom.properties file, and include in it this property:
monocle.stackSize=128000
You may also include this one:
monocle.platform=Android
(it will be soon included by default in the next version)
Put the file at the root of your classpath, e.g. in the folder src/android/resources of your project.
Build and deploy the project on your mobile and check again.

Related

Android Auto: Custom action's icon not showing

I'm trying to add a custom action to the media session's playback state, so it can show an addition button on Android Auto. The code is indeed simple, the button is added and I can receive its callback, but the problem is the button doesn't have an icon:
The code:
val builder = PlaybackStateCompat.Builder()
builder.addCustomAction(
"ACTION_TEST",
"TEST LABEL",
R.drawable.ic_test // I tried vector drawable, png,... nothing works
)
// ...
mediaSession.setPlaybackState(builder.build())
The result: the added button doesn't have an icon, only shows a ripple effect (the circle in the screenshot) when I click it, otherwise it's invisible.
I found out the root cause. It's because Android Studio auto-optimizes the build process to produce minimal APK that can run on current ADB-connected devices.
In my case, AS included only xhdpi resources in the debug APK, therefore Android Audio HeadUnit couldn't load the drawable. Basically, AS silently changed the Gradle config to somewhat like this:
android {
...
productFlavors {
dev {
resConfigs "xhdpi" // <- root cause
}
...
}
}
I can simply run my app from the terminal to get rid of this problem.
If you have the same problem, just ensure the drawable is available for all screen densities (hdpi, xhdpi,...), and check your APK whether it's packaged with resources in all screen densities.
For me, the problem was resolved when I cleared the data of Android App application on my phone.
Was using it to run DHU emulator on desktop. Somehow its caching went awry.

setting select to width 100% disables select function on android 5.1.x and Nexus-7 (phonegap build)

i've to work with phonegap build, cli 5.x and try to build a search form with several inputs, 3 of them are select boxes.
all works fine till i wanted to set the css of the select nodes to 100% with. If i enable this css the selection does not open any more.
My Android Device for testing that won't work is a Nexus 7 with Android 5.1.1 (Lollipop). On IOS and Android Devices with 4.x all is working fine.
The language we use is Typescript with JQuery and will be compiled to Javascript ES5 (commonJS Style).
Sample Script:
var sampleData = [{"val": 1, "text": "sample A"}, {"val": 2, "text": "sample B"}];
var myContainer $('#content-box');
var selectBox = $('<select>').attr('id', 'mySelectBox');
selectBox.append($('<option>').attr('value', 'none').html('-- none --'));
for(var index in sampleData) {
var obj = sampleData[index];
selectBox.append($('<option>').attr('value', obj['val']).html(obj['text']));
}
// code above works fine
$('select').css('width', '100%');
// this crashes the popup after compilation
// and i have to use phonegap-build
by the way, if i have extreme long content going over 100% of the screen with it works. just stretching seems to crash.
i don't work with jquery mobile, some features we build won't work with it !!!
tried external css also, same failure.
somebody has a workaround or a fix for it? somebody can confirm this solution?
Try setting an id for the element you want to modify,
then try
$('#select').css('width', '100%');
if id="select"

Taking Screenshots Using Qt C++ on Android

thanks for checking my question out!
I'm currently working on a project using Qt C++, which is designed to be multi-platform. I'm a bit of a newcoming to it, so I've been asked to set up the ability to take screenshots from within the menu structure, and I'm having issues with the Android version of the companion app.
As a quick overview, it's a bit of software that send the content of a host PC's screen to our app, and I've been able to take screenshots on the Windows version just fine, using QScreen and QPixmap, like so:
overlaywindow.cpp
{
QPixmap screenSnapData = screenGrab->currentBackground();
}
screenGrabber.cpp
{
QScreen *screen = QGuiApplication::primaryScreen();
return screen->grabWindow( QApplication::desktop()->winId() );
}
Unfortunately, Android seems to reject QScreen, and with most suggestions from past Google searches suggesting the now-deprecated QPixmap::grab(), I've gotten a little stuck.
What luck I have had is within the code for the menu itself, and QWidget, but that isn't without issue, of course!
QFile doubleCheckFile("/storage/emulated/0/Pictures/Testing/checking.png");
doubleCheckFile.open(QIODevice::ReadWrite);
QPixmap checkingPixmap = QWidget::grab();
checkingPixmap.save(&doubleCheckFile);
doubleCheckFile.close();
This code does take a screenshot, but only of the button strip currently implemented, and not for the whole screen. I've also taken a 'screenshot' of just a white box with the screen's dimensions by using:
QDesktopWidget dw;
QWidget *screen=dw.screen();
QPixmap checkingPixmap = screen->grab();
Would anyone know of whether there was an alternative to using QScreen to take a screenshot in Android, or whether there's a specific way to get it working as compared to Windows? Or would QWidget be the right track? Any help's greatly appreciated!
as i can read in Qt doc : In your screenGrabber.cpp :
QScreen *screen = QGuiApplication::primaryScreen();
return screen->grabWindow( QApplication::desktop()->winId() );
replace with :
QScreen *screen = QGuiApplication::primaryScreen();
return screen->grabWindow( 0 ); // as 0 is the id of main screen
If you want to take a screenshot of your own widget, you can use the method QWidget::render (Qt Doc):
QPixmap pixmap(widget->size());
widget->render(&pixmap);
If you want to take a screenshot of another app/widget than your app, you should use the Android API...

Android - Libgdx - Couldnt Load File

I have used google, read all Questions here on StackExchange but still couldnt solve my Problem.
So Im following a tutorial from kilobolt(Zombie Bird).
The desktop-version of the game is running without problems, but if I want to run it on an android emulator I get this error message:
"Couldn't load file: data/logo.png"
The line where I get the error looks like this:
logoTexture = new Texture(Gdx.files.internal("data/logo.png"));
My Android Path looks like this:
-Android
-Assets
-Data
-logo.png
I assume this is the correct path.
I have tried cleaning the project, I used Gradle > Refresh All, I restarted Eclipse.
Nothing worked.
Im a little bit confused cause if I move the file outside of Data but in the Assets Folder and change the path to this:
logoTexture = new Texture(Gdx.files.internal("logo.png"));
It works.
Can someone explain me why I cant use the Data Folder inside of Assets?
What emulator are you using to run it? For me, the same code works properly on an actual Android device, so I'd assume it is an Emulator error. Possibly has to do with the / as the seperator character. This is just a wild guess, but does
logoTexture = new Texture(Gdx.files.internal("data" + File.separator + "logo.png"));
fix it, or break it?
maybe it's caused by the difference of OpenGl ES 1 and OpenGl ES 2...
Using OpenGl ES 1 the picture size has the power of two. Bear with me - I'm new to libgdx.. :)

image won't show in tableView

I'm creating a tableView in appcelerator (Android) and I want to add an image to it. This is just a test because I also had some problems with it in my project and I wanted to try it out first somewhere else so I wouldn't ruin my whole project.
I first added the standard png's to see if he would show those, and he did. But when I add a png that I've created, he refuses to show it in the tableView. Does someone know why he refuses to show the image? (I created that png in photoshop by changing one of the standard png's and adding my image to it.)
var win = Titanium.UI.createWindow({
title:'tableViewRow',
backgroundColor:'#fff'
});
var regData = [
{leftImage:'KS_nav_ui.png', title:'gft', left:20, color:'black'},
{rightImage:'KS_nav_views.png', title:'grofvuil', left:20, color:'black'},
{leftImage:'glas.png', title:'glas', left:20, color:'black'}
];
var tbl = Titanium.UI.createTableView({
data:regData
});
win.add(tbl);
win.open();
Here's an image of the result I get in my android emulator (android api: Google APIs Android 2.2 and screen:HVGA)
If you are using AppC 1.8, you may just need a forward slash in your path '/'. (or backward if Windows)
I've solved it. What I did is I ran the application in an android amulator. I closed the app and went back to the homescreen (where you can save some apps). I pressed on menu and went to the settings. Than I went to applications. I opened 'manage applications' and remove the application. I closed the emulator and ran it again and the images were shown.
I don't know why you have to do it, but it worked for me. I hope I can save someone the frustration by posting the answer (I know I had them :D)

Categories

Resources