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

  • Home
  • SEARCH
  • 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 8453127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T11:41:18+00:00 2026-06-10T11:41:18+00:00

I am trying to port an iPhone App to Android, but am having some

  • 0

I am trying to port an iPhone App to Android, but am having some startup difficulties.

I have the following function to get the data:

    public void onClick(View v) {
        try{
            //Toast.makeText(getApplicationContext(), "Starting update", Toast.LENGTH_SHORT).show();
            progressDialog = ProgressDialog.show(MainActivity.this, "", "Loading...");
            new Thread() {
                public void run() {
                    try{
                        DataManager manager = new DataManager(getApplicationContext());
                        manager.updateData();
                    } catch (Exception e) {
                        Log.e(TAG, e.getMessage());

                        AlertDialog alertDialog = new AlertDialog.Builder(MainActivity.this).create();
                        alertDialog.setTitle("Error...");
                        alertDialog.setMessage(e.getMessage());
                        alertDialog.show();
                    }
                    progressDialog.dismiss();
                }
            }.start();
        } catch (Exception e) {
            Log.e(TAG, "Problem with getting the data: " + e.getMessage());
            Toast.makeText(getApplicationContext(), "Error during update",
                    Toast.LENGTH_SHORT).show();
        }

    }

But if an exception occurs I get the following error (I initially tried to use an AsyncTask, but ran into the same problem):

08-29 20:23:24.389: ERROR/WindowManager(974): Activity org.idoms.iDomsAndroid.MainActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@412fcc38 that was originally added here
        android.view.WindowLeaked: Activity org.idoms.iDomsAndroid.MainActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@412fcc38 that was originally added here
        at android.view.ViewRootImpl.<init>(ViewRootImpl.java:344)
        at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:267)
        at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:215)
        at android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:140)
        at android.view.Window$LocalWindowManager.addView(Window.java:537)
        at android.app.Dialog.show(Dialog.java:278)
        at android.app.ProgressDialog.show(ProgressDialog.java:116)
        at android.app.ProgressDialog.show(ProgressDialog.java:99)
        at android.app.ProgressDialog.show(ProgressDialog.java:94)
        at org.idoms.iDomsAndroid.MainActivity$1.onClick(MainActivity.java:46)
        at android.view.View.performClick(View.java:3511)
        at android.view.View$PerformClick.run(View.java:14105)
        at android.os.Handler.handleCallback(Handler.java:605)
        at android.os.Handler.dispatchMessage(Handler.java:92)
        at android.os.Looper.loop(Looper.java:137)
        at android.app.ActivityThread.main(ActivityThread.java:4424)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:511)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
        at dalvik.system.NativeStart.main(Native Method)

What is the right way to do this?

  • 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-06-10T11:41:19+00:00Added an answer on June 10, 2026 at 11:41 am

    My guess is, threads cannot interact with the main UI thread elements.

    progressDialog was created in main Ui thread, other threads cannot interact with it. You can give it a signal in the fields and check its progress, but I would really recommend using Asynctask doing this task.

    AsyncTask

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

Sidebar

Related Questions

I have a c++ app that I'm trying to port to iPhone and to
im trying to port an iphone app to android. i am completely new to
I'm trying to port some old MySQL queries to PostgreSQL, but I'm having trouble
I am trying to port an iPhone app to iPad with as little work
While trying to port some code to compile in linux I get peculiar compilation
Im trying to port this function to c# http://www.phpsnaps.com/snaps/view/clean-url/ I have problems to transform
I'm trying to port over some Core Data code over from a test Mac
I am trying to port an Android App to ios. It's been awhile since
I'm trying to port a C console program over to iPhone. I have imported
I'm trying to port an iPhone application from using SQLite to Core Data. Is

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.