I have another screen to work in an Android application. For this I use ViewFlipper. I decided to use a different class for different kinds of children
public main extends Activity{
{
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sign_in);
ViewFlipper viewFlipper = (ViewFlipper) findViewById(R.id.viewFlipper);
HomeScreen s = new HomeScreen(getApplicationContext(), getCurrentFocus(), viewFlipper);
}
}
and this Homescreen class: -
public class HomeScreen {
private Button signIn;
private Button createAccount;
private View v;
private Context context;
private ViewFlipper viewflipper;
public HomeScreen(Context context,View v,ViewFlipper viewflipper ) {
this.v=v;
this.context = context;
this.viewflipper = viewflipper;
signIn = (Button) v.findViewById(R.id.button_sign_in_homeScreen);
createAccount = (Button)v.findViewById(R.id.button_createAccount_homeScreen);
signIn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
viewflipper.setDisplayedChild(1);
}
});
}
but shows java.lang.RuntimeException launch exception: Unable to start ComponentInfo activity Someone please help me
getCurrentFocus () - the correct way to get the view?
I'm trying to implement
- I need to use a different class to define listening on the controls of each flipper child
- In the above example, HomeScreen is one of my child flipper view screens.
v.findViewById , , getCurrentFocus()
, ? viewflipper , viewflpper, . .
...