Hi i am working on one kid application in that application i want to show 1+1 =2 ,1+2=3 etc.For this i want tio display the number images one by one .That means fiorst display the 1 after + after some time another number.For this give me some suggestions.Please give me some example code .Thanks in advance
A:
Your idéa is similar to my application in Android Market called Learn Math, looking like this:
.
I use a TableLayout
with individual TableRow
s for the images, like this:
<TableRow android:layout_marginTop="5dp">
<ImageView android:id="@+id/img1" />
<ImageView android:id="@+id/img2" />
<ImageView android:id="@+id/img3" />
<ImageView android:id="@+id/img4" />
</TableRow>
The program itself has private variables for the images, which I change on user selections. Initially it might look like this (following the image above):
public class LearnMath extends Activity {
private ImageView img1, img2, img3, img4;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
img1 = (ImageView)findViewById(R.id.img1);
img2 = (ImageView)findViewById(R.id.img2);
img3 = (ImageView)findViewById(R.id.img3);
img4 = (ImageView)findViewById(R.id.img4);
// .png images located in res/drawable folder with lower case names
img1.setImageResource(R.drawable.six);
img2.setImageResource(R.drawable.plus);
img3.setImageResource(R.drawable.zero);
img4.setImageResource(R.drawable.equals);
}
I hope this gives you a starting point of your application!
BennySkogberg
2010-08-04 06:18:34
Thank u for your reply.But i want to display the images on eby one means not in the alignment(layout ) sense.I want to display the images like video ,first one will be displayed after some time "+" and after some time another number like that.R u understand now"
sairam
2010-08-04 06:28:41
If you want to add an animation felling to your software, one might be tempted to put the UI-thread to sleep before showing the next image. However, this is bad coding. Instead take a look at UI timer on this address: http://developer.android.com/resources/articles/timed-ui-updates.html
BennySkogberg
2010-08-04 06:36:37