0

I create an apk for meeting room info screen that shows room is busy or not. Presenters sending mail to the tablet for the meeting time, and program takes mail and show the meeting on the screen at that time. But my problem, i created this app. for lg nexus 7" tablet, unfortunetly it changed. Now i have samsung sm-t110 7". Main problem is, apk didn't show correct current time. It shows current time + 1hr. Is this problem happens because of the resolution changing or because of codes.Here is my codes(time part);

/* decision of the time line coordinate */
long sekiz1=1404705600; // epoch time at 07.07.2014 clock=7:00
long timerkoor=(epoch-(sekiz1*1000))/1000;// at 7:00 clock minus current time

while(timerkoor>=86400){//every morning at 7a.m reset timerkoor
                timerkoor=timerkoor-86400;
            }
if(timerkoor>46800){//between 07:00 - 20:00

    param2 =new AbsoluteLayout.LayoutParams(0,0,0, 0);
    timer123.setLayoutParams(param2);           
}
else{
int timerkoor2=(int) ((timerkoor*22.2)/600);// calculating timekoor like px (it changes every tablets ??)
param2 =new AbsoluteLayout.LayoutParams(-1,5,180,timerkoor2);// deside timer textview coordinates
timer123.setLayoutParams(param2);//set values
}
final int timerkoor3=(int) ((timerkoor*22.2)/600);//deside scroolview coordinates 
sv1.post(new Runnable() { 
    public void run() { 
            sv1.scrollTo(0, timerkoor3-292);// deside scrollviewin default values
    } 
});
mehdi lotfi
  • 11,194
  • 18
  • 82
  • 128

1 Answers1

0

Problem in your code.

First. Do not make computing with time in int/long. Use Calendar class from android SDK http://developer.android.com/reference/java/util/Calendar.html

Second. You use values like "600" in code instead of real screen size of tablet. Please check this answer Get Screen width and height

Third. Do not use AbsoluteLayout. Try Relative instead. http://developer.android.com/reference/android/widget/RelativeLayout.html

Community
  • 1
  • 1
Stepango
  • 4,721
  • 3
  • 31
  • 44