Note that there are some explanatory texts on larger screens.

plurals
  1. POcall public String from other class
    primarykey
    data
    text
    <p>I try to get string with time (hh:mm:ss) but i get this error:</p> <pre><code> 10-28 12:35:27.682: E/AndroidRuntime(14002): java.lang.NullPointerException </code></pre> <p>I call to this by my main class:</p> <pre><code>private TimeUpdater timeupdater; . . . private Runnable runnable = new Runnable(){ public void run() { datasource = new DataSource(getBaseContext()); datasource.open(); comment = datasource.getComment("1"); data = comment.toString().split(" "); /*for(int i=0;i&lt;11;i++) { dataUpdate[i]=data[i+1]; System.out.println("U " + dataUpdate[i]); System.out.println("D " + data[i+1]); }*/ String a = timeupdater.upTime(dane[5]); System.out.println(a); time.setText(timeupdater.upTime(dane[5])); //for(int i=0;i&lt;12;i++) //System.out.println(dane[i]); handler.postDelayed(this, 1000); } }; </code></pre> <p>inside data[5] is 00:00:00<br> This is my Time Updater class:</p> <pre><code>public class TimeUpdater { private int hh, mm, ss; private String time; private String shh, smm, sss; public String upTime(String time) { String[] czas = time.split(":"); hh = Integer.parseInt(czas[0]); mm = Integer.parseInt(czas[1]); ss = Integer.parseInt(czas[2]); if(ss&lt;60) ss++; if(ss==60) { ss=0; mm++; } if(mm==60) hh++; if(hh&lt;10) shh = "0"+hh; if(mm&lt;10) smm = "0"+mm; if(ss&lt;10) sss = "0"+ss; this.time = shh + ":" + smm + ":" + sss; System.out.println(time); return this.time; } </code></pre> <p>I need because later i want to do more that calls. I need to know how to create in other class public Strings to change data every second</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload