Note that there are some explanatory texts on larger screens.

plurals
  1. POAdd view after showed form
    primarykey
    data
    text
    <p>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.</p> <p>gamestatistics.xml <br> </p> <pre><code>&lt;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"&gt; &lt;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"/&gt; &lt;HorizontalScrollView android:id="@+id/statisticsScroll" android:layout_width="fill_parent" android:layout_height="wrap_content"&gt; &lt;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"&gt; &lt;/LinearLayout&gt; &lt;/HorizontalScrollView&gt; &lt;/LinearLayout&gt; </code></pre> <p></p> <p>GameStatistics.java</p> <pre><code>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&lt;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); } } </code></pre> <p>}</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload