java - Android Activity: Access methods of a model -


Sorry for this generic title, but I could not find a better formulation. I had included library in your Android project OnCreate method MyActvitiy.java include something like:

  mCardContainer = (CardContainer) findViewById (R.id.layoutview); Simplecardstacks adapter adapter = new simple cardstack adapter (this); Adapter.add (new cardmodel ("Heading 2", "Description2 goes here", R. Daveable Dictable (R.drawable.picture2)); Adapter.add (new cardmodel ("Heading 3", "Description 3 goes here", R. Daveable Dictable (R.drawable.picture3)); CardModel CardModel = New CardModel ("Heading 1", "Description goes here", R. Daveable Dictable (R.drawable.picture1)); cardModel.setOnCardDimissedListener (New CardModel.OnCardDimissedListener () {@Override public void onLike () {Log.i ( "swipe-able card", "I like the card");}}); Adapter.add (cardModel); MCardContainer.setAdapter (adapter);  

I want to be able to log on to the title of the object (), too. . However, I do not know how to use it

pseudo code:

  cardModel.setOnCardDimissedListener (New CardModel.OnCardDimissedListener () {@Override public void onLike () {Log.i ("Swiping Card", "I like the card with the title:" + + this.getTitle ()); // After 3 swipes, heading 1, heading 2, heading 3. should show.}}) ;  

CardModel class already getTitle () method, I just do not know how to use it!

  public string getTitle () {Return Title included; }  

If you have a sub-category of this OnCardDimissedListener And pass it to the parameter, something similar:

  Public category MyOnCardDimissedListener OnCardDimissedListener {Private string header; Public MyOnCardDimissedListener (string title) {this.title = title; } @ Override Public Wide On Like () {Log.i ("Swipeable Card", Title); }}  

Then you should use:

  cardModel.setOnCardDimissedListener (New MyOnCardDimissedListener (cardModel.getTitle ()));  

You go there ... Each example of MyOnCardDimissedListener is something that is worthless on my opinion, but in other ways, To move the CardModel object, edit the library source code.


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -