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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:49:51+00:00 2026-05-23T15:49:51+00:00

I am working on an application in which I load and show form with

  • 0

I am working on an application in which I load and show form with data being loaded over the Internet.It takes some time to load all data so I would like to do it like this. Load static data and show it to the user but without dynamic part from internet and when it shows that form it trigger something like “OnLoadActaivity” (not sure) and then to add views dynamically.

gamestatistics.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" 
    android:gravity="center|bottom"
    android:orientation="vertical">
    <TextView xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/topPlayers"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content"
        android:gravity="center_horizontal"
        android:text="Top players for this game:"
        android:textSize="15sp"
        android:textColor="#FFFFFF"
        android:textStyle="bold"
        android:paddingBottom="10px"/>
    <HorizontalScrollView android:id="@+id/statisticsScroll" 
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">
        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/playerContainer"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" 
            android:orientation="horizontal"
            android:paddingLeft="5px"
            android:paddingRight="5px">
        </LinearLayout>
    </HorizontalScrollView>
</LinearLayout>

GameStatistics.java

public class GameStatistics extends Actavity{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.gamestatistics);

    Bundle game = getIntent().getExtras();
    String gameName = game.getString("gameName");
    List playersData = game.getStringArrayList("playersData");

    TextView gameNameHeader = (TextView)findViewById(R.id.statisticsGameName);
    gameNameHeader.setText(gameName);       
}

@Override
protected void onResume() {
    super.onResume();
    Bundle game = getIntent().getExtras();
    List playersData = game.getStringArrayList("playersData");

    LinearLayout playerContainer = (LinearLayout) findViewById(R.id.playerContainer);

    LayoutInflater vi = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    for (int i=0; i<playersData.size(); i++)
    {
        View v = vi.inflate(R.layout.profiletemplate, null);

        TextView playerName = (TextView) v.findViewById(R.id.playerName);
        playerName.setText(((String[])playersData.get(i))[0]);

        TextView playerPosition = (TextView) v.findViewById(R.id.playerScore);
        playerPosition.setText(((String[])playersData.get(i))[1]);

        ImageView playerImage = (ImageView) v.findViewById(R.id.playerImage);

        try
        {
           URL url = new URL(((String[])playersData.get(i))[2]);
           InputStream content = (InputStream)url.getContent();
           Drawable d = Drawable.createFromStream(content,"src");
           playerImage.setImageDrawable(d);
        }
        catch(Exception e)
        {
           e.printStackTrace();
        }             

        playerContainer.addView(v);         
    }
}

}

  • 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-23T15:49:52+00:00Added an answer on May 23, 2026 at 3:49 pm

    You shouldn’t do long processes on the UI thread. It’s bad practice and isn’t allowed on 3.0+ devices. Use an AsyncTask instead. AsyncTasks allow you to start a process on another thread, and be notified on the UI thread when its complete. You should specifically look at

    onPreExecute() //Done on the UI Thread before the execution begins
    doInBackground() //This is the execution thread
    onPostExecute() //Done on the UI Thread after the executing is finished
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on an application which stores data in tables, similar to an RDBMS.
I'm working on an application which has data imported from a foreign (and wholly
I am working on an application which has got some sensitive information. I am
I am working on an application which needs to load fonts dynamically based upon
I am working on an application which works with GPS data. Part of the
I'm working on an application which uses servlets to get and set data for
I am working on an application which draws a simple dot grid. I would
I am working on an application which starts as a service but only if
I am working on an application which sends an AJAX POST request (I'm using
I'm working on iphone application which needs to run offline at an exhibition. It

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.