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 8194175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:44:05+00:00 2026-06-07T04:44:05+00:00

here is the problem, before this i put all the code under onCreate(); but

  • 0

here is the problem, before this i put all the code under onCreate(); but it took like more than 10sec to load, it displays blank screen until the screen is fully loaded. so i moved some of the code to doInBackground. but i face some problem which never occur under onCreate(), lets see the code now:

String photoURL1;
@Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.app_details);

    tvDescription = (TextView)findViewById(R.id.tvDescription);

    tvTitle = (TextView)findViewById(R.id.tvTitle);
    tvDeveloper = (TextView)findViewById(R.id.tvDeveloper);

    rbRating = (RatingBar)findViewById(R.id.rbRating);

    ivLogo = (ImageView)findViewById(R.id.ivLogo);
    ivPhoto1 = (ImageView)findViewById(R.id.ivPhoto1);
    ivPhoto2 = (ImageView)findViewById(R.id.ivPhoto2);
    ivPhoto3 = (ImageView)findViewById(R.id.ivPhoto3);

    new loadPage().execute(null, null, null);
}

public class loadPage extends AsyncTask<String, Integer, Void> {
        private ProgressDialog pdia;

    @Override
    protected void onPreExecute(){
        super.onPreExecute();
        pdia = new ProgressDialog(AppDetails.this);
        pdia.setMessage("Loading...");
        pdia.show(); 
        }

    @Override
    protected Void doInBackground(String... aurl) {
        SoapObject Request = new SoapObject (NAMESPACE, METHOD_NAME);

        Request.addProperty("title", getIntent().getExtras().getString("xdaTitle"));

        SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);

        soapEnvelope.dotNet = true;
        soapEnvelope.setOutputSoapObject(Request);

        AndroidHttpTransport aht = new AndroidHttpTransport(URL);

        try
        {
            aht.call(SOAP_ACTION, soapEnvelope);
            SoapObject resultString = (SoapObject) soapEnvelope.getResponse();

            for(int i =0; i<resultString.getPropertyCount(); i++)
            {
                SoapObject array = (SoapObject) resultString .getProperty(i);

                title = array.getProperty(1).toString(); 
                developer = array.getProperty(3).toString();    

                         //load images      
                photoURL1 = array.getProperty(5).toString();   //get logo url


                BitmapFactory.Options bmOptions;
                bmOptions = new BitmapFactory.Options();
                bmOptions.inSampleSize = 1;         

            }
        }
        catch(Exception e){                                             
        }           

        return null;
    }

    @Override
    protected void onProgressUpdate(Integer... progress2) {

    }


        @Override
        protected void onPostExecute(Void unused) {
            tvTitle.setText(title);
            tvDeveloper.setText(developer);
            BitmapFactory.Options bmOptions;
            bmOptions = new BitmapFactory.Options();
            bmOptions.inSampleSize = 1;

            Bitmap bmLogo = LoadImage(photoURL1, bmOptions);
            ivLogo.setImageBitmap(bmLogo);
            pdia.dismiss();
        }

Here is the problem.

  • my tvTitle only display first 3 characters, tvDeveloper only display 7~8 characters (tvtitle and tvDeveloper is a textView)
  • force closed occur if i move image loader from doInBackground to onPostExecute.

=======UPDATE: where should i park this code? =================

MyI = new Intent(Intent.ACTION_VIEW);
            MyI.setAction(android.content.Intent.ACTION_VIEW);
            MyI.setDataAndType(Uri.parse("file:///sdcard/MaxApps/" + apkURL.toString()), "application/vnd.android.package-archive");

            MyPI = PendingIntent.getActivity(getApplicationContext(), 0, MyI, 0);
            MyNM = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);

            Intent intent = new Intent(getApplicationContext(), AppDetails.class);
            intent.putExtra("xdaTitle", title);
            final PendingIntent pendingIntent = PendingIntent.getActivity(getApplicationContext(), 0, intent, 0);

            notification = new Notification(R.drawable.logo, "Downloading...", System.currentTimeMillis());
            notification.flags = notification.flags | Notification.FLAG_ONGOING_EVENT;
            notification.contentView = new RemoteViews(getApplicationContext().getPackageName(), R.layout.downloadapk);
            notification.contentIntent = pendingIntent;
            notification.contentView.setImageViewResource(R.id.imgIcon, R.drawable.save);
            notification.contentView.setTextViewText(R.id.tvText, "Downloading " + apkURL);
            notification.contentView.setViewVisibility(R.id.pbStatus, View.VISIBLE);
            notification.contentView.setProgressBar(R.id.pbStatus, 100, progress, false);        
            notificationManager = (NotificationManager) getApplicationContext().getSystemService(getApplicationContext().NOTIFICATION_SERVICE);
  • 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-07T04:44:06+00:00Added an answer on June 7, 2026 at 4:44 am

    You can not Change UI in a background thread.

    The AsyncTask has a better option to update the UI while downloading, that’s to use publishProgress()

    You need to make few changes in your code like this to implement it.

            @Override 
            protected Void doInBackground(String... aurl) { 
    
                    for(int i =0; i<resultString.getPropertyCount(); i++) 
                    {                    
                        String logo_URL = array.getProperty(5).toString();   //get logo url 
                        bmLogo = LoadImage(logo_URL, bmOptions); 
                        String photo1_URL = array.getProperty(6).toString(); 
                        bmPhoto1 = LoadImage(photo1_URL, bmOptions); 
                        String photo2_URL = array.getProperty(7).toString(); 
                        bmPhoto2 = LoadImage(photo2_URL, bmOptions); 
                        String photo3_URL = array.getProperty(8).toString(); 
                        bmPhoto3 = LoadImage(photo3_URL, bmOptions); 
                        publishProgress(null);
                    } 
                } 
                catch(Exception e){                                              
                }            
    
                return null; 
            } 
    
            @Override 
            protected void onProgressUpdate(Integer... progress2) { 
                ivLogo.setImageBitmap(bmLogo); 
                ivPhoto1.setImageBitmap(bmPhoto1); 
                ivPhoto2.setImageBitmap(bmPhoto2); 
                ivPhoto3.setImageBitmap(bmPhoto3); 
            } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I though I had solved this problem, but it is back: Code generation for
Ok here is my problem : Before i start the description, let me to
Here's the problem, I need to validate the form before submitting in the next
Maddening problem here. When my page loads: <body onload=getClientDateTime();> It runs this function: document.getElementById('ClientDateTime').value=hello
What is the problem here? (Besides having redundant code). $.getJSON works as expected. However
I've been wracking my brain on this problem, here , and suddenly thought to
Here is the mysterious: I have a scope which looks like this (in Image.rb)
Here is the mysterious: I have a scope which looks like this (in Image.rb)
So I have this problem, which has never happened to me before. I am
I wonder if someone here can help me figure out this problem. I need

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.