Simplest possible example, a new .fla, targeting AIR 3.8 for android, stage sized 1600x900, with the following AS3 on the first frame:
import flash.geom.Rectangle;
import flash.display.StageDisplayState;
import flash.display.Shape;
var rect:Shape = new Shape();
rect.graphics.beginFill(0x00ff00);
rect.graphics.drawRect(0,0,640,480);
addChild(rect);
stage.displayState = StageDisplayState.FULL_SCREEN;
stage.fullScreenSourceRect = new Rectangle(rect.x,rect.y,rect.width,rect.height);
I would expect the device to 'zoom' to show only the green rectangle - that's how the exact same code works when compiled for windows rather than android - but instead, I just get the normal view of the stage, with the rectangle up in the corner.
what am I missing?
From the docs
The fullScreenSourceRect property can only be set when Flash Player or AIR is not in full-screen mode. To use this property correctly, set this property first, then set the displayState property to full-screen mode.
Are you setting FULL_SCREEN first as in your example?
Related
I have created a simple kivy app which is successfully running on windows. It takes barcode of products as input and proceed further. I have designed my own keypad for my application + It takes input from Barcode Scanner as well (Scanned barcode is being placed in focused TextInput). For this, I have set
Config.set('kivy', 'keyboard_mode', 'system')
which works perfectly fine.
Now, I want to run this app on android. On android, when a TextInput get's focus the android's keyboard becomes visible, which I don't want. I set TextInput property 'keyboard_mode' to 'managed' for this but it stops putting scanned barcode (from Barcode Scanner) in TextInput (as system keyboard will not be requested now).
What I want, hide the keyboard but it remain binded with focused TextInput, to access input from Barcode Scanner. I am stuck here, any help will be highly appreciated.
I am using: kivy==2.0.0, python==3.7.9 and buildozer to package application for android.
I have a few ideas but I first want to double check that you've put the Config.set('kivy', 'keyboard_mode', 'system') statement in the right place.
This needs to come before everything, i.e. the first two lines of your your main.py file should look like this:
from kivy.config import Config
Config.set('kivy', 'keyboard_mode', 'system')
from kivy.app import App
from kivy.core.window import Window
# etc.
The reason I ask this, is because writing Config.set() after importing App has no effect. On your computer I believe the default keyboard_mode is '' which is to simply choose the best option, which coincidentally is system. This can give the illusion of a working Config.set().
I am struggling with google printing interface in tablet. I want a print of fixed page size. PrintAttributes.Builder is not modifying the page and margin settings. How can i create a new custom/fixed page dimension for print. Now It shows ISO_A4 by default for HP printer.
My code is below:
PrintAttributes.Builder builder = new PrintAttributes.Builder();
PrintAttributes.MediaSize custom = new PrintAttributes.MediaSize("VISIT_K" , "VISIT_K", 86000,139860);
custom.asPortrait();
builder.setMediaSize( custom );
printJob = printManager.print(jobName, adapter,
builder.build());
Which Android version are you testing on? See this answer concerning a bug pre- Android 7
Regardless, the attributes here serve only as "hints", from the Android documentation:
You can use this parameter to provide hints to the printing framework
and pre-set options based on the previous printing cycle, thereby
improving the user experience. You may also use this parameter to set
options that are more appropriate to the content being printed, such
as setting the orientation to landscape when printing a photo that is
in that orientation.
I think if it conflicts with what the printer is reporting as supported/default, the printer's attributes may take precedence. This could be a feature/bug report to Android if it is not otherwise working.
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.
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...
I'm trying to put an AS3 "Flappy bird" example on my Android device but I can't put it in fullscreen and I don't understand why..
On the Adobe Flash pro emulator, the game is in fullScreen mode :
Image1
But on my Android device it's like that :
Image2
I think it is because I've got objects off stage...
Do you know, how can I put the game on fullscreen mode on my Android device ?
Thank you,
I've tried :
public function Main() {
stage.stageWidth=Capabilities.screenResolutionX;
stage.stageHeight=Capabilities.screenResolutionY;
stage.displayState = StageDisplayState.FULL_SCREEN;
stage.scaleMode = StageScaleMode.EXACT_FIT;
trace("fullscreen");
}
But still not working....
In your app.xml file for this project do you see <fullScreen>true</fullScreen> after <initialWindow> If not, write it in, exactly as shown, and publish to your Android device using ADT.
On mobile devices, "fullscreen" refers to whether or not the black status bar shows.
Set your swf to display without any scaling:
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;