ProgressDialog does not work

Basic Tutorials concerning: GUI, Views, Activites, XML, Layouts, Intents, ...

ProgressDialog does not work

Postby Pogio » Tue Feb 09, 2010 7:59 pm

Does not seem to operate the ProgressDialog should go away after the loaded content, however remains them!

can you help me?

This is the code:



Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. package Oroscopo.grg;
  3.  
  4.  
  5.  
  6. import java.io.IOException;
  7.  
  8. import java.io.InputStream;
  9.  
  10. import java.io.InputStreamReader;
  11.  
  12. import java.net.HttpURLConnection;
  13.  
  14. import java.net.URL;
  15.  
  16. import java.net.URLConnection;
  17.  
  18. import android.app.ProgressDialog;
  19.  
  20. import android.app.Activity;
  21.  
  22. import android.graphics.Bitmap;
  23.  
  24. import android.graphics.BitmapFactory;
  25.  
  26. import android.os.Bundle;
  27.  
  28. import android.widget.ImageView;
  29.  
  30. import android.widget.TextView;
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38. public class arietesett extends Activity {
  39.  
  40.     /** Called when the activity is first created. */
  41.  
  42.    
  43.  
  44.         protected ProgressDialog myProgressDialog;
  45.  
  46.        
  47.  
  48.        
  49.  
  50.  
  51.  
  52.         @Override
  53.  
  54.     public void onCreate(Bundle savedInstanceState) {
  55.  
  56.         super.onCreate(savedInstanceState);
  57.  
  58.         setContentView(R.layout.fuocosett);
  59.  
  60.        
  61.  
  62.         /* Show a progress-bar */
  63.  
  64.         myProgressDialog = ProgressDialog.show(arietesett.this,
  65.  
  66.                   "Please wait...", "Doing Extreme Calculations...", true);
  67.  
  68.         new Thread() {
  69.  
  70.              public void run() {
  71.  
  72.        
  73.  
  74.        
  75.  
  76.     Bitmap bitmap =
  77.  
  78.         DownloadImage("http://www.moongate.it/oroscopo/arietesett.png");
  79.  
  80.     ImageView img = (ImageView) findViewById(R.id.img);
  81.  
  82.     img.setImageBitmap(bitmap);
  83.  
  84.    
  85.  
  86.    
  87.  
  88.     Bitmap bitmap1 =
  89.  
  90.         DownloadImage1("http://www.moongate.it/oroscopo/arietetext.png");
  91.  
  92.     ImageView imgt = (ImageView) findViewById(R.id.imgt);
  93.  
  94.     imgt.setImageBitmap(bitmap1);
  95.  
  96.    
  97.  
  98.     /*String str =
  99.  
  100.         DownloadText("http://www.moongate.it/oroscopo/ariete.txt");
  101.  
  102.     TextView txt = (TextView) findViewById(R.id.text);
  103.  
  104.     txt.setText(str);
  105.  
  106.     */
  107.  
  108.    
  109.  
  110.     String str1 =
  111.  
  112.         DownloadText1("http://www.moongate.it/oroscopo/data.txt");
  113.  
  114.     TextView txt1 = (TextView) findViewById(R.id.data);
  115.  
  116.     txt1.setText(str1);
  117.  
  118.  
  119.  
  120.    
  121.  
  122. }
  123.  
  124.                  
  125.  
  126.             };
  127.  
  128.         }
  129.  
  130.        
  131.  
  132.     private InputStream OpenHttpConnection(String urlString)
  133.  
  134.     throws IOException
  135.  
  136.     {
  137.  
  138.         InputStream in = null;
  139.  
  140.         int response = -1;
  141.  
  142.                
  143.  
  144.         URL url = new URL(urlString);
  145.  
  146.         URLConnection conn = url.openConnection();
  147.  
  148.                  
  149.  
  150.         if (!(conn instanceof HttpURLConnection))                    
  151.  
  152.             throw new IOException("Not an HTTP connection");
  153.  
  154.        
  155.  
  156.         try{
  157.  
  158.             HttpURLConnection httpConn = (HttpURLConnection) conn;
  159.  
  160.             httpConn.setAllowUserInteraction(false);
  161.  
  162.             httpConn.setInstanceFollowRedirects(true);
  163.  
  164.             httpConn.setRequestMethod("GET");
  165.  
  166.             httpConn.connect();
  167.  
  168.  
  169.  
  170.             response = httpConn.getResponseCode();                
  171.  
  172.             if (response == HttpURLConnection.HTTP_OK) {
  173.  
  174.                 in = httpConn.getInputStream();                                
  175.  
  176.             }                    
  177.  
  178.         }
  179.  
  180.         catch (Exception ex)
  181.  
  182.         {
  183.  
  184.             throw new IOException("Error connecting");            
  185.  
  186.         }
  187.  
  188.         return in;    
  189.  
  190.     }
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.    
  199.  
  200.  
  201.  
  202.     private Bitmap DownloadImage(String URL)
  203.  
  204.     {        
  205.  
  206.         Bitmap bitmap = null;
  207.  
  208.         InputStream in = null;        
  209.  
  210.         try {
  211.  
  212.             in = OpenHttpConnection(URL);
  213.  
  214.             bitmap = BitmapFactory.decodeStream(in);
  215.  
  216.             in.close();
  217.  
  218.         } catch (IOException e1) {
  219.  
  220.             // TODO Auto-generated catch block
  221.  
  222.             e1.printStackTrace();
  223.  
  224.         }
  225.  
  226.         return bitmap;                
  227.  
  228.     }
  229.  
  230.    
  231.  
  232.     private Bitmap DownloadImage1(String URL)
  233.  
  234.     {        
  235.  
  236.         Bitmap bitmap = null;
  237.  
  238.         InputStream in = null;        
  239.  
  240.         try {
  241.  
  242.             in = OpenHttpConnection(URL);
  243.  
  244.             bitmap = BitmapFactory.decodeStream(in);
  245.  
  246.             in.close();
  247.  
  248.         } catch (IOException e1) {
  249.  
  250.             // TODO Auto-generated catch block
  251.  
  252.             e1.printStackTrace();
  253.  
  254.         }
  255.  
  256.         return bitmap;                
  257.  
  258.     }
  259.  
  260.    
  261.  
  262.     /*private String DownloadText(String URL)
  263.  
  264.     {
  265.  
  266.         int BUFFER_SIZE = 2000;
  267.  
  268.         InputStream in = null;
  269.  
  270.        
  271.  
  272.         try {
  273.  
  274.             in = OpenHttpConnection(URL);
  275.  
  276.         } catch (IOException e1) {
  277.  
  278.             // TODO Auto-generated catch block
  279.  
  280.             e1.printStackTrace();
  281.  
  282.             return "";
  283.  
  284.         }
  285.  
  286.        
  287.  
  288.         InputStreamReader isr = new InputStreamReader(in);
  289.  
  290.         int charRead;
  291.  
  292.           String str = "";
  293.  
  294.           char[] inputBuffer = new char[BUFFER_SIZE];          
  295.  
  296.         try {
  297.  
  298.             while ((charRead = isr.read(inputBuffer))>0)
  299.  
  300.             {                    
  301.  
  302.                 //---convert the chars to a String---
  303.  
  304.                 String readString =
  305.  
  306.                     String.copyValueOf(inputBuffer, 0, charRead);                    
  307.  
  308.                 str += readString;
  309.  
  310.                 inputBuffer = new char[BUFFER_SIZE];
  311.  
  312.             }
  313.  
  314.             in.close();
  315.  
  316.         } catch (IOException e) {
  317.  
  318.             // TODO Auto-generated catch block
  319.  
  320.             e.printStackTrace();
  321.  
  322.             return "";
  323.  
  324.         }    
  325.  
  326.         return str;
  327.  
  328.        
  329.  
  330.     } */
  331.  
  332.  
  333.  
  334.     private String DownloadText1(String URL)
  335.  
  336.     {
  337.  
  338.         int BUFFER_SIZE = 2000;
  339.  
  340.         InputStream in = null;
  341.  
  342.        
  343.  
  344.         try {
  345.  
  346.             in = OpenHttpConnection(URL);
  347.  
  348.         } catch (IOException e1) {
  349.  
  350.             // TODO Auto-generated catch block
  351.  
  352.             e1.printStackTrace();
  353.  
  354.             return "";
  355.  
  356.         }
  357.  
  358.        
  359.  
  360.         InputStreamReader isr = new InputStreamReader(in);
  361.  
  362.         int charRead;
  363.  
  364.           String str1 = "";
  365.  
  366.           char[] inputBuffer = new char[BUFFER_SIZE];          
  367.  
  368.         try {
  369.  
  370.             while ((charRead = isr.read(inputBuffer))>0)
  371.  
  372.             {                    
  373.  
  374.                 //---convert the chars to a String---
  375.  
  376.                 String readString =
  377.  
  378.                     String.copyValueOf(inputBuffer, 0, charRead);                    
  379.  
  380.                 str1 += readString;
  381.  
  382.                 inputBuffer = new char[BUFFER_SIZE];
  383.  
  384.             }
  385.  
  386.             in.close();
  387.  
  388.         } catch (IOException e) {
  389.  
  390.             // TODO Auto-generated catch block
  391.  
  392.             e.printStackTrace();
  393.  
  394.             return "";
  395.  
  396.         }    
  397.  
  398.         return str1;
  399.  
  400.        
  401.  
  402.     }
  403.  
  404.  
  405.  
  406.  
  407.  
  408.    
  409.  
  410. }
  411.  
  412.  
Parsed in 0.052 seconds, using GeSHi 1.0.8.4
Pogio
Freshman
Freshman
 
Posts: 9
Joined: Fri Jan 22, 2010 3:02 pm

Top

Postby mitutitu » Tue Feb 09, 2010 9:14 pm

Hello Pogio,

At first I should say that your thread is not correct. You created it but not started. And you can't dismiss your progress dialog when you even don't know from where your thread control should be taken by yourself. And to get the control back of this thread you are badly in need of a Handler object. So here your modified code looks like :


Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. package Oroscopo.grg;
  2.  
  3.  
  4.  
  5. import java.io.IOException;
  6.  
  7. import java.io.InputStream;
  8.  
  9. import java.io.InputStreamReader;
  10.  
  11. import java.net.HttpURLConnection;
  12.  
  13. import java.net.URL;
  14.  
  15. import java.net.URLConnection;
  16.  
  17. import android.app.ProgressDialog;
  18.  
  19. import android.app.Activity;
  20.  
  21. import android.graphics.Bitmap;
  22.  
  23. import android.graphics.BitmapFactory;
  24.  
  25. import android.os.Bundle;
  26.  
  27. import android.widget.ImageView;
  28.  
  29. import android.widget.TextView;
  30.  
  31.  
  32.  
  33. import android.os.Handler;  //this is import for handler object
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41. public class arietesett extends Activity {
  42.  
  43.     /** Called when the activity is first created. */
  44.  
  45.    
  46.  
  47.      protected ProgressDialog myProgressDialog;
  48.  
  49.  
  50.  
  51.     @Override
  52.  
  53.     public void onCreate(Bundle savedInstanceState) {
  54.  
  55.         super.onCreate(savedInstanceState);
  56.  
  57.         setContentView(R.layout.fuocosett);
  58.  
  59.        
  60.  
  61.         /* Show a progress-bar */
  62.  
  63.         myProgressDialog = ProgressDialog.show(arietesett.this,
  64.  
  65.                   "Please wait...", "Doing Extreme Calculations...", true);
  66.  
  67.         new Thread() {
  68.  
  69.              public void run() {
  70.  
  71.        
  72.  
  73.        
  74.  
  75.     Bitmap bitmap =
  76.  
  77.         DownloadImage("http://www.moongate.it/oroscopo/arietesett.png");
  78.  
  79.     ImageView img = (ImageView) findViewById(R.id.img);
  80.  
  81.     img.setImageBitmap(bitmap);
  82.  
  83.    
  84.  
  85.    
  86.  
  87.     Bitmap bitmap1 =
  88.  
  89.         DownloadImage1("http://www.moongate.it/oroscopo/arietetext.png");
  90.  
  91.     ImageView imgt = (ImageView) findViewById(R.id.imgt);
  92.  
  93.     imgt.setImageBitmap(bitmap1);
  94.  
  95.    
  96.  
  97.     /*String str =
  98.  
  99.         DownloadText("http://www.moongate.it/oroscopo/ariete.txt");
  100.  
  101.     TextView txt = (TextView) findViewById(R.id.text);
  102.  
  103.     txt.setText(str);
  104.  
  105.     */
  106.  
  107.    
  108.  
  109.     String str1 =
  110.  
  111.         DownloadText1("http://www.moongate.it/oroscopo/data.txt");
  112.  
  113.     TextView txt1 = (TextView) findViewById(R.id.data);
  114.  
  115.     txt1.setText(str1);
  116.  
  117.  
  118.  
  119. handler.sendEmptyMessage(0); //Here thread execution is finished and control transferred to the handler object
  120.  
  121.    
  122.  
  123. }
  124.  
  125.                  
  126.  
  127.             }.start(); // if you write annonymous class for Thread object creation you should start thread like this
  128.  
  129.         }
  130.  
  131.      
  132.  
  133.  
  134.  
  135.  private Handler handler = new Handler() {
  136.  
  137.                 @Override
  138.  
  139.                 public void handleMessage(Message msg) {
  140.  
  141.                         super.handleMessage(msg);
  142.  
  143.                 myProgressDialog.dismiss(); // here your progress dialog is dismissed indicating process is finished
  144.  
  145.               // Here you can write other processing code if you want
  146.  
  147.                     }
  148.  
  149.              };
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157. }
  158.  
  159.  
  160.  
  161.     private InputStream OpenHttpConnection(String urlString)
  162.  
  163.     throws IOException
  164.  
  165.     {
  166.  
  167.         InputStream in = null;
  168.  
  169.         int response = -1;
  170.  
  171.                
  172.  
  173.         URL url = new URL(urlString);
  174.  
  175.         URLConnection conn = url.openConnection();
  176.  
  177.                  
  178.  
  179.         if (!(conn instanceof HttpURLConnection))                    
  180.  
  181.             throw new IOException("Not an HTTP connection");
  182.  
  183.        
  184.  
  185.         try{
  186.  
  187.             HttpURLConnection httpConn = (HttpURLConnection) conn;
  188.  
  189.             httpConn.setAllowUserInteraction(false);
  190.  
  191.             httpConn.setInstanceFollowRedirects(true);
  192.  
  193.             httpConn.setRequestMethod("GET");
  194.  
  195.             httpConn.connect();
  196.  
  197.  
  198.  
  199.             response = httpConn.getResponseCode();                
  200.  
  201.             if (response == HttpURLConnection.HTTP_OK) {
  202.  
  203.                 in = httpConn.getInputStream();                                
  204.  
  205.             }                    
  206.  
  207.         }
  208.  
  209.         catch (Exception ex)
  210.  
  211.         {
  212.  
  213.             throw new IOException("Error connecting");            
  214.  
  215.         }
  216.  
  217.         return in;    
  218.  
  219.     }
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.    
  228.  
  229.  
  230.  
  231.     private Bitmap DownloadImage(String URL)
  232.  
  233.     {        
  234.  
  235.         Bitmap bitmap = null;
  236.  
  237.         InputStream in = null;        
  238.  
  239.         try {
  240.  
  241.             in = OpenHttpConnection(URL);
  242.  
  243.             bitmap = BitmapFactory.decodeStream(in);
  244.  
  245.             in.close();
  246.  
  247.         } catch (IOException e1) {
  248.  
  249.             // TODO Auto-generated catch block
  250.  
  251.             e1.printStackTrace();
  252.  
  253.         }
  254.  
  255.         return bitmap;                
  256.  
  257.     }
  258.  
  259.    
  260.  
  261.     private Bitmap DownloadImage1(String URL)
  262.  
  263.     {        
  264.  
  265.         Bitmap bitmap = null;
  266.  
  267.         InputStream in = null;        
  268.  
  269.         try {
  270.  
  271.             in = OpenHttpConnection(URL);
  272.  
  273.             bitmap = BitmapFactory.decodeStream(in);
  274.  
  275.             in.close();
  276.  
  277.         } catch (IOException e1) {
  278.  
  279.             // TODO Auto-generated catch block
  280.  
  281.             e1.printStackTrace();
  282.  
  283.         }
  284.  
  285.         return bitmap;                
  286.  
  287.     }
  288.  
  289.    
  290.  
  291.     /*private String DownloadText(String URL)
  292.  
  293.     {
  294.  
  295.         int BUFFER_SIZE = 2000;
  296.  
  297.         InputStream in = null;
  298.  
  299.        
  300.  
  301.         try {
  302.  
  303.             in = OpenHttpConnection(URL);
  304.  
  305.         } catch (IOException e1) {
  306.  
  307.             // TODO Auto-generated catch block
  308.  
  309.             e1.printStackTrace();
  310.  
  311.             return "";
  312.  
  313.         }
  314.  
  315.        
  316.  
  317.         InputStreamReader isr = new InputStreamReader(in);
  318.  
  319.         int charRead;
  320.  
  321.           String str = "";
  322.  
  323.           char[] inputBuffer = new char[BUFFER_SIZE];          
  324.  
  325.         try {
  326.  
  327.             while ((charRead = isr.read(inputBuffer))>0)
  328.  
  329.             {                    
  330.  
  331.                 //---convert the chars to a String---
  332.  
  333.                 String readString =
  334.  
  335.                     String.copyValueOf(inputBuffer, 0, charRead);                    
  336.  
  337.                 str += readString;
  338.  
  339.                 inputBuffer = new char[BUFFER_SIZE];
  340.  
  341.             }
  342.  
  343.             in.close();
  344.  
  345.         } catch (IOException e) {
  346.  
  347.             // TODO Auto-generated catch block
  348.  
  349.             e.printStackTrace();
  350.  
  351.             return "";
  352.  
  353.         }    
  354.  
  355.         return str;
  356.  
  357.        
  358.  
  359.     } */
  360.  
  361.  
  362.  
  363.     private String DownloadText1(String URL)
  364.  
  365.     {
  366.  
  367.         int BUFFER_SIZE = 2000;
  368.  
  369.         InputStream in = null;
  370.  
  371.        
  372.  
  373.         try {
  374.  
  375.             in = OpenHttpConnection(URL);
  376.  
  377.         } catch (IOException e1) {
  378.  
  379.             // TODO Auto-generated catch block
  380.  
  381.             e1.printStackTrace();
  382.  
  383.             return "";
  384.  
  385.         }
  386.  
  387.        
  388.  
  389.         InputStreamReader isr = new InputStreamReader(in);
  390.  
  391.         int charRead;
  392.  
  393.           String str1 = "";
  394.  
  395.           char[] inputBuffer = new char[BUFFER_SIZE];          
  396.  
  397.         try {
  398.  
  399.             while ((charRead = isr.read(inputBuffer))>0)
  400.  
  401.             {                    
  402.  
  403.                 //---convert the chars to a String---
  404.  
  405.                 String readString =
  406.  
  407.                     String.copyValueOf(inputBuffer, 0, charRead);                    
  408.  
  409.                 str1 += readString;
  410.  
  411.                 inputBuffer = new char[BUFFER_SIZE];
  412.  
  413.             }
  414.  
  415.             in.close();
  416.  
  417.         } catch (IOException e) {
  418.  
  419.             // TODO Auto-generated catch block
  420.  
  421.             e.printStackTrace();
  422.  
  423.             return "";
  424.  
  425.         }    
  426.  
  427.         return str1;
  428.  
  429.        
  430.  
  431.     }    
  432.  
  433. }
  434.  
  435.  
Parsed in 0.054 seconds, using GeSHi 1.0.8.4


I commented codes those are written by me. You can identify them easily.

Hope this will work for you.

Thanks,
mitu
User avatar
mitutitu
Senior Developer
Senior Developer
 
Posts: 113
Joined: Tue Jun 09, 2009 7:40 am
Location: St. John's, NL, Canada

Postby Pogio » Tue Feb 09, 2010 10:19 pm

Thank you very much, I am a beginner, I'm learning.
your code I from an error "Syntax error on token"} ", delete this token"

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.  
  3.  
  4. private Handler handler = new Handler() {
  5.  
  6.           @Override
  7.  
  8.           public void handleMessage(Message msg) {
  9.  
  10.                super.handleMessage(msg);
  11.  
  12.           myProgressDialog.dismiss(); // here your progress dialog is dismissed indicating process is finished
  13.  
  14.               // Here you can write other processing code if you want
  15.  
  16.           }                  
  17.  
  18.              };
  19.  
  20.  } //Here I from the error "Syntax error on token"} ", delete this token"
  21.  
  22.  
Parsed in 0.034 seconds, using GeSHi 1.0.8.4
Attachments
Cattura.JPG
Cattura.JPG (30.32 KiB) Viewed 2265 times
Pogio
Freshman
Freshman
 
Posts: 9
Joined: Fri Jan 22, 2010 3:02 pm

Postby mitutitu » Wed Feb 10, 2010 7:03 am

Hi Pogio,

I'm sorry for that. May be when I was typing code this curly brace is missplaced. Delete this "}" (second closing bracket). And it'll work.

Thanks,
mitu
User avatar
mitutitu
Senior Developer
Senior Developer
 
Posts: 113
Joined: Tue Jun 09, 2009 7:40 am
Location: St. John's, NL, Canada

Postby Pogio » Wed Feb 10, 2010 8:40 pm

Hello Mitu, again many thanks
I deleted "}", now reports me this error

Why?
Attachments
Cattura2.JPG
Cattura2.JPG (33.03 KiB) Viewed 2199 times
Cattura.JPG
Cattura.JPG (30.86 KiB) Viewed 2199 times
Pogio
Freshman
Freshman
 
Posts: 9
Joined: Fri Jan 22, 2010 3:02 pm

Postby Pogio » Wed Feb 10, 2010 10:52 pm

follow the directions of eclipse
I have removed
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. @ Override
Parsed in 0.035 seconds, using GeSHi 1.0.8.4


and I added

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. import android.os.Message;
Parsed in 0.035 seconds, using GeSHi 1.0.8.4


not gave more error

but launching program from the following error
Attachments
Cattura3.JPG
Cattura3.JPG (30.63 KiB) Viewed 2182 times
Pogio
Freshman
Freshman
 
Posts: 9
Joined: Fri Jan 22, 2010 3:02 pm

Top

Postby mitutitu » Thu Feb 11, 2010 5:18 am

Hi Pogio,

It seems this is the problem in your application. You should better look at logCat and you will see a bunch of error messages. From there you can identify what is the actual problem is.


Thanks,
mitu
Android is awesome!
User avatar
mitutitu
Senior Developer
Senior Developer
 
Posts: 113
Joined: Tue Jun 09, 2009 7:40 am
Location: St. John's, NL, Canada

Postby Pogio » Thu Feb 11, 2010 7:21 pm

Sorry, where I see these logcat?
Pogio
Freshman
Freshman
 
Posts: 9
Joined: Fri Jan 22, 2010 3:02 pm

Postby Pogio » Thu Feb 11, 2010 8:03 pm

you I enclose the complete project, you can watch it?
Attachments
oroscopo.rar
(125.52 KiB) Downloaded 81 times
Pogio
Freshman
Freshman
 
Posts: 9
Joined: Fri Jan 22, 2010 3:02 pm

Postby Pogio » Sun Feb 14, 2010 9:00 pm

Nobody knows help me
Pogio
Freshman
Freshman
 
Posts: 9
Joined: Fri Jan 22, 2010 3:02 pm

Postby mitutitu » Mon Feb 15, 2010 6:29 am

Hello Pogio,

I've solved your problem. The problem was that you hav set your content view in the main thread(Actual activity is the main thread) but used findViewById() from within your new thread which is created in onCreate() method of the activity and hav set values inside your new thread. You can't do this. You can't set textview.setText() or imageview.setBackgroundResource() inside a newly created thread whereas the setContentView() is in main thread. If you do then you will get this error msg:

Code: Select all
02-15 12:01:45.915: ERROR/AndroidRuntime(966): android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.


Always follow this convention that where you set your content view you should work with your views in the same thread.

Your code is now working fine. Hopefully you can find where the changes are taken place. :)

Thanks,
mitu
Attachments
oroscopo.zip
The modified working codebase
(130.88 KiB) Downloaded 117 times
Android is awesome!
User avatar
mitutitu
Senior Developer
Senior Developer
 
Posts: 113
Joined: Tue Jun 09, 2009 7:40 am
Location: St. John's, NL, Canada

Postby Pogio » Mon Feb 15, 2010 9:00 am

It is fantastic! Thank you very much.
impossible for me to succeed, it was too complex for my knowledge.
Pogio
Freshman
Freshman
 
Posts: 9
Joined: Fri Jan 22, 2010 3:02 pm

Top

Return to Novice Tutorials

Who is online

Users browsing this forum: No registered users and 8 guests