Exception in java/lang/RuntimeException

Put your problem here if it does not fit any of the other categories.

Exception in java/lang/RuntimeException

Postby surya.n.k » Tue Jan 29, 2008 12:26 pm

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public class CheckUpdateTimer implements Runnable {
  2.  
  3.         public String idateString = null;
  4.  
  5.         private Date idate = null;
  6.  
  7.         private Date iFiledate = null;
  8.  
  9.         Calendar iCal = new GregorianCalendar();
  10.  
  11.         Calendar iFileCal = new GregorianCalendar();
  12.  
  13.  
  14.  
  15.         public void run() {
  16.  
  17.            
  18.  
  19.                 while (!Thread.currentThread().isInterrupted()) {
  20.  
  21.                         try {
  22.  
  23.                                 FileInputStream fis = new FileInputStream(new File("filename"));
  24.  
  25.                                 ObjectInputStream serializer = new ObjectInputStream(fis);
  26.  
  27.                                 iFiledate = (Date) serializer.readObject();
  28.  
  29.                                 iFileCal.setTime(iFiledate);
  30.  
  31.  
  32.  
  33.                                 idate = new Date();
  34.  
  35.                                 iCal.setTime(idate);
  36.  
  37.                                 Log.i("File Time", iFiledate.toString());
  38.  
  39.                                 Log.i("current Time", idate.toString());
  40.  
  41.  
  42.  
  43.                                 int iFileDate = iFileCal.get(Calendar.DATE);
  44.  
  45.                                 int iFileHour = iFileCal.get(Calendar.HOUR);
  46.  
  47.                                 int iFileMinute = iFileCal.get(Calendar.MINUTE);
  48.  
  49.  
  50.  
  51.                                 int iDate = iCal.get(Calendar.DATE);
  52.  
  53.                                 int hour = iCal.get(Calendar.HOUR);
  54.  
  55.                                 int minute = iCal.get(Calendar.MINUTE);
  56.  
  57.  
  58.  
  59.                                 if (iFileDate == iDate) {
  60.  
  61.                                         if (iFileHour == hour) {
  62.  
  63.                                                 if (iFileMinute == minute) {
  64.  
  65.                                                         Log.i("Time", "Equal");
  66.  
  67.                                                         Thread.sleep(100000);
  68.  
  69.                                                 } else
  70.  
  71.                                                         Log.i("Time", "Not Equal");
  72.  
  73.                                         }
  74.  
  75.                                 } else
  76.  
  77.                                         Log.i("Dates", "Not equal");
  78.  
  79.                         }catch (InterruptedException e) {
  80.  
  81.                                 Thread.currentThread().interrupt();
  82.  
  83.                         }catch (Exception e) {
  84.  
  85.                                 Thread.currentThread().interrupt();
  86.  
  87.                         }
  88.  
  89.                 }
  90.  
  91.         }
  92.  
  93.     }  
Parsed in 0.038 seconds, using GeSHi 1.0.8.4


i wrote this thread and i called thread method start();

when time is true it is fine but if i call any method which handle stream it is showing this message

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. D/dalvikvm(1668): Exception java/lang/RuntimeException from Handler.java:94 not caught locally
  2.  
  3.  
  4.  
  5. I/Exception(1891): android.view.ViewInflate$InflateException: Binary XML file line #48: Error inflating class java.lang.reflect.Constructor
Parsed in 0.031 seconds, using GeSHi 1.0.8.4




any one give me idea about this

whether i have to use priority for this thread are not and

can i run this thread continues in background.....?

if i cannot how can handle in this scenario?
surya.n.k
Developer
Developer
 
Posts: 26
Joined: Fri Dec 07, 2007 7:33 am

Top

Postby cabernet1976 » Wed Jan 30, 2008 3:00 am

Hi surya.n.k,
Sorry for I have no good idea for you.
Is it possible two threads access to the same file at the same time?
Or you can read this topic in google android groups similar with yours:
:arrow: http://groups.google.com/group/android- ... 2ed2a92d87
Upload2Flickr's blog: http://upload2flickr.blogspot.com
cabernet1976
Senior Developer
Senior Developer
 
Posts: 154
Joined: Fri Nov 16, 2007 2:34 am
Location: China

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Google [Bot] and 22 guests