Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6036833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:59:00+00:00 2026-05-23T05:59:00+00:00

can anybody help me here? I’m clearly doing soimething wrong and I can’t seem

  • 0

can anybody help me here? I’m clearly doing soimething wrong and I can’t seem to figure it out myself. Basically that the doInBackground() method is not running.

This is whe entire class file and the line of code that calls it

call:

new MyTimer().execute();

file:

public class MyTimer extends AsyncTask<Object, Object, Object> { 

Timer _timerTask = new Timer();
static int totalSeconds = 1, hour = 0, min = 0, sec = 0;
static String mTimeFormat = "%02d:%02d:%02d";
static String timeTakenString;

@Override
protected Object doInBackground(Object... params) {

        TimerTask timer = new TimerTask() {
            @Override
            public void run() {

                GPSMain.printscreen();
                totalSeconds += 1;
                sec += 1;
                if(sec >= 60) {
                    sec = 0;
                    min += 1;
                    if (min >= 60) {
                        min = 0;
                        hour += 1;
                    }
                }
                timeTakenString = String.format(mTimeFormat, hour, min, sec);
                onPostExecute(timeTakenString);

            }
        };
         (_timerTask).scheduleAtFixedRate(timer,1000,1000);
        return timeTakenString;


}
 protected void onPostExecute(String timeTaken) {
    GPSMain.timer.setText("Time Taken: "+timeTaken);
}
}

EDIT 1 :

Logcat:

06-20 10:18:20.036: DEBUG/AndroidRuntime(312): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
06-20 10:18:20.046: DEBUG/AndroidRuntime(312): CheckJNI is ON
06-20 10:18:20.225: DEBUG/AndroidRuntime(312): --- registering native functions ---
06-20 10:18:20.506: DEBUG/ddm-heap(312): Got feature list request
06-20 10:18:20.865: INFO/ActivityManager(52): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=Hartford.gps/.GPSMain }
06-20 10:18:20.925: DEBUG/AndroidRuntime(312): Shutting down VM
06-20 10:18:20.944: DEBUG/dalvikvm(312): DestroyJavaVM waiting for non-daemon threads to exit
06-20 10:18:20.944: DEBUG/dalvikvm(312): DestroyJavaVM shutting VM down
06-20 10:18:20.944: DEBUG/dalvikvm(312): HeapWorker thread shutting down
06-20 10:18:20.944: DEBUG/dalvikvm(312): HeapWorker thread has shut down
06-20 10:18:20.976: DEBUG/jdwp(312): JDWP shutting down net...
06-20 10:18:20.976: INFO/dalvikvm(312): Debugger has detached; object registry had 1 entries
06-20 10:18:20.985: ERROR/AndroidRuntime(312): ERROR: thread attach failed
06-20 10:18:20.985: DEBUG/dalvikvm(312): VM cleaning up
06-20 10:18:21.175: DEBUG/dalvikvm(312): LinearAlloc 0x0 used 638596 of 5242880 (12%)
06-20 10:18:21.495: INFO/ActivityManager(52): Displayed activity Hartford.gps/.GPSMain: 604 ms (total 24251 ms)
06-20 10:18:23.365: INFO/NotificationService(52): enqueueToast pkg=Hartford.gps callback=android.app.ITransientNotification$Stub$Proxy@44ddfa60 duration=1
06-20 10:18:23.545: DEBUG/GpsLocationProvider(52): setMinTime 250
06-20 10:18:23.545: DEBUG/GpsLocationProvider(52): startNavigating
06-20 10:18:24.206: DEBUG/LocationManager(287): removeUpdates: listener = Hartford.gps.Calculations$1@44f03dc0
06-20 10:18:24.206: DEBUG/GpsLocationProvider(52): stopNavigating
06-20 10:18:26.146: WARN/KeyCharacterMap(287): No keyboard for id 0
06-20 10:18:26.146: WARN/KeyCharacterMap(287): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
06-20 10:18:26.616: WARN/IInputConnectionWrapper(97): showStatusIcon on inactive InputConnection
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T05:59:00+00:00Added an answer on May 23, 2026 at 5:59 am

    try this..

    public class MyAsyncTask extends Activity {

    public static TextView timer;
    private MyTimer asyncTask;
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    
        asyncTask = (MyTimer) new MyTimer().execute();
        timer = (TextView) findViewById(R.id.text);
    
    }
    
    public class MyTimer extends AsyncTask<String, Object, String> {
    
        Timer _timerTask = new Timer();
        int totalSeconds = 1;
        int hour = 0;
        int min = 0;
        int sec = 0;
        final String mTimeFormat = "%02d:%02d:%02d";
        String timeTakenString;
        private String timeTaken;
        @Override
        protected String doInBackground(String... params) {
    
            TimerTask timer = new TimerTask() {
                @Override
                public void run() {
    
                    MyAsyncTask.printscreen();
                    totalSeconds += 1;
                    sec += 1;
                    if (sec >= 60) {
                        sec = 0;
                        min += 1;
                        if (min >= 60) {
                            min = 0;
                            hour += 1;
                        }
                    }
                    timeTakenString = String
                            .format(mTimeFormat, hour, min, sec);
                    onPostExecute(timeTakenString);
    
                }
            };
            (_timerTask).scheduleAtFixedRate(timer, 1000, 1000);
            return timeTakenString;
    
        }
    
        protected void onPostExecute(String timeTaken) {
            this.timeTaken = timeTaken;
            Message message = new Message();
            message.what = 100;
            mHandler.sendMessage(message);
        }
    
        Handler mHandler = new Handler() {
    
    
            public void handleMessage(Message msg) {
                if (msg.what == 100) {
    
                    timer.setText("Time Taken: " + timeTaken);
                }
            };
        };
    }
    
    protected static void printscreen() {
        // TODO Auto-generated method stub
    
    }
    

    }

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anybody help me in finding out how to verify that _tmkdir succeeded. For
Can anybody help me out to know the possible reasons for which Apple store
can anybody help me here please? I am using AJAX for pagination in my
I wonder if anybody can help me here. I apologise for sounding like a
Can anybody help me understand why are there two loops here? <?php // create
Can anybody help me with this? Here's the problem... When I have to code
Can anybody help, I`m starter in web? Here is code: <head> <meta http-equiv=Content-Type content=text/html;
My code wont execute the alert() function. Can anybody help me? Here is the
Can anybody help me how to invoke the post method provided here. I am
I can't kind of make out the first return statement, can anybody help to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.