I have a problem regarding the following:
public void onItemClick(AdapterView<?> a, View v, int position, long id) {
temp=a.getItemAtPosition(position).toString();
Toast.makeText(ne.this, temp, Toast.LENGTH_SHORT).show();
if (temp=="Aries")
{
ViewFlipper viewflipper= (ViewFlipper) findViewById(R.id.viewflipper);
Toast.makeText(ne.this, temp, Toast.LENGTH_SHORT).show();
}
if (temp=="Taurus")
{
ViewFlipper viewflipper= (ViewFlipper) findViewById(R.id.viewflipper);
Toast.makeText(ne.this, temp, Toast.LENGTH_SHORT).show();
}
if (temp=="Libra")
{
ViewFlipper viewflipper= (ViewFlipper) findViewById(R.id.viewflipper);
Toast.makeText(ne.this, temp, Toast.LENGTH_SHORT).show();
}
when I click on the item it shows me the string on first view.but I am not going on to the second view. and also on first view when I click other item still it shows first output.
i.e. if I select Aries in the first view It shows me aries in the toast window but doesn't go to the second view. and again I am pressing other item say Taurus, still it shows Aries to me.
I think you are misunderstood with ViewFlipper control.
By this line:
ViewFlipper viewflipper= (ViewFlipper) findViewById(R.id.viewflipper);
, you are just initiate viewflipper control , you are not giving any command to load next or previous view.I mean to say, there are
showPrevious()
andshowNext()
method to load previous or next view accordingly.For example:
You need to implement something like that, i hope this suits your question:
Refer this example: How to use a ListView and a ViewFlipper to navigate user in an Android app?