I updated my Google Glass GDK from xe12 to xe16. My app was working perfectly well up until the update. Now when I run the app the glass throws:
java.lang.NoSuchMethodError: com.google.android.glass.app.Card.setText
I have followed the instructions posted in the discussions below:
[link 1] (NoSuchMethodError for Card.setText() in XE16)
[link 2] (Google Glass updated to KitKat, but new methods aren't showing up in Eclipse?)
However I still am not able to run my code.
I have made sure everything is up to date in Eclipse, my project's build target is the Glass Development Kit Preview (KitKat) and I have restarted Eclipse.
Any Suggestions?
here is the code for creating the Card:
import java.util.ArrayList;
import android.content.Context;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import com.Y2014S.MirrorEdge.common_functions.CardScrollViewManager;
import com.google.android.glass.app.Card;
import com.google.android.glass.widget.CardScrollView;
public class MainActivity extends ActionBarActivity
{
private ArrayList<Card> mCards;
private CardScrollView mCardScrollView;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
mCards = new ArrayList<Card>(10);
mCards = createCard(mCards, this, "hello");
CardScrollViewManager ScrollManager = new CardScrollViewManager(mCards);
mCardScrollView = ScrollManager.createCardScrollView(mCardScrollView,
getApplicationContext());
setContentView(mCardScrollView);
}
public static ArrayList<Card> createCard(ArrayList<Card> mCards,
final Context appContext, final String headerText)
{
final Card newCard = new Card(appContext);
CharSequence cs = headerText;
newCard.setText(cs);
mCards.add(newCard);
return mCards;
}// end of createCard method
}
NOTE: I am adding the Card to the ArrayList in the method itself and returning the ArrayList to the Main Activity for later use.
Thanks!