<?xml version='1.0' encoding="utf-8"?>
      <rss version='2.0'>
      <channel>
      <title>Форум на Исходниках.RU</title>
      <link>https://forum.sources.ru</link>
      <description>Форум на Исходниках.RU</description>
      <generator>Форум на Исходниках.RU</generator>
  	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=421208&amp;view=findpost&amp;p=3844971</guid>
        <pubDate>Thu, 25 Feb 2021 12:04:53 +0000</pubDate>
        <title>Скриншот и сохранение</title>
        <link>https://forum.sources.ru/index.php?showtopic=421208&amp;view=findpost&amp;p=3844971</link>
        <description><![CDATA[Vashnaemnik: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=421208&view=findpost&p=3844966'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Gonarh &#064; <time class="tag-quote__quoted-time" datetime="2021-02-25T03:53:35+03:00">25.02.21, 00:53</time></span><div class='quote '></div></div><br>
Спасибо.<br>
Пересмотрел свой подход. Лучше все таки сделать пдф файл.]]></description>
        <author>Vashnaemnik</author>
        <category>Android</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=421208&amp;view=findpost&amp;p=3844966</guid>
        <pubDate>Thu, 25 Feb 2021 00:53:35 +0000</pubDate>
        <title>Скриншот и сохранение</title>
        <link>https://forum.sources.ru/index.php?showtopic=421208&amp;view=findpost&amp;p=3844966</link>
        <description><![CDATA[Gonarh: Потому что смотри логи, но для начала замени<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;} catch (FileNotFoundException e) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Log.e(&quot;GREC&quot;, e.getMessage(), e);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;} catch (IOException e) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Log.e(&quot;GREC&quot;, e.getMessage(), e);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div></ol></div></div></div></div><script>preloadCodeButtons('1');</script><br>
На<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;} catch (Exception e) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Log.e(&quot;GREC&quot;, e.getMessage(), e);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div></ol></div></div></div></div><br>
Вангую за отсутствие прав на запись]]></description>
        <author>Gonarh</author>
        <category>Android</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=421208&amp;view=findpost&amp;p=3844962</guid>
        <pubDate>Wed, 24 Feb 2021 22:05:44 +0000</pubDate>
        <title>Скриншот и сохранение</title>
        <link>https://forum.sources.ru/index.php?showtopic=421208&amp;view=findpost&amp;p=3844962</link>
        <description><![CDATA[Vashnaemnik: Добрый вечер. Подскажите.<br>
Делаю скриншот экрана:<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">public Bitmap takeScreenshot() {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;View rootView = findViewById(android.R.id.content).getRootView();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;rootView.setDrawingCacheEnabled(true);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;return rootView.getDrawingCache();</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div></ol></div></div></div></div><br>
Далее сохраняю скриншот:<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">private void saveBitmap(Bitmap bitmap) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;File imagePath = new File(Environment.getExternalStorageDirectory() + &quot;/screenshot.jpeg&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;FileOutputStream fos;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;try {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fos = new FileOutputStream(imagePath);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fos);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fos.flush();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fos.close();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;} catch (FileNotFoundException e) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Log.e(&quot;GREC&quot;, e.getMessage(), e);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;} catch (IOException e) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Log.e(&quot;GREC&quot;, e.getMessage(), e);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div></ol></div></div></div></div><br>
все это происходит по нажатию кнопки:<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">else if (id == R.id.print) {</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Bitmap bitmap = takeScreenshot();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;saveBitmap(bitmap);</div></ol></div></div></div></div><br>
Но я не вижу сохраненного файла. Почему?]]></description>
        <author>Vashnaemnik</author>
        <category>Android</category>
      </item>
	
      </channel>
      </rss>
	