Android: Accessing web-service/parsing xml file

This simple project is created to retrieve data using web-service and then parsing the xml. Using relativelayout all parsed data was displayed dynamically.

RelativeLayout that was used to display fetched data was needed to integrate with other static layout. But that was handled carefully.Here is the  mechanism how i controlled dynamic view.

ViewId variable should be declared as a global Variable.

public int viewId;

The following piece of code should be declared within onCreate Method. Here ckBox is the ChekcBox View below which all dynamic views will be created.

viewId = ckBox.getId();

This is the dynamic view method which is called with the fetch of new data.

public void DynamicView(String val) {
 // param for view
 RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
 LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);

// Log.d("","View ID: "+viewId);
 params.addRule(RelativeLayout.BELOW, viewId);
 // create a layout
 RelativeLayout layout = (RelativeLayout) findViewById(;

TextView tv = new TextView(this);

 viewId = thresholdViewId;



Code can be found in this location.:


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s