<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How to get a screenshot in Android?]]></title><description><![CDATA[<p dir="auto">Hi!<br />
How to get a screenshot in Android?</p>
]]></description><link>https://forum.qt.io/topic/105516/how-to-get-a-screenshot-in-android</link><generator>RSS for Node</generator><lastBuildDate>Wed, 01 Jul 2026 13:52:31 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/105516.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 31 Jul 2019 14:36:55 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to get a screenshot in Android? on Thu, 01 Aug 2019 05:46:43 GMT]]></title><description><![CDATA[<p dir="auto">it's work <a href="https://doc.qt.io/qt-5/qml-qtquick-item.html#grabToImage-method" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-5/qml-qtquick-item.html#grabToImage-method</a></p>
]]></description><link>https://forum.qt.io/post/544052</link><guid isPermaLink="true">https://forum.qt.io/post/544052</guid><dc:creator><![CDATA[Mikeeeeee]]></dc:creator><pubDate>Thu, 01 Aug 2019 05:46:43 GMT</pubDate></item><item><title><![CDATA[Reply to How to get a screenshot in Android? on Wed, 31 Jul 2019 18:31:04 GMT]]></title><description><![CDATA[<p dir="auto">Maybe you know how use for this Android API?</p>
]]></description><link>https://forum.qt.io/post/543995</link><guid isPermaLink="true">https://forum.qt.io/post/543995</guid><dc:creator><![CDATA[Mikeeeeee]]></dc:creator><pubDate>Wed, 31 Jul 2019 18:31:04 GMT</pubDate></item><item><title><![CDATA[Reply to How to get a screenshot in Android? on Wed, 31 Jul 2019 17:57:20 GMT]]></title><description><![CDATA[<p dir="auto">Does this code work on your phone? And if it works, what version of the code?</p>
]]></description><link>https://forum.qt.io/post/543993</link><guid isPermaLink="true">https://forum.qt.io/post/543993</guid><dc:creator><![CDATA[Mikeeeeee]]></dc:creator><pubDate>Wed, 31 Jul 2019 17:57:20 GMT</pubDate></item><item><title><![CDATA[Reply to How to get a screenshot in Android? on Wed, 31 Jul 2019 17:56:39 GMT]]></title><description><![CDATA[<p dir="auto">I use 3 android device</p>
]]></description><link>https://forum.qt.io/post/543992</link><guid isPermaLink="true">https://forum.qt.io/post/543992</guid><dc:creator><![CDATA[Mikeeeeee]]></dc:creator><pubDate>Wed, 31 Jul 2019 17:56:39 GMT</pubDate></item><item><title><![CDATA[Reply to How to get a screenshot in Android? on Wed, 31 Jul 2019 17:52:32 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mikeeeeee">@<bdi>mikeeeeee</bdi></a><br />
Well if possible you can try on another android device to see if same happens.</p>
]]></description><link>https://forum.qt.io/post/543991</link><guid isPermaLink="true">https://forum.qt.io/post/543991</guid><dc:creator><![CDATA[mrjj]]></dc:creator><pubDate>Wed, 31 Jul 2019 17:52:32 GMT</pubDate></item><item><title><![CDATA[Reply to How to get a screenshot in Android? on Wed, 31 Jul 2019 17:36:56 GMT]]></title><description><![CDATA[<p dir="auto">I use Android 5,6,9</p>
]]></description><link>https://forum.qt.io/post/543990</link><guid isPermaLink="true">https://forum.qt.io/post/543990</guid><dc:creator><![CDATA[Mikeeeeee]]></dc:creator><pubDate>Wed, 31 Jul 2019 17:36:56 GMT</pubDate></item><item><title><![CDATA[Reply to How to get a screenshot in Android? on Wed, 31 Jul 2019 17:35:34 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mikeeeeee">@<bdi>mikeeeeee</bdi></a><br />
Hi<br />
Not all android devices can take shot of QML. Need support in openGL driver.</p>
<p dir="auto">Hmm. your Qt version seems new enough.<br />
if you google "qt qml grabwindow bug" you can see there been quite some issues but<br />
it should work with new Qt versions.</p>
<p dir="auto">How type of android device are you using ? I mena is it old or kinda new ?</p>
]]></description><link>https://forum.qt.io/post/543989</link><guid isPermaLink="true">https://forum.qt.io/post/543989</guid><dc:creator><![CDATA[mrjj]]></dc:creator><pubDate>Wed, 31 Jul 2019 17:35:34 GMT</pubDate></item><item><title><![CDATA[Reply to How to get a screenshot in Android? on Wed, 31 Jul 2019 17:32:17 GMT]]></title><description><![CDATA[<p dir="auto">my initial code worked in Windows, but it doesn't work in Android.</p>
]]></description><link>https://forum.qt.io/post/543988</link><guid isPermaLink="true">https://forum.qt.io/post/543988</guid><dc:creator><![CDATA[Mikeeeeee]]></dc:creator><pubDate>Wed, 31 Jul 2019 17:32:17 GMT</pubDate></item><item><title><![CDATA[Reply to How to get a screenshot in Android? on Wed, 31 Jul 2019 17:31:16 GMT]]></title><description><![CDATA[<p dir="auto">I use Qt 5.13</p>
]]></description><link>https://forum.qt.io/post/543987</link><guid isPermaLink="true">https://forum.qt.io/post/543987</guid><dc:creator><![CDATA[Mikeeeeee]]></dc:creator><pubDate>Wed, 31 Jul 2019 17:31:16 GMT</pubDate></item><item><title><![CDATA[Reply to How to get a screenshot in Android? on Wed, 31 Jul 2019 17:30:45 GMT]]></title><description><![CDATA[<p dir="auto">Could the screen be incorrectly processed?</p>
]]></description><link>https://forum.qt.io/post/543986</link><guid isPermaLink="true">https://forum.qt.io/post/543986</guid><dc:creator><![CDATA[Mikeeeeee]]></dc:creator><pubDate>Wed, 31 Jul 2019 17:30:45 GMT</pubDate></item><item><title><![CDATA[Reply to How to get a screenshot in Android? on Wed, 31 Jul 2019 17:30:37 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mikeeeeee">@<bdi>mikeeeeee</bdi></a><br />
Im really not sure what you are saying. :)<br />
That code work for others it seemed<br />
<a href="https://stackoverflow.com/questions/21697185/how-to-take-screenshot-of-qml-application-without-qquickview/38501975" target="_blank" rel="noopener noreferrer nofollow ugc">https://stackoverflow.com/questions/21697185/how-to-take-screenshot-of-qml-application-without-qquickview/38501975</a></p>
<p dir="auto">What Qt version are you using?</p>
]]></description><link>https://forum.qt.io/post/543985</link><guid isPermaLink="true">https://forum.qt.io/post/543985</guid><dc:creator><![CDATA[mrjj]]></dc:creator><pubDate>Wed, 31 Jul 2019 17:30:37 GMT</pubDate></item><item><title><![CDATA[Reply to How to get a screenshot in Android? on Wed, 31 Jul 2019 17:29:46 GMT]]></title><description><![CDATA[<p dir="auto">qDebug() &lt;&lt;"image.isNull() :" &lt;&lt; image.isNull()&lt;&lt;"screen-&gt;size() :"&lt;&lt;screen-&gt;size();<br />
return<br />
image.isNull() : false screen-&gt;size() : QSize(360, 640)</p>
]]></description><link>https://forum.qt.io/post/543984</link><guid isPermaLink="true">https://forum.qt.io/post/543984</guid><dc:creator><![CDATA[Mikeeeeee]]></dc:creator><pubDate>Wed, 31 Jul 2019 17:29:46 GMT</pubDate></item><item><title><![CDATA[Reply to How to get a screenshot in Android? on Wed, 31 Jul 2019 17:26:33 GMT]]></title><description><![CDATA[<p dir="auto">We've made a mistake. I immediately ask the text QString image("data:image/png;base64,"); And so, pictures of the there is no. Need another code.</p>
]]></description><link>https://forum.qt.io/post/543983</link><guid isPermaLink="true">https://forum.qt.io/post/543983</guid><dc:creator><![CDATA[Mikeeeeee]]></dc:creator><pubDate>Wed, 31 Jul 2019 17:26:33 GMT</pubDate></item><item><title><![CDATA[Reply to How to get a screenshot in Android? on Wed, 31 Jul 2019 17:18:25 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mikeeeeee">@<bdi>mikeeeeee</bdi></a><br />
Cant you just save it ?<br />
<a href="https://doc.qt.io/qt-5/qimage.html#save" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-5/qimage.html#save</a></p>
]]></description><link>https://forum.qt.io/post/543981</link><guid isPermaLink="true">https://forum.qt.io/post/543981</guid><dc:creator><![CDATA[mrjj]]></dc:creator><pubDate>Wed, 31 Jul 2019 17:18:25 GMT</pubDate></item><item><title><![CDATA[Reply to How to get a screenshot in Android? on Wed, 31 Jul 2019 17:07:41 GMT]]></title><description><![CDATA[<p dir="auto">But how to get a picture out of it?</p>
]]></description><link>https://forum.qt.io/post/543979</link><guid isPermaLink="true">https://forum.qt.io/post/543979</guid><dc:creator><![CDATA[Mikeeeeee]]></dc:creator><pubDate>Wed, 31 Jul 2019 17:07:41 GMT</pubDate></item><item><title><![CDATA[Reply to How to get a screenshot in Android? on Wed, 31 Jul 2019 17:06:27 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mikeeeeee">@<bdi>mikeeeeee</bdi></a><br />
Ok, that means its does grab something :)</p>
]]></description><link>https://forum.qt.io/post/543978</link><guid isPermaLink="true">https://forum.qt.io/post/543978</guid><dc:creator><![CDATA[mrjj]]></dc:creator><pubDate>Wed, 31 Jul 2019 17:06:27 GMT</pubDate></item><item><title><![CDATA[Reply to How to get a screenshot in Android? on Wed, 31 Jul 2019 17:04:45 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mrjj">@<bdi>mrjj</bdi></a> said in <a href="/post/543974">How to get a screenshot in Android?</a>:</p>
<blockquote>
<p dir="auto">qDebug() &lt;&lt; image.isNull();</p>
</blockquote>
<p dir="auto">qDebug() &lt;&lt;"image.isNull() :" &lt;&lt; image.isNull();<br />
return:<br />
image.isNull() : false</p>
]]></description><link>https://forum.qt.io/post/543976</link><guid isPermaLink="true">https://forum.qt.io/post/543976</guid><dc:creator><![CDATA[Mikeeeeee]]></dc:creator><pubDate>Wed, 31 Jul 2019 17:04:45 GMT</pubDate></item><item><title><![CDATA[Reply to How to get a screenshot in Android? on Wed, 31 Jul 2019 17:02:12 GMT]]></title><description><![CDATA[<p dir="auto">qDebug()&lt;&lt;"screenShot:"&lt;&lt;image;<br />
return:<br />
"screenShot: "data:image/png;base64,""</p>
]]></description><link>https://forum.qt.io/post/543975</link><guid isPermaLink="true">https://forum.qt.io/post/543975</guid><dc:creator><![CDATA[Mikeeeeee]]></dc:creator><pubDate>Wed, 31 Jul 2019 17:02:12 GMT</pubDate></item><item><title><![CDATA[Reply to How to get a screenshot in Android? on Wed, 31 Jul 2019 16:39:52 GMT]]></title><description><![CDATA[<p dir="auto">is the image valid then ?<br />
like<br />
qDebug() &lt;&lt; image.isNull();<br />
says false ?</p>
]]></description><link>https://forum.qt.io/post/543974</link><guid isPermaLink="true">https://forum.qt.io/post/543974</guid><dc:creator><![CDATA[mrjj]]></dc:creator><pubDate>Wed, 31 Jul 2019 16:39:52 GMT</pubDate></item><item><title><![CDATA[Reply to How to get a screenshot in Android? on Wed, 31 Jul 2019 16:38:19 GMT]]></title><description><![CDATA[<p dir="auto">Maybe you can use it?</p>
<p dir="auto">foreach(QObject* obj, engine.rootObjects()) {<br />
QQuickWindow* window = qobject_cast&lt;QQuickWindow*&gt;(obj);<br />
if (window) {<br />
QImage image = window-&gt;grabWindow();<br />
qDebug() &lt;&lt; image;<br />
}<br />
}</p>
]]></description><link>https://forum.qt.io/post/543973</link><guid isPermaLink="true">https://forum.qt.io/post/543973</guid><dc:creator><![CDATA[Mikeeeeee]]></dc:creator><pubDate>Wed, 31 Jul 2019 16:38:19 GMT</pubDate></item><item><title><![CDATA[Reply to How to get a screenshot in Android? on Wed, 31 Jul 2019 16:36:26 GMT]]></title><description><![CDATA[<p dir="auto">This all code</p>
<pre><code>QQuickWindow* currentWindow = qobject_cast&lt;QQuickWindow*&gt;(QGuiApplication::focusWindow());
</code></pre>
<p dir="auto">//    if(!currentWindow)<br />
//        return;<br />
QScreen* screen = currentWindow-&gt;screen();<br />
//    if(!screen)<br />
//        return;<br />
//QRect screenGeometry = fullScreen ? screen-&gt;geometry() : currentWindow-&gt;geometry();<br />
/* QRect screenGeometry = fullScreen ? screen-&gt;geometry() : currentWindow-&gt;geometry();<br />
auto pm = screen-&gt;grabWindow(0, screenGeometry.x(), screenGeometry.y(), screenGeometry.width(), screenGeometry.height());</p>
<pre><code>QByteArray bArray;
QBuffer buffer(&amp;bArray);
buffer.open(QIODevice::WriteOnly);
pm.save(&amp;buffer, "PNG");*/



QImage myScreen;
//QPixmap pic = QPixmap::grabWindow(QWidget::winId(),0,0,50,50);
//qDebug()&lt;&lt;QWidget::winId();
</code></pre>
<p dir="auto">//    QScreen *screen = QGuiApplication::primaryScreen();<br />
QPixmap pixamp;<br />
pixamp = screen-&gt;grabWindow(0);<br />
myScreen = pixamp.toImage();<br />
//myScreen = QPixmap::grabWindow();<br />
//myScreen = quickView-&gt;grabWindow();<br />
<a href="//myScreen.save" target="_blank" rel="noopener noreferrer nofollow ugc">//myScreen.save</a>("C:\Users\New Owner\Downloads\i.png");<br />
QByteArray bArray;<br />
QBuffer buffer(&amp;bArray);<br />
buffer.open(QIODevice::WriteOnly);<br />
<a href="//myScreen.save" target="_blank" rel="noopener noreferrer nofollow ugc">//myScreen.save</a>(&amp;buffer, "JPEG");<br />
//QString image("data:image/jpg;base64,");<br />
myScreen.save(&amp;buffer, "PNG");<br />
QString image("data:image/png;base64,");<br />
image.append(QString::fromLatin1(bArray.toBase64().data()));<br />
qDebug()&lt;&lt;"screenShot:"&lt;&lt;image;<br />
return image;</p>
]]></description><link>https://forum.qt.io/post/543972</link><guid isPermaLink="true">https://forum.qt.io/post/543972</guid><dc:creator><![CDATA[Mikeeeeee]]></dc:creator><pubDate>Wed, 31 Jul 2019 16:36:26 GMT</pubDate></item><item><title><![CDATA[Reply to How to get a screenshot in Android? on Wed, 31 Jul 2019 16:34:44 GMT]]></title><description><![CDATA[<p dir="auto">This piece of code doesn't work either. I put in my code that converts QScreen to QByteArray. QByteArray is empty.</p>
<pre><code>QQuickWindow* currentWindow = qobject_cast&lt;QQuickWindow*&gt;(QGuiApplication::focusWindow());
//    if(!currentWindow)
//        return;
     QScreen* screen = currentWindow-&gt;screen();
</code></pre>
]]></description><link>https://forum.qt.io/post/543971</link><guid isPermaLink="true">https://forum.qt.io/post/543971</guid><dc:creator><![CDATA[Mikeeeeee]]></dc:creator><pubDate>Wed, 31 Jul 2019 16:34:44 GMT</pubDate></item><item><title><![CDATA[Reply to How to get a screenshot in Android? on Wed, 31 Jul 2019 16:24:08 GMT]]></title><description><![CDATA[<p dir="auto">I get error:use of undeclared identifier 'fullScreen'</p>
]]></description><link>https://forum.qt.io/post/543968</link><guid isPermaLink="true">https://forum.qt.io/post/543968</guid><dc:creator><![CDATA[Mikeeeeee]]></dc:creator><pubDate>Wed, 31 Jul 2019 16:24:08 GMT</pubDate></item></channel></rss>