i am creating one layout in code retrieve all message string and image using webservices all retrieve data in background process display the data total all views display one time ,
my intension is i am getting one message string and one image getting after display custom layout next getting another(second) message string and image then display add the layout this functionality running one by one show the messages and images
xmlfile:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/frameLayout1"
android:layout_width="fill_parent"
android:background="@android:color/white"
android:layout_height="fill_parent">
<ScrollView android:id="@+id/scrollView1"
android:layout_height="wrap_content"
android:layout_width="fill_parent">
</ScrollView>
</FrameLayout>
code file :
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ScrollView scrollView = (ScrollView) findViewById(R.id.scrollView1);
LinearLayout topLinearLayout = new LinearLayout(this);
topLinearLayout.setOrientation(LinearLayout.VERTICAL);
for (int i = 0; i < 15; i++){
LinearLayout linearLayout = new LinearLayout(this);
linearLayout.setOrientation(LinearLayout.HORIZONTAL);
ImageView imageView = new ImageView (this);
TextView textView = new TextView (this);
imageView.setImageResource(R.drawable.image);
textView.setText("Text View #" + i);
linearLayout.addView(imageView);
linearLayout.addView(textView);
topLinearLayout.addView(linearLayout);
}
scrollView.addView(topLinearLayout);
}
how can display image and message in custom layout one after one in dynamically
please forward some solution thank in advance
1 Answer