Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
n0manarmy
Mar 18, 2003

I've been working at trying to do some small inconsequential games over the past year and I keep hitting road blocks in my planning and development. Are there any guides on there for approach what is normally Java only development to accommodate android development?

An example of one of the many small issues I'm running into:

I'll create a java object and in the constructor for the object I would set a string value for a string data type, however Android wants to use the strings.xml for all the storage of string data. So do I just initialize the string value to null and then figure out how to access the strings.xml file for the data type or am I completely off base?

If I could find some information or guides out there that hand hold for java to java/android that would probably clear up a lot of my frustration.

Adbot
ADBOT LOVES YOU

n0manarmy
Mar 18, 2003

I think it was the (Context myContext) piece that I was not adding to my constructor for the data type. Because of this I wasn't able to access the strings.xml. These are little, yet big, things that I'm trying to work through that confuse me coming from straight Java.

code:
public class GameData {
	
	void CreatePlayers(Context myContext) {
		
		ObjPlayer player1 = new ObjPlayer();
		player1.setName(myContext.getString(R.string.player_1));
		ObjPlayer player2 = new ObjPlayer();
		player2.setName(myContext.getString(R.string.player_2));
				
	}

n0manarmy
Mar 18, 2003

Has anyone had any experience with theming their apps? I'm trying to theme 4 buttons and I want borderless buttons. However when I try to combine styles to simplify the app I can't.

Single button

code:
    <Button
        android:id="@+id/reboot"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/reboot_label"
        android:onClick="doReboot" 
        style="?android:attr/borderlessButtonStyle" />
I can't figure out how to put the above line style="?android:attr/borderlessButtonStyle" in to the below style sheet without it pitching a fit.

code:
<style name="Theme">
        <item name="android:layout_width">fill_parent</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:textColor">#FF8800</item>
        <item name="android:typeface">serif</item>
	</style>
I cannot do both styles because I get an error so I'm trying to find a way to put the borderlessButtonStyle in to the Theme I'm creating

code:
<Button
error-> style="@style/Theme"
        android:id="@+id/reboot"
        android:text="@string/reboot_label"
        android:onClick="doReboot" 
error-> style="?android:attr/borderlessButtonStyle" />
    
EDIT:

I ended up fixing the issue by embedding android:background="?android:attr/selectableItemBackground" in to the theme which gave me the same effect.

n0manarmy fucked around with this message at 21:23 on Aug 20, 2012

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply