View, Viewgroup, onClick, getChildAt problem Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) Data science time! April 2019 and salary with experience Should we burninate the [wrap] tag? The Ask Question Wizard is Live!How to align views at the bottom of the screen?Get root view from current activityAndroid “Only the original thread that created a view hierarchy can touch its views.”ViewPager PagerAdapter not updating the ViewCamera in Android, how to get best size, preview size, picture size, view size, image distortedRecyclerView onClickHow to create RecyclerView with multiple view type?getChildAt() is not working in Custom Viewgroup constructorLaying out a stack of clickable playing cards in AndroidAndroid Studio Layout Errors

Is it ethical to give a final exam after the professor has quit before teaching the remaining chapters of the course?

What LEGO pieces have "real-world" functionality?

Storing hydrofluoric acid before the invention of plastics

Error "illegal generic type for instanceof" when using local classes

Why was the term "discrete" used in discrete logarithm?

What causes the vertical darker bands in my photo?

What is a non-alternating simple group with big order, but relatively few conjugacy classes?

Short Story with Cinderella as a Voo-doo Witch

What is the role of the transistor and diode in a soft start circuit?

When a candle burns, why does the top of wick glow if bottom of flame is hottest?

Why am I getting the error "non-boolean type specified in a context where a condition is expected" for this request?

Why are Kinder Surprise Eggs illegal in the USA?

When do you get frequent flier miles - when you buy, or when you fly?

Can a non-EU citizen traveling with me come with me through the EU passport line?

Why are there no cargo aircraft with "flying wing" design?

What is Arya's weapon design?

Book where humans were engineered with genes from animal species to survive hostile planets

Why did the rest of the Eastern Bloc not invade Yugoslavia?

Generate an RGB colour grid

What does an IRS interview request entail when called in to verify expenses for a sole proprietor small business?

Can an alien society believe that their star system is the universe?

In predicate logic, does existential quantification (∃) include universal quantification (∀), i.e. can 'some' imply 'all'?

51k Euros annually for a family of 4 in Berlin: Is it enough?

Why did the Falcon Heavy center core fall off the ASDS OCISLY barge?



View, Viewgroup, onClick, getChildAt problem



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
Data science time! April 2019 and salary with experience
Should we burninate the [wrap] tag?
The Ask Question Wizard is Live!How to align views at the bottom of the screen?Get root view from current activityAndroid “Only the original thread that created a view hierarchy can touch its views.”ViewPager PagerAdapter not updating the ViewCamera in Android, how to get best size, preview size, picture size, view size, image distortedRecyclerView onClickHow to create RecyclerView with multiple view type?getChildAt() is not working in Custom Viewgroup constructorLaying out a stack of clickable playing cards in AndroidAndroid Studio Layout Errors



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I am trying to make an activity with multiple cards that flip on click.



I have a Framelayout(the card) with two other Framelayouts(the two sides of the card) in it, like so:



<FrameLayout
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_margin="5dp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:onClick="flipCard">

<FrameLayout
android:id="@+id/card_back1"
android:layout_width="match_parent"
android:layout_height="match_parent">

<include layout="@layout/card_back" />

</FrameLayout>

<FrameLayout
android:id="@+id/card_front1"
android:layout_width="match_parent"
android:layout_height="match_parent">

<include layout="@layout/card_front" />

</FrameLayout>
</FrameLayout>


I have the "flipCard" method that SHOULD start the objectanimators and sets their targets to the two framelayouts(sides of the card).



However, the partent framelayout(the card) is the view that calls the "flipcard" method with it's onclick, but within the "flipcard" method I need to set the targets to the childviews. I thought of using .getChildAt() method for this, but I am not able to make it work.



flipCard method:



public void flipCard(View view) 
if (!mIsBackVisible)
mSetRightOut.setTarget(view.getChildAt(1));
mSetLeftIn.setTarget(view.getChildAt(0));
mSetRightOut.start();
mSetLeftIn.start();
mIsBackVisible = true;
else
mSetRightOut.setTarget(view.getChildAt(0));
mSetLeftIn.setTarget(view.getChildAt(1));
mSetRightOut.start();
mSetLeftIn.start();
mIsBackVisible = false;




If I change the flipCard method to "flipCard(ViewGroup Viewgroup) it doesn't work because the onClick in the xml is looking for a method that takes a View and not a ViewGroup.



I need the onClick to be on the parent Framelayout, but I need to get the child framelayouts through it somehow.



How can I make my original idea work, or if I can't, what other solution should I try?



EDIT: The solution was as simple as putting "ViewGroup viewGroup = (ViewGroup) view;" at the start of the flipCard method.










share|improve this question
























  • you can try calling view.findViewById(R.id.card_front1) instead of getChildAt()

    – Alexander
    Mar 22 at 9:31











  • @Alexander The problem with that is, that I have multiple cards, not just one. I need to call the childs of the frontview that gets clicked, not allways card_front1.

    – D_Flavio
    Mar 22 at 11:08

















0















I am trying to make an activity with multiple cards that flip on click.



I have a Framelayout(the card) with two other Framelayouts(the two sides of the card) in it, like so:



<FrameLayout
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_margin="5dp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:onClick="flipCard">

<FrameLayout
android:id="@+id/card_back1"
android:layout_width="match_parent"
android:layout_height="match_parent">

<include layout="@layout/card_back" />

</FrameLayout>

<FrameLayout
android:id="@+id/card_front1"
android:layout_width="match_parent"
android:layout_height="match_parent">

<include layout="@layout/card_front" />

</FrameLayout>
</FrameLayout>


I have the "flipCard" method that SHOULD start the objectanimators and sets their targets to the two framelayouts(sides of the card).



However, the partent framelayout(the card) is the view that calls the "flipcard" method with it's onclick, but within the "flipcard" method I need to set the targets to the childviews. I thought of using .getChildAt() method for this, but I am not able to make it work.



flipCard method:



public void flipCard(View view) 
if (!mIsBackVisible)
mSetRightOut.setTarget(view.getChildAt(1));
mSetLeftIn.setTarget(view.getChildAt(0));
mSetRightOut.start();
mSetLeftIn.start();
mIsBackVisible = true;
else
mSetRightOut.setTarget(view.getChildAt(0));
mSetLeftIn.setTarget(view.getChildAt(1));
mSetRightOut.start();
mSetLeftIn.start();
mIsBackVisible = false;




If I change the flipCard method to "flipCard(ViewGroup Viewgroup) it doesn't work because the onClick in the xml is looking for a method that takes a View and not a ViewGroup.



I need the onClick to be on the parent Framelayout, but I need to get the child framelayouts through it somehow.



How can I make my original idea work, or if I can't, what other solution should I try?



EDIT: The solution was as simple as putting "ViewGroup viewGroup = (ViewGroup) view;" at the start of the flipCard method.










share|improve this question
























  • you can try calling view.findViewById(R.id.card_front1) instead of getChildAt()

    – Alexander
    Mar 22 at 9:31











  • @Alexander The problem with that is, that I have multiple cards, not just one. I need to call the childs of the frontview that gets clicked, not allways card_front1.

    – D_Flavio
    Mar 22 at 11:08













0












0








0








I am trying to make an activity with multiple cards that flip on click.



I have a Framelayout(the card) with two other Framelayouts(the two sides of the card) in it, like so:



<FrameLayout
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_margin="5dp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:onClick="flipCard">

<FrameLayout
android:id="@+id/card_back1"
android:layout_width="match_parent"
android:layout_height="match_parent">

<include layout="@layout/card_back" />

</FrameLayout>

<FrameLayout
android:id="@+id/card_front1"
android:layout_width="match_parent"
android:layout_height="match_parent">

<include layout="@layout/card_front" />

</FrameLayout>
</FrameLayout>


I have the "flipCard" method that SHOULD start the objectanimators and sets their targets to the two framelayouts(sides of the card).



However, the partent framelayout(the card) is the view that calls the "flipcard" method with it's onclick, but within the "flipcard" method I need to set the targets to the childviews. I thought of using .getChildAt() method for this, but I am not able to make it work.



flipCard method:



public void flipCard(View view) 
if (!mIsBackVisible)
mSetRightOut.setTarget(view.getChildAt(1));
mSetLeftIn.setTarget(view.getChildAt(0));
mSetRightOut.start();
mSetLeftIn.start();
mIsBackVisible = true;
else
mSetRightOut.setTarget(view.getChildAt(0));
mSetLeftIn.setTarget(view.getChildAt(1));
mSetRightOut.start();
mSetLeftIn.start();
mIsBackVisible = false;




If I change the flipCard method to "flipCard(ViewGroup Viewgroup) it doesn't work because the onClick in the xml is looking for a method that takes a View and not a ViewGroup.



I need the onClick to be on the parent Framelayout, but I need to get the child framelayouts through it somehow.



How can I make my original idea work, or if I can't, what other solution should I try?



EDIT: The solution was as simple as putting "ViewGroup viewGroup = (ViewGroup) view;" at the start of the flipCard method.










share|improve this question
















I am trying to make an activity with multiple cards that flip on click.



I have a Framelayout(the card) with two other Framelayouts(the two sides of the card) in it, like so:



<FrameLayout
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_margin="5dp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:onClick="flipCard">

<FrameLayout
android:id="@+id/card_back1"
android:layout_width="match_parent"
android:layout_height="match_parent">

<include layout="@layout/card_back" />

</FrameLayout>

<FrameLayout
android:id="@+id/card_front1"
android:layout_width="match_parent"
android:layout_height="match_parent">

<include layout="@layout/card_front" />

</FrameLayout>
</FrameLayout>


I have the "flipCard" method that SHOULD start the objectanimators and sets their targets to the two framelayouts(sides of the card).



However, the partent framelayout(the card) is the view that calls the "flipcard" method with it's onclick, but within the "flipcard" method I need to set the targets to the childviews. I thought of using .getChildAt() method for this, but I am not able to make it work.



flipCard method:



public void flipCard(View view) 
if (!mIsBackVisible)
mSetRightOut.setTarget(view.getChildAt(1));
mSetLeftIn.setTarget(view.getChildAt(0));
mSetRightOut.start();
mSetLeftIn.start();
mIsBackVisible = true;
else
mSetRightOut.setTarget(view.getChildAt(0));
mSetLeftIn.setTarget(view.getChildAt(1));
mSetRightOut.start();
mSetLeftIn.start();
mIsBackVisible = false;




If I change the flipCard method to "flipCard(ViewGroup Viewgroup) it doesn't work because the onClick in the xml is looking for a method that takes a View and not a ViewGroup.



I need the onClick to be on the parent Framelayout, but I need to get the child framelayouts through it somehow.



How can I make my original idea work, or if I can't, what other solution should I try?



EDIT: The solution was as simple as putting "ViewGroup viewGroup = (ViewGroup) view;" at the start of the flipCard method.







java android






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 24 at 12:08







D_Flavio

















asked Mar 22 at 9:09









D_FlavioD_Flavio

135




135












  • you can try calling view.findViewById(R.id.card_front1) instead of getChildAt()

    – Alexander
    Mar 22 at 9:31











  • @Alexander The problem with that is, that I have multiple cards, not just one. I need to call the childs of the frontview that gets clicked, not allways card_front1.

    – D_Flavio
    Mar 22 at 11:08

















  • you can try calling view.findViewById(R.id.card_front1) instead of getChildAt()

    – Alexander
    Mar 22 at 9:31











  • @Alexander The problem with that is, that I have multiple cards, not just one. I need to call the childs of the frontview that gets clicked, not allways card_front1.

    – D_Flavio
    Mar 22 at 11:08
















you can try calling view.findViewById(R.id.card_front1) instead of getChildAt()

– Alexander
Mar 22 at 9:31





you can try calling view.findViewById(R.id.card_front1) instead of getChildAt()

– Alexander
Mar 22 at 9:31













@Alexander The problem with that is, that I have multiple cards, not just one. I need to call the childs of the frontview that gets clicked, not allways card_front1.

– D_Flavio
Mar 22 at 11:08





@Alexander The problem with that is, that I have multiple cards, not just one. I need to call the childs of the frontview that gets clicked, not allways card_front1.

– D_Flavio
Mar 22 at 11:08












2 Answers
2






active

oldest

votes


















0















Use the below code it will worked i have use color to show there you
have to put your color




layout.xml



 <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center">

<FrameLayout
android:id="@+id/llOne"
android:layout_width="200dp"
android:layout_height="200dp"
android:background="@color/colorGrey"
android:duplicateParentState="true"
android:orientation="vertical"
android:visibility="gone" />

<FrameLayout
android:id="@+id/llTwo"
android:layout_width="200dp"
android:layout_height="200dp"
android:background="@color/colorAccent"
android:duplicateParentState="true"
android:orientation="horizontal" />
</FrameLayout>



Demo.Java




 public class demo extends AppCompatActivity 

private FrameLayout llOne, llTwo;

@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.layout_demo);
initBasic();


private void initBasic()
llOne = findViewById(R.id.llOne);
llTwo = findViewById(R.id.llTwo);
llOne.setOnClickListener(new View.OnClickListener()
@Override
public void onClick(View v)
llOne.setVisibility(View.GONE);
llTwo.setVisibility(View.VISIBLE);

);
llTwo.setOnClickListener(new View.OnClickListener()
@Override
public void onClick(View v)
llOne.setVisibility(View.VISIBLE);
llTwo.setVisibility(View.GONE);

);








share|improve this answer























  • The problem with this is that the animations need to start for both of the card sides. That means the onclick has to be on the parent frameview. When the card spins, there is an animation for both sides of the card. If we change it so that we only click one side of a card then ony one side will animate. Aslo I have 18+ cards on screen. With this I would have to create an onclick for each card, and even that wouldn't work because of how the objectanimation is.

    – D_Flavio
    Mar 22 at 11:32


















0














The solution was as simple as putting "ViewGroup viewGroup = (ViewGroup) view;" at the start of the flipCard method.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55296197%2fview-viewgroup-onclick-getchildat-problem%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0















    Use the below code it will worked i have use color to show there you
    have to put your color




    layout.xml



     <?xml version="1.0" encoding="utf-8"?>
    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:gravity="center">

    <FrameLayout
    android:id="@+id/llOne"
    android:layout_width="200dp"
    android:layout_height="200dp"
    android:background="@color/colorGrey"
    android:duplicateParentState="true"
    android:orientation="vertical"
    android:visibility="gone" />

    <FrameLayout
    android:id="@+id/llTwo"
    android:layout_width="200dp"
    android:layout_height="200dp"
    android:background="@color/colorAccent"
    android:duplicateParentState="true"
    android:orientation="horizontal" />
    </FrameLayout>



    Demo.Java




     public class demo extends AppCompatActivity 

    private FrameLayout llOne, llTwo;

    @Override
    protected void onCreate(Bundle savedInstanceState)
    super.onCreate(savedInstanceState);
    setContentView(R.layout.layout_demo);
    initBasic();


    private void initBasic()
    llOne = findViewById(R.id.llOne);
    llTwo = findViewById(R.id.llTwo);
    llOne.setOnClickListener(new View.OnClickListener()
    @Override
    public void onClick(View v)
    llOne.setVisibility(View.GONE);
    llTwo.setVisibility(View.VISIBLE);

    );
    llTwo.setOnClickListener(new View.OnClickListener()
    @Override
    public void onClick(View v)
    llOne.setVisibility(View.VISIBLE);
    llTwo.setVisibility(View.GONE);

    );








    share|improve this answer























    • The problem with this is that the animations need to start for both of the card sides. That means the onclick has to be on the parent frameview. When the card spins, there is an animation for both sides of the card. If we change it so that we only click one side of a card then ony one side will animate. Aslo I have 18+ cards on screen. With this I would have to create an onclick for each card, and even that wouldn't work because of how the objectanimation is.

      – D_Flavio
      Mar 22 at 11:32















    0















    Use the below code it will worked i have use color to show there you
    have to put your color




    layout.xml



     <?xml version="1.0" encoding="utf-8"?>
    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:gravity="center">

    <FrameLayout
    android:id="@+id/llOne"
    android:layout_width="200dp"
    android:layout_height="200dp"
    android:background="@color/colorGrey"
    android:duplicateParentState="true"
    android:orientation="vertical"
    android:visibility="gone" />

    <FrameLayout
    android:id="@+id/llTwo"
    android:layout_width="200dp"
    android:layout_height="200dp"
    android:background="@color/colorAccent"
    android:duplicateParentState="true"
    android:orientation="horizontal" />
    </FrameLayout>



    Demo.Java




     public class demo extends AppCompatActivity 

    private FrameLayout llOne, llTwo;

    @Override
    protected void onCreate(Bundle savedInstanceState)
    super.onCreate(savedInstanceState);
    setContentView(R.layout.layout_demo);
    initBasic();


    private void initBasic()
    llOne = findViewById(R.id.llOne);
    llTwo = findViewById(R.id.llTwo);
    llOne.setOnClickListener(new View.OnClickListener()
    @Override
    public void onClick(View v)
    llOne.setVisibility(View.GONE);
    llTwo.setVisibility(View.VISIBLE);

    );
    llTwo.setOnClickListener(new View.OnClickListener()
    @Override
    public void onClick(View v)
    llOne.setVisibility(View.VISIBLE);
    llTwo.setVisibility(View.GONE);

    );








    share|improve this answer























    • The problem with this is that the animations need to start for both of the card sides. That means the onclick has to be on the parent frameview. When the card spins, there is an animation for both sides of the card. If we change it so that we only click one side of a card then ony one side will animate. Aslo I have 18+ cards on screen. With this I would have to create an onclick for each card, and even that wouldn't work because of how the objectanimation is.

      – D_Flavio
      Mar 22 at 11:32













    0












    0








    0








    Use the below code it will worked i have use color to show there you
    have to put your color




    layout.xml



     <?xml version="1.0" encoding="utf-8"?>
    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:gravity="center">

    <FrameLayout
    android:id="@+id/llOne"
    android:layout_width="200dp"
    android:layout_height="200dp"
    android:background="@color/colorGrey"
    android:duplicateParentState="true"
    android:orientation="vertical"
    android:visibility="gone" />

    <FrameLayout
    android:id="@+id/llTwo"
    android:layout_width="200dp"
    android:layout_height="200dp"
    android:background="@color/colorAccent"
    android:duplicateParentState="true"
    android:orientation="horizontal" />
    </FrameLayout>



    Demo.Java




     public class demo extends AppCompatActivity 

    private FrameLayout llOne, llTwo;

    @Override
    protected void onCreate(Bundle savedInstanceState)
    super.onCreate(savedInstanceState);
    setContentView(R.layout.layout_demo);
    initBasic();


    private void initBasic()
    llOne = findViewById(R.id.llOne);
    llTwo = findViewById(R.id.llTwo);
    llOne.setOnClickListener(new View.OnClickListener()
    @Override
    public void onClick(View v)
    llOne.setVisibility(View.GONE);
    llTwo.setVisibility(View.VISIBLE);

    );
    llTwo.setOnClickListener(new View.OnClickListener()
    @Override
    public void onClick(View v)
    llOne.setVisibility(View.VISIBLE);
    llTwo.setVisibility(View.GONE);

    );








    share|improve this answer














    Use the below code it will worked i have use color to show there you
    have to put your color




    layout.xml



     <?xml version="1.0" encoding="utf-8"?>
    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:gravity="center">

    <FrameLayout
    android:id="@+id/llOne"
    android:layout_width="200dp"
    android:layout_height="200dp"
    android:background="@color/colorGrey"
    android:duplicateParentState="true"
    android:orientation="vertical"
    android:visibility="gone" />

    <FrameLayout
    android:id="@+id/llTwo"
    android:layout_width="200dp"
    android:layout_height="200dp"
    android:background="@color/colorAccent"
    android:duplicateParentState="true"
    android:orientation="horizontal" />
    </FrameLayout>



    Demo.Java




     public class demo extends AppCompatActivity 

    private FrameLayout llOne, llTwo;

    @Override
    protected void onCreate(Bundle savedInstanceState)
    super.onCreate(savedInstanceState);
    setContentView(R.layout.layout_demo);
    initBasic();


    private void initBasic()
    llOne = findViewById(R.id.llOne);
    llTwo = findViewById(R.id.llTwo);
    llOne.setOnClickListener(new View.OnClickListener()
    @Override
    public void onClick(View v)
    llOne.setVisibility(View.GONE);
    llTwo.setVisibility(View.VISIBLE);

    );
    llTwo.setOnClickListener(new View.OnClickListener()
    @Override
    public void onClick(View v)
    llOne.setVisibility(View.VISIBLE);
    llTwo.setVisibility(View.GONE);

    );









    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Mar 22 at 9:59









    Tejas ShukalTejas Shukal

    357




    357












    • The problem with this is that the animations need to start for both of the card sides. That means the onclick has to be on the parent frameview. When the card spins, there is an animation for both sides of the card. If we change it so that we only click one side of a card then ony one side will animate. Aslo I have 18+ cards on screen. With this I would have to create an onclick for each card, and even that wouldn't work because of how the objectanimation is.

      – D_Flavio
      Mar 22 at 11:32

















    • The problem with this is that the animations need to start for both of the card sides. That means the onclick has to be on the parent frameview. When the card spins, there is an animation for both sides of the card. If we change it so that we only click one side of a card then ony one side will animate. Aslo I have 18+ cards on screen. With this I would have to create an onclick for each card, and even that wouldn't work because of how the objectanimation is.

      – D_Flavio
      Mar 22 at 11:32
















    The problem with this is that the animations need to start for both of the card sides. That means the onclick has to be on the parent frameview. When the card spins, there is an animation for both sides of the card. If we change it so that we only click one side of a card then ony one side will animate. Aslo I have 18+ cards on screen. With this I would have to create an onclick for each card, and even that wouldn't work because of how the objectanimation is.

    – D_Flavio
    Mar 22 at 11:32





    The problem with this is that the animations need to start for both of the card sides. That means the onclick has to be on the parent frameview. When the card spins, there is an animation for both sides of the card. If we change it so that we only click one side of a card then ony one side will animate. Aslo I have 18+ cards on screen. With this I would have to create an onclick for each card, and even that wouldn't work because of how the objectanimation is.

    – D_Flavio
    Mar 22 at 11:32













    0














    The solution was as simple as putting "ViewGroup viewGroup = (ViewGroup) view;" at the start of the flipCard method.






    share|improve this answer



























      0














      The solution was as simple as putting "ViewGroup viewGroup = (ViewGroup) view;" at the start of the flipCard method.






      share|improve this answer

























        0












        0








        0







        The solution was as simple as putting "ViewGroup viewGroup = (ViewGroup) view;" at the start of the flipCard method.






        share|improve this answer













        The solution was as simple as putting "ViewGroup viewGroup = (ViewGroup) view;" at the start of the flipCard method.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 24 at 12:09









        D_FlavioD_Flavio

        135




        135



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55296197%2fview-viewgroup-onclick-getchildat-problem%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

            Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript