Put your problem here if it does not fit any of the other categories.


Postby rex64 » Fri Feb 11, 2011 1:31 am

I am trying to find examples of all of the basic android code examples. I tried searching this site, and a number of places. Also, I am looking for someone who has Google Talk or Yahoo so I can ask code questions.

Here is what I am trying to figure out now. I want to do something like this:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. struct Date {
  2.     unsigned short year;
  3.     unsigned byte month;
  4.     unsigned byte day;
  5. };
  7. union Number {
  8.     int   asInt;
  9.     float asFloat;
  10.     char  asString[12];
  11. };
Parsed in 0.011 seconds, using GeSHi

I did not see anyone logged into the IRCs:
#android General discussion about Android (and Android development).
#android-dev Discussion focused on developing Android apps.
Posts: 3
Joined: Thu Feb 03, 2011 5:01 pm


Re: Struct

Postby jonbonazza » Thu Mar 10, 2011 2:14 am

1) Structs do not exist in Java, and thus in the Android SDK.
Just use a class.

2) unsigned datatypes also do not exist in java/Android SDK. You can, however, use a proper signed datatype along with a bitwise &. In this case, however, your best bet is to just use the next size up.

The above would look like this in java
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. class Date
  2. {
  3.      int year;
  4.      int month;
  5.      int day;
  6. }
Parsed in 0.012 seconds, using GeSHi
Master Developer
Master Developer
Posts: 665
Joined: Thu Jul 15, 2010 2:58 pm
Location: WV USA


Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 5 guests