0

I am trying to create a sample glass application using below tools -

GDK Preview API 19 Java 6 Android 4.4.2

I have added an activity as below -

public class HelloWorldActivity extends Activity{

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);


        Context con = this;
        Card myCard = new Card(con);
        myCard.setText("Hello, World!");         
        myCard.setFootnote("First Glassware for Glass"); 
        View cardView = myCard.getView();
        setContentView(cardView);

        //setContentView(R.layout.activity_main);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();
        if (id == R.id.action_settings) {
            return true;
        }
        return super.onOptionsItemSelected(item);
    }
}

It gives an error for Card class not found, I have added the gdk.jar(21 KB) but still it throws an error. Please advise Also I have checked the Card class code and its a stub class and does not contain implementation. Could you please provide correct gdk jar with correct implementation ?

1 Answers1

0

If you are trying to make a simple HelloWorld app, you can follow THIS

I got it to work just today just by doing so. Please see my answer HERE

Community
  • 1
  • 1
JavaMaMocha
  • 70
  • 1
  • 11
  • thanks, I am trying to create HelloWorld app only.I have tried to follow the links specified but still the issue persists. I am getting an exception "java.lang.RuntimeException: Stub!" – user3848026 Jul 18 '14 at 06:05
  • What IDE are you using? – JavaMaMocha Jul 18 '14 at 06:50
  • I am using Eclipse Juno – user3848026 Jul 18 '14 at 06:55
  • Android sdk 19 and GDK Preview – user3848026 Jul 18 '14 at 06:56
  • No, I have created an AVD for Glass and trying to run on it. I can share the screenshots of the actual implementation but how can I upload it here ? – user3848026 Jul 18 '14 at 06:58
  • Have you used the same configuration and is it worked for you ? – user3848026 Jul 18 '14 at 07:02
  • I think the Exception is caused by not running it on Glass. I'm not sure GDK will work with non-glass device. Check out the post [HERE](http://stackoverflow.com/questions/16036245/is-there-an-android-based-google-glass-emulator) – JavaMaMocha Jul 18 '14 at 07:04
  • Yes, I used the exact same code with the only exception to add the permission as shown in the link. And it worked. – JavaMaMocha Jul 18 '14 at 07:06
  • So the difference is that you have executed it on glass and I am trying it on AVD emulator – user3848026 Jul 18 '14 at 07:12
  • I'd assume so given the information. Did the Card Class error still occur? You can try delete and re-install your Google Development Kit from SDK Manager, but I doubt that you can run Glass code just with AVD emulator. – JavaMaMocha Jul 18 '14 at 07:23
  • Could you please confirm the size of the gdk.jar file size ? As this jar is creating an issue for my case. Does you gdk jar has the implementation or its a stub class holding jar? – user3848026 Jul 18 '14 at 07:24
  • How did you add your GDK? You should install it from SDK Manager. When you start a new project, set the Minimum and Require SDK to API19 and select GDK for "Compile With" – JavaMaMocha Jul 18 '14 at 15:19
  • Yes, I have done the same thing, installed GDK from SDK manager and the minimum and require sdk to API 19 for new project and GDK for compilewith. How can I share my codebase? Is there any way where I can upload so you will get clear picture for issue ? – user3848026 Jul 18 '14 at 16:00
  • my email: masterofpudge@gmail.com – JavaMaMocha Jul 18 '14 at 16:02
  • The static card we need to use through gdk jar only or we need to write our own implementation for it ? – user3848026 Jul 21 '14 at 09:22
  • through gdk. https://developers.google.com/glass/develop/gdk/reference/com/google/android/glass/app/Card – JavaMaMocha Jul 22 '14 at 00:56