<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Forum Pasja Informatyki - Najnowsze z tagiem #android</title>
<link>https://forum.pasja-informatyki.pl/tag/%23android</link>
<description>Powered by Question2Answer</description>
<item>
<title>Parsowanie PDF w Android (Java)</title>
<link>https://forum.pasja-informatyki.pl/285205/parsowanie-pdf-w-android-java</link>
<description>

&lt;p&gt;Witam. Piszę aplikację do wyświetlania rozkładów jazdy autobosów MPK z mojego miasta. Po pobraniu pliku PDF z rozkładem jazdy parsuję go do postaci tekstu za pomocą biblioteki Apache PDFBox. Problem w tym, że nie do końca ogarniam tę bibliotekę i to co dostaję w rezultacie wygląda tak.&lt;/p&gt;



&lt;p&gt;&lt;a href=&quot;https://pastebin.com/sz7w6vuC&quot; rel=&quot;nofollow&quot;&gt;PDF po parsowaniu &lt;/a&gt;&lt;/p&gt;



&lt;p&gt;Tutaj oryginalny PDF.&lt;/p&gt;



&lt;p&gt;&lt;a href=&quot;http://www.mpklomza.pl/images/HT/miejskie/53.pdf&quot; rel=&quot;nofollow&quot;&gt;PDF&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;Jak wydzielić z tego kolumny i wiersze? Problem jest także z tym, że numery autobusów nie są parsowane.&lt;/p&gt;



&lt;p&gt;Może istnieje inny, lepszy sposób, aby to zrobić?&amp;nbsp;&lt;/p&gt;</description>
<category>Java</category>
<guid isPermaLink="true">https://forum.pasja-informatyki.pl/285205/parsowanie-pdf-w-android-java</guid>
<pubDate>Wed, 13 Sep 2017 10:23:45 +0000</pubDate>
</item>
<item>
<title>Jak zebrać dane,aby na podstawie tego wygenerował się graf ?</title>
<link>https://forum.pasja-informatyki.pl/225949/jak-zebrac-dane-aby-na-podstawie-tego-wygenerowal-sie-graf</link>
<description>Witam wszystkich,&lt;br /&gt;
Tworzę aplikację na Androida i w niej też chciałbym zamieścić diagram, który wygeneruje się na podstawie zebranych danych. Jak to zrobić ? Jak zebrać dane i wygenerować diagram ? &amp;nbsp;Dodam,że chciałbym,aby na tym grafie były pokazane postępy ... (Health aplikacja)&lt;br /&gt;
&lt;br /&gt;
Z góry dziękuję.</description>
<category>Android, Swift, Symbian</category>
<guid isPermaLink="true">https://forum.pasja-informatyki.pl/225949/jak-zebrac-dane-aby-na-podstawie-tego-wygenerowal-sie-graf</guid>
<pubDate>Sat, 11 Feb 2017 16:47:30 +0000</pubDate>
</item>
<item>
<title>pomoc,android,java,programowanie</title>
<link>https://forum.pasja-informatyki.pl/181388/pomoc-android-java-programowanie</link>
<description>Jakie polecacie książki do nauki androida i javy</description>
<category>Java</category>
<guid isPermaLink="true">https://forum.pasja-informatyki.pl/181388/pomoc-android-java-programowanie</guid>
<pubDate>Thu, 22 Sep 2016 13:57:25 +0000</pubDate>
</item>
<item>
<title>Android polaczenie jdbc z serwerem ms sql co jest nie tak?</title>
<link>https://forum.pasja-informatyki.pl/164152/android-polaczenie-jdbc-z-serwerem-ms-sql-co-jest-nie-tak</link>
<description>

&lt;p&gt;Witam. Muszę chcę napisać aplikacje która połączy się z serwerem ms sql. Znalazłem na youtube ten kod i problem polega na tym, że cały czas gdy próbuję się połączyć dostaje komunikat &quot;Check Your Internet Access!&quot;.&lt;/p&gt;



&lt;p&gt;Baza jest udostępniona poprawnie ponieważ bez problemu łączę się z nią poprzez sql developer na innym komputerze.&lt;/p&gt;



&lt;pre class=&quot;brush:java;&quot;&gt;
 import android.annotation.SuppressLint;
    import android.content.Intent;
    import android.graphics.Bitmap;
    import android.graphics.BitmapFactory;
    import android.graphics.drawable.BitmapDrawable;
    import android.net.Uri;
    import android.os.AsyncTask;
    import android.os.Environment;
    import android.os.StrictMode;
    import android.provider.MediaStore;
    import android.support.v7.app.ActionBarActivity;
    import android.os.Bundle;
    import android.util.AndroidRuntimeException;
    import android.util.Base64;
    import android.util.Log;
    import android.view.View;
    import android.widget.Button;
    import android.widget.ImageView;
    import android.widget.ProgressBar;
    import android.widget.Toast;

    import java.io.ByteArrayOutputStream;
    import java.io.FileNotFoundException;
    import java.io.IOError;
    import java.io.InputStream;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.SQLException;

    /*
        This source code could be used for academic purposes only. Posting on other websites or blogs is only allowed with a dofollow link to the orignal content.
    */


    public class MainActivity extends ActionBarActivity
    {

        // Declaring Layouts buttons, imageview extra
        private static final int RESULT_LOAD_IMAGE = 1;
        Button uploadpic;
        ImageView imagebox;
        ProgressBar progressBar;
        // End Layouts buttons, imageview extra

        // Declaring connection variables and array,string to store data in them
        byte[] byteArray;
        String encodedImage;

        Connection con;
        String un,ip,db,password;
        // End Declaring connection variables and array,string to store data in them

        @Override
        protected void onCreate(Bundle savedInstanceState)
        {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);

            // Finding the declared layouts
            uploadpic = (Button) findViewById(R.id.button);
            progressBar = (ProgressBar) findViewById(R.id.progressBar);
            imagebox = (ImageView) findViewById(R.id.imageView);
            //End  Finding the declared layouts

            // Declaring connectivity credentials
            ip = &quot;your server ip here&quot;;
            db = &quot;your database name here&quot;;
            un = &quot;your username for that database here&quot;;
            password = &quot;your password for that database here&quot;;
            // End Declaring connectivity credentials

            progressBar.setVisibility(View.GONE);

            uploadpic.setOnClickListener(new View.OnClickListener()
            {
                @Override
                public void onClick(View v)
                {
                    // Opening the Gallery and selecting media
                    if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)&amp;amp;&amp;amp; !Environment.getExternalStorageState().equals(Environment.MEDIA_CHECKING))
                    {
                        Intent galleryIntent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
                        startActivityForResult(galleryIntent,RESULT_LOAD_IMAGE );
                        // this will jump to onActivity Function after selecting image
                    }
                    else
                    {
                        Toast.makeText(MainActivity.this, &quot;No activity found to perform this task&quot;, Toast.LENGTH_SHORT).show();
                    }
                    // End Opening the Gallery and selecting media
                }
            });
        }

        @Override
        protected void onActivityResult(int requestCode, int resultCode, Intent data)
        {
            super.onActivityResult(requestCode, resultCode, data);
            if (requestCode == RESULT_LOAD_IMAGE &amp;amp;&amp;amp; resultCode == RESULT_OK  &amp;amp;&amp;amp; null != data)
            {
                // getting the selected image, setting in imageview and converting it to byte and base 64
                progressBar.setVisibility(View.VISIBLE);
                Bitmap originBitmap = null;
                Uri selectedImage = data.getData();
                Toast.makeText(MainActivity.this, selectedImage.toString(), Toast.LENGTH_LONG).show();
                InputStream imageStream;
                try
                {
                    imageStream = getContentResolver().openInputStream(selectedImage);
                    originBitmap = BitmapFactory.decodeStream(imageStream);
                }
                catch (FileNotFoundException e)
                {
                   System.out.println(e.getMessage().toString());
                }
                if (originBitmap != null)
                {
                    this.imagebox.setImageBitmap(originBitmap);
                    Log.w(&quot;Image Setted in&quot;, &quot;Done Loading Image&quot;);
                    try
                    {
                        Bitmap image = ((BitmapDrawable) imagebox.getDrawable()).getBitmap();
                        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
                        image.compress(Bitmap.CompressFormat.JPEG, 90, byteArrayOutputStream);
                        byteArray = byteArrayOutputStream.toByteArray();
                        encodedImage = Base64.encodeToString(byteArray, Base64.DEFAULT);
                        // Calling the background process so that application wont slow down
                        UploadImage uploadImage = new UploadImage();
                        uploadImage.execute(&quot;&quot;);
                        //End Calling the background process so that application wont slow down
                    }
                    catch (Exception e)
                    {
                        Log.w(&quot;OOooooooooo&quot;,&quot;exception&quot;);
                    }
                    Toast.makeText(MainActivity.this, &quot;Conversion Done&quot;,Toast.LENGTH_SHORT).show();
                }
                // End getting the selected image, setting in imageview and converting it to byte and base 64
            }
            else
            {
                System.out.println(&quot;Error Occured&quot;);
            }
        }

        public class UploadImage extends AsyncTask&amp;lt;String,String,String&amp;gt;
        {
            @Override
            protected void onPostExecute(String r)
            {
                // After successful insertion of image
                progressBar.setVisibility(View.GONE);
                Toast.makeText(MainActivity.this , &quot;Image Inserted Succesfully&quot; , Toast.LENGTH_LONG).show();
                // End After successful insertion of image
            }
            @Override
            protected String doInBackground(String... params)
            {
                // Inserting in the database
                String msg = &quot;unknown&quot;;
                try
                {
                    con = connectionclass(un, password, db, ip);
                    String commands = &quot;Insert into MYIMAGE (picture) values ('&quot; + encodedImage + &quot;')&quot;;
                    PreparedStatement preStmt = con.prepareStatement(commands);
                    preStmt.executeUpdate();
                    msg = &quot;Inserted Successfully&quot;;
                }
                catch (SQLException ex)
                {
                    msg = ex.getMessage().toString();
                    Log.d(&quot;Error no 1:&quot;, msg);
                }
                catch (IOError ex)
                {
                    msg = ex.getMessage().toString();
                    Log.d(&quot;Error no 2:&quot;, msg);
                }
                catch (AndroidRuntimeException ex)
                {
                    msg = ex.getMessage().toString();
                    Log.d(&quot;Error no 3:&quot;, msg);
                }
                catch (NullPointerException ex)
                {
                    msg = ex.getMessage().toString();
                    Log.d(&quot;Error no 4:&quot;, msg);
                }
                catch (Exception ex)
                {
                    msg = ex.getMessage().toString();
                    Log.d(&quot;Error no 5:&quot;, msg);
                }
                System.out.println(msg);
                return &quot;&quot;;
                //End Inserting in the database
            }
        }



        @SuppressLint(&quot;NewApi&quot;)
        public Connection connectionclass(String user, String password, String database, String server)
        {
            StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
            StrictMode.setThreadPolicy(policy);
            Connection connection = null;
            String ConnectionURL = null;
            try
            {
                Class.forName(&quot;net.sourceforge.jtds.jdbc.Driver&quot;);
                ConnectionURL = &quot;jdbc:jtds:sqlserver://&quot; + server+ database + &quot;;user=&quot; + user + &quot;;password=&quot; + password + &quot;;&quot;;
                connection = DriverManager.getConnection(ConnectionURL);
            }
            catch (SQLException se)
            {
                Log.e(&quot;error no 1&quot;, se.getMessage());
            }
            catch (ClassNotFoundException e)
            {
                Log.e(&quot;error no 2&quot;, e.getMessage());
            }
            catch (Exception e)
            {
                Log.e(&quot;error no 3&quot;, e.getMessage());
            }
            return connection;
        }
    }&lt;/pre&gt;



&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description>
<category>Android, Swift, Symbian</category>
<guid isPermaLink="true">https://forum.pasja-informatyki.pl/164152/android-polaczenie-jdbc-z-serwerem-ms-sql-co-jest-nie-tak</guid>
<pubDate>Mon, 01 Aug 2016 17:19:08 +0000</pubDate>
</item>
</channel>
</rss>