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
kierrie
Jun 7, 2010

TheReverend posted:

Hey dudes, I'm coming from an exclusively C# workplace and I'm having some XML issues. In .NET, XML that was formatted like a datatable was pretty easy to sort through, edit columns, add columns, edit rows, delete rows, add rows, etc.

I can't find any nice easy-to-use class within the Android SDK.
Is there anything I'm missing?

Mono for Android?

Adbot
ADBOT LOVES YOU

Sab669
Sep 24, 2009

Safe and Secure! posted:

One of my friends is not a technical person at all and had no idea that her phone had the option to update OTA from Froyo to Gingerbread. She didn't even know what Froyo or Gingerbread were. It's an ATT Samsung Infuse, some weird Galaxy S II thing with half the CPU cores and half the RAM, so it's not incredibly ancient.

I would surprise if more than the small amount of people willing to stick to Nexus phones for software actually knew anything about their phone OSes other than "it's an Android".

When I was first looking into getting a Droid, I was talking to a friend who I only knew over the internet, asked her if she had a smart phone and she had no idea (later I found out she did indeed have some kind of Droid). Just ordered my first smartphone and I can't wait to get out of work today and actually look at droid development now that it's relevant to me.

duck monster
Dec 15, 2004

Google really does need to figure out how to crack down on manufacturers abandoning phones for update. Like maybe make it a condition of the non GPL/BSD userland that they have to provide updates on an automatic-ish basis.

Its a fairly serious issue for developers. We're talking at work about dropping droid support for clients unless they are prepared to pay a somewhat more substantial price than IOS because of all the version fracturing and the fact we dont like our name associated with "buggy" products. We where surviving on phonegap for a bit, but its becoming clear HTML5 really isn't as appropriate a mobile technology for apps as it was thought 6 months ago, because people just dont seem to like them.

duck monster fucked around with this message at 14:42 on Jul 3, 2012

Doctor w-rw-rw-
Jun 24, 2008

TheReverend posted:

Hey dudes, I'm coming from an exclusively C# workplace and I'm having some XML issues. In .NET, XML that was formatted like a datatable was pretty easy to sort through, edit columns, add columns, edit rows, delete rows, add rows, etc.

I can't find any nice easy-to-use class within the Android SDK.
Is there anything I'm missing?

Perhaps http://code.google.com/p/lambdaj/

Expect for it to be slow as crap. Reflection on Android was super bad before 3.0, and is still slow in general, which means that 75% of your potential users are probably going to feel the performance hit. I haven't used it myself.

Suran37
Feb 28, 2009
I seem to have run into a problem. I am parsing XML data from a website, which runs fine, however when I try to split the resulting info into strings using a delimiter I run into problems. The result I am trying to parse is "2012-07-05 22:26:15|Iska Delmen|1512154763|GoonWaffe|667531913", so I set the delimiter to "|" and try to pull each part using a scanner with .next(), .next(), .nextInt(), .next(), .nextInt(). What I get when I try to print them out is 2, 0, 1, 2 and then it crashes because "-" isn't an integer. So, am I using delimiters wrong or what, because I cannot figure out why it is doing that.

Scaevolus
Apr 16, 2007

Suran37 posted:

I seem to have run into a problem. I am parsing XML data from a website, which runs fine, however when I try to split the resulting info into strings using a delimiter I run into problems. The result I am trying to parse is "2012-07-05 22:26:15|Iska Delmen|1512154763|GoonWaffe|667531913", so I set the delimiter to "|" and try to pull each part using a scanner with .next(), .next(), .nextInt(), .next(), .nextInt(). What I get when I try to print them out is 2, 0, 1, 2 and then it crashes because "-" isn't an integer. So, am I using delimiters wrong or what, because I cannot figure out why it is doing that.

String[] fields = "2012-07-05 22:26:15|Iska Delmen|1512154763|GoonWaffe|667531913".split("|") ?

Sab669
Sep 24, 2009

Anyone know of any good books for writing Android apps, particularly for a Java newbie? I've had about one semester of Java, but all we wrote was console apps in it. It was more of a theory class for data structures & algorithm analysis so it didn't focus a whole lot on the language itself.

kitten smoothie
Dec 29, 2001

How is a screen like this implemented - as a sectioned ListView? The map is not live, it is a static image presumably generated by Google's static map API.

Doctor w-rw-rw-
Jun 24, 2008

kitten smoothie posted:

How is a screen like this implemented - as a sectioned ListView? The map is not live, it is a static image presumably generated by Google's static map API.



I did something like it by writing a custom arrayadapter and overriding getItemViewType, getViewTypeCount, and getView. I ended up with a little messy (but as clean as could be reasonably expected?) hack that required some hacks to make context menus or listfragments work, but I forget how much of this was also because I needed a special view type at the bottom for lazy-loading.

kitten smoothie
Dec 29, 2001

Doctor w-rw-rw- posted:

I did something like it by writing a custom arrayadapter and overriding getItemViewType, getViewTypeCount, and getView. I ended up with a little messy (but as clean as could be reasonably expected?) hack that required some hacks to make context menus or listfragments work, but I forget how much of this was also because I needed a special view type at the bottom for lazy-loading.

Gotcha, I'll give that a try. Thanks.

PastryPup
Mar 11, 2010
I'm developing my Android app for Nook color which runs Froyo. It's a game that locks the canvas and draws like the Lunar Lander example and handles touch events similarly. However, on touch events, the synchronized (surfaceHolder) block only sometimes has an extremely delayed execution (because it can't get the surfaceHolder) and I get an ANR because of it. The app works fine on other Android devices. Does anyone know why I'm not able to get a lock on the surfaceHolder even though the run() function is constantly able to?

Moosechees
Jun 1, 2002

rawr
This thread has saved me so much time. I've got a decade of development experience, but prior to last month I'd never used Eclipse and my only experience with Java was from university. I knew literally nothing about how Android apps worked internally, other than that they were Java.

I spent days learning and messing around, and the best I could come up with was some terrible async HTTP library copied from Stack Exchange and an overly complicated pre-4.0 action bar from the android developer documentation. Not only did I have no idea what was going on under the hood, but it also took 10 lines of code for things I felt should only take 1 or 2.

After discovering actionbarsherlock and aquery in this thread, I no longer feel crushed under tons of arcane crap nobody should have to deal with in 2012.

So, the only remaining piece of the puzzle is push notifications. I assume Google Cloud Messaging is the way to go, right? If so, that seems pretty simple.

kitten smoothie
Dec 29, 2001

Moosechees posted:

So, the only remaining piece of the puzzle is push notifications. I assume Google Cloud Messaging is the way to go, right? If so, that seems pretty simple.

You may also find Parse to be helpful for push. Their free plan gets you a million pushes a month which could well get you covered. It looks a lot simpler to implement in your app and your backend than the Google version; the tradeoff of course is you end up having to pay if you get popular.

https://parse.com/docs/android_guide#push

putin is a cunt
Apr 5, 2007

BOY DO I SURE ENJOY TRASH. THERE'S NOTHING MORE I LOVE THAN TO SIT DOWN IN FRONT OF THE BIG SCREEN AND EAT A BIIIIG STEAMY BOWL OF SHIT. WARNER BROS CAN COME OVER TO MY HOUSE AND ASSFUCK MY MOM WHILE I WATCH AND I WOULD CERTIFY IT FRESH, NO QUESTION
I'm a bit confused about how to install a version of the SDK compatible with Appcelerator. It asks for 2.2, but all I can see in my SDK manager is this:



Anyone know what's going on here? I'm more-or-less a newbie to all this...

Edit: Nevermind, fixed - I did "Packages => Reload" and a whole lot more packages showed up. Weird.

UraniumAnchor
May 21, 2006

Not a walrus.
I need to write something that sends a Notification at some point in the future. Might be a few minutes, might be a few hours. It does NOT need to persist through a device reset, but it needs to persist even if the app gets closed and/or loses focus. Nothing fancy, just a text reminder.

Is there something built-in or something I can go grab that will do this, or am I better off just writing a simple Service myself to handle it?

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

UraniumAnchor posted:

I need to write something that sends a Notification at some point in the future. Might be a few minutes, might be a few hours. It does NOT need to persist through a device reset, but it needs to persist even if the app gets closed and/or loses focus. Nothing fancy, just a text reminder.

Is there something built-in or something I can go grab that will do this, or am I better off just writing a simple Service myself to handle it?

Use these three things:

AlarmManager
PendingIntent
BroadcastReceiver

Basically you'll set an alarm with AlarmManager. You'll set that alarm with a broadcast PendingIntent pointed at your BroadcastReceiver class. When the alarm fires it will run the BroadcastReceiver and in that class you can display your Notification.

Hooray!

Moosechees
Jun 1, 2002

rawr
So, this is more of an Eclipse question, but it only seems to happen with my Android XML files, so hopefully it's not too out of place here.

When I open an xml file and then edit it, then open it again (indirectly, like from selecting an error), it is opened in a new tab instead of switching to the tab that already has the open file in it. That leads to having like 10 tabs of the same xml file open at the same time after a while.

Is there any way to get it to just switch to the tab that's already open?

Gloryhold It!
Sep 22, 2008

Fucking
Adorable
Hi, I'm a newbie Android developer doing a project for college. It's coming along pretty nicely, except for the fact that it looks completely uninteresting. Could someone point me to some resources/guides/whatever I could use as a crash course on styling my text based Android 2.3 application?

Harold Ramis Drugs
Dec 6, 2010

by Y Kant Ozma Post
I have to edit the main.xml file of a program I'm working on (it's part of an exercise from an android book), but there are two different main.xml files in the Eclipse navigator. They are both respectively located in the "menu" and "layout" sub-folders. I'm not sure which one to modify, or if I should modify both. Here is the code I need to insert:

code:
<?xml version="1.0" encoding="utf-8"?>
<com.deitel.cannongame.CannonView
	xmlns:android="http://schemas.android.com/apk/res/android"
	android:id="@+id/cannonView"
	android:layout_width="match_parent"
	android:layout_height="match_parent"
	android:background="@android:color/white"/>

The two different main files already in my project folder contain the following

(menu/main.xml)
code:
<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@+id/menu_settings"
        android:orderInCategory="100" />
</menu>
(layout.xml)
code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:padding="@dimen/padding_medium"
        tools:context=".MainActivity" />

</RelativeLayout>
Which one should I modify? Also, the book doesn't say whether to append or overwrite. Should I append or overwrite?

Doctor w-rw-rw-
Jun 24, 2008

Harold Ramis Drugs posted:

Which one should I modify? Also, the book doesn't say whether to append or overwrite. Should I append or overwrite?
Overwrite the layout one.

"com.deitel.cannongame.CannonView" is a type of view. So is RelativeLayout (it's a ViewGroup actually), and so is TextView. Non-android views have to be fully qualified with the package name, hence com.deitel.cannongame.

IAmKale
Jun 7, 2007

やらないか

Fun Shoe
I installed the most recent 4.1 SDK from scratch and set up a virtual device with the WXGA800-7in preset to emulate developing on a Nexus 7. Aside from giving the device a name, I left everything as-is. Unfortunately, whenever I start it up, it fails to run and spits out the following message:

quote:

Failed to allocate memory: 8
This application has requested the Runtime to terminate it in an unusual way.

Google searches have revealed some people getting around this by lowering the device's RAM to 512 (the preset gives 1024MB) but that didn't work for me. What's going on? Why is my AVD crashing when I start it up?

Lutha Mahtin
Oct 10, 2010

Your brokebrain sin is absolved...go and shitpost no more!

Zaldron posted:

Hi, I'm a newbie Android developer doing a project for college. It's coming along pretty nicely, except for the fact that it looks completely uninteresting. Could someone point me to some resources/guides/whatever I could use as a crash course on styling my text based Android 2.3 application?

There is a design section in the official docs, though I'm not sure if that's what you're looking for. I'm a newbie too and the Metrics and Grids page was enlightening, e.g.:

UraniumAnchor
May 21, 2006

Not a walrus.
Edit: Never mind. Second time in this thread I've figured it out ten minutes after asking.

UraniumAnchor fucked around with this message at 23:03 on Jul 23, 2012

zeekner
Jul 14, 2007

Karthe posted:

I installed the most recent 4.1 SDK from scratch and set up a virtual device with the WXGA800-7in preset to emulate developing on a Nexus 7. Aside from giving the device a name, I left everything as-is. Unfortunately, whenever I start it up, it fails to run and spits out the following message:


Google searches have revealed some people getting around this by lowering the device's RAM to 512 (the preset gives 1024MB) but that didn't work for me. What's going on? Why is my AVD crashing when I start it up?

I have the same issue trying to emulate most XHDPI screens (like the Galaxy Nexus, 1280x720@320ppi). I can't find any info other than I might be exceeding some kind of framebuffer limit. That theory makes sense because I can bypass the problem by setting the resolution lower, but that prevents me from testing layouts for the newest phones.

e: I have 8gb of ram, i3-3120, Radeon HD6850 on Win7 x64. I doubt it's computer specs.

Flash18
Apr 3, 2009
I'm hoping someone here has some experience with HttpUrlConnection, which is causing me a lot of aggravation. The API I'm using insists that that my request needs to use basic authentication, which I assume I'm using properly, as I've just copied to exactly from HttpUrlConnection's page in the API.

None-the-less, I keep returning an IOException any time I try to read the response, with the details being "No authentication challenges found".

I fired off a quick request using curl on the command line, encoded correctly, and the server gave me a correct response.

I tried HttpClient, but I couldn't work out how to use basic authorization with it, but I got a "Not Authorized" response as I expected.

Using an incorrect url in the request will give me 404 error.

I'm assuming now I'm either doing something horribly wrong, or something is up with their server and I need to use preemptive basic authentication. I haven't found anything helpful on preemptive authentication on google, everything I tried still results in the same error.

Doctor w-rw-rw-
Jun 24, 2008

Flash18 posted:

I'm hoping someone here has some experience with HttpUrlConnection, which is causing me a lot of aggravation. The API I'm using insists that that my request needs to use basic authentication, which I assume I'm using properly, as I've just copied to exactly from HttpUrlConnection's page in the API.

None-the-less, I keep returning an IOException any time I try to read the response, with the details being "No authentication challenges found".

I fired off a quick request using curl on the command line, encoded correctly, and the server gave me a correct response.

I tried HttpClient, but I couldn't work out how to use basic authorization with it, but I got a "Not Authorized" response as I expected.

Using an incorrect url in the request will give me 404 error.

I'm assuming now I'm either doing something horribly wrong, or something is up with their server and I need to use preemptive basic authentication. I haven't found anything helpful on preemptive authentication on google, everything I tried still results in the same error.

A quick google reveals http://stackoverflow.com/questions/1968416/how-to-do-http-authentication-in-android

Also, Google don't give a gently caress about HTTP Basic Auth. :argh:

Flash18
Apr 3, 2009
Unfortunately I've already gone over that and tried it, didn't work :(

edit: Got it working using AQuery, although I need to use their deprecated auth library.

Flash18 fucked around with this message at 15:45 on Jul 25, 2012

Sereri
Sep 30, 2008

awwwrigami

A few weeks ago I reinstalled windows and everything. I downloaded the current version of eclipse, installed all the plugins. Now that I actually started to program again I ran into this weird problem: If I connect my phone and try to run the app on it, eclipse will load for a while then crash because it runs out of heapspace. However if I remove the phone and run it in the emulator, everything is fine. In fact, if I reconnect the phone it will now run fine on that too.

:psyduck:

River
Apr 22, 2012
Nothin' but the rain
Just downloaded eclipse and everything else last week and have been trawling through the android docs stuff for a bit. A lot seems to be wrong, leaving me to google for the correct strings etc. Ok for the most part, though.

Now I've moved to making my own project and have decided on a mildot ranger for DayZ. I've been reading various parts of the official docs for the better part of 2 hours now trying to piece this together. Fun though, and a good learning venture I guess.

mugrim
Mar 2, 2007

The same eye cannot both look up to heaven and down to earth.
I did some VERY minor programming in high school (C++ class for like a year), would it be absolutely insane to try and learn how to make an Android App?

Sab669
Sep 24, 2009

mugrim posted:

I did some VERY minor programming in high school (C++ class for like a year), would it be absolutely insane to try and learn how to make an Android App?

I want to start Droid development soon, but I work a good amount in the day and am finishing my last semester of classes so that leaves little time for pet projects. I am however taking a Mobile Dev course this semester, which [unfortunately] only touches iOS development.

So, bearing in mind that I can't say anything about Droid for sure but even as a student with a decent education in programming I would say Objective C is ugly (though I can read it well enough because I've been coding for 4 years), andXCode (the IDE for iOS development from Apple) is not super intuitive. Maybe that's just because I'm not used to the Mac environment? So based off that, I'd say it could actually be fairly tough to jump into Droid dev if you've had very little experience. Of course, everyone learns differently and you might love Java and pick it up no problem. I am not a fan of the language and I don't like Eclipse so I guess that's also deterred me from picking up the Droid book I bought.

I dunno man, no harm in trying either way. I can say I would probably get overwhelmed though.

Sab669 fucked around with this message at 20:16 on Jul 27, 2012

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

mugrim posted:

I did some VERY minor programming in high school (C++ class for like a year), would it be absolutely insane to try and learn how to make an Android App?

You'll probably want to read a Java book first, but it's certainly possible.

Lutha Mahtin
Oct 10, 2010

Your brokebrain sin is absolved...go and shitpost no more!

mugrim posted:

I did some VERY minor programming in high school (C++ class for like a year), would it be absolutely insane to try and learn how to make an Android App?

It depends on how complicated an app you want to make, and how much time and effort you're willing to invest. Do you want to make a 3D real-time game, and you've never studied higher-level math? Then you'll probably have a tough time. Do you want to make a fart noise app? Sure, go hog wild.

kitten smoothie
Dec 29, 2001

Thermopyle posted:

You'll probably want to read a Java book first, but it's certainly possible.

As long as you're on Amazon buying a Java book, buy this too.

http://www.amazon.com/dp/ASIN/1118102274

Gangsta Lean
Dec 3, 2001

Calm, relaxed...what could be more fulfilling?
Does anyone do Android development in VirtualBox? Is it supposed to work?

I'm having issues and don't know where to begin with troubleshooting, no idea if my issues are related to VirtualBox, my laptop's Optimus graphics, or if I've simply misconfigured something during setup. I've been following the official installation instructions from Google as much as possible.

My first guess would be this is related to VirtualBox in some way, but maybe not. I made a small proof of concept app two years ago for another project and I'm pretty sure I did all development for that in VirtualBox, though the host machine was different. I'm on Virtualbox 4.1.14, so I'm a few versions behind the current release of 4.1.18.

Host OS: Windows 7 64-bit
VirtualBox Guest OS: Ubuntu 12.04 64-bit (this is a clean snapshot with nothing installed besides the OS)

I have 8 GB of RAM, with 4 GB allocated to the guest OS.

Installed today:
Oracle JDK 1.7.0_05 64-bit
Eclipse 4.2
Android SDK r20.0.1
ia32-libs-multiarch - I don't remember why, but something wanted this.

I've gotten so far as step #5 of "Run on the Emulator" here. The emulator device I'm trying to launch is an Android 4.1 WXGA720 with default settings and no SD card. I've tried a few others and they behave the same.

I got an error with "failed to load libGL.so" when starting up my device using virtual device manager. A google search result said to install this:
sudo apt-get install libgl1-mesa-dev:i386

I no longer get the error, but my device still doesn't start. The emulator window opens, there's a title bar and minimize/close buttons, but the window's client area is black, no Android logo or anything. I haven't found anything from googling that fixes it. I've read the emulator is slow to boot up the first time, but no mention of how slow. It's been sitting there for half an hour, so it must not be working. I can't close the emulator window using the X button - nothing happens. I have to kill the emulator by pid. ps shows the emulator is using almost 100% CPU, 74 MB RSS, and 1.8 GB VSZ.

The devices window in Eclipse lists my device, but shows it as offline and something is labeled as "unknown" (there are no column headings).

Is there something else I need to install? There are no other error messages that I've seen.

mmm11105
Apr 27, 2010
Is there a simple way in android to style a textview like the headers in Google's own holo apps (the things labeled "SECTION" here http://developer.android.com/design/media/metrics_forms.png )?

Figured I'd ask before trying to reverse engineer them myself.

Cat Plus Plus
Apr 8, 2011

:frogc00l:

Gangsta Lean posted:

I no longer get the error, but my device still doesn't start. The emulator window opens, there's a title bar and minimize/close buttons, but the window's client area is black, no Android logo or anything.

If it's using OpenGL, then make sure you've installed Guest Additions on the guest OS and enabled hardware 3D acceleration in VM settings. Using newest VBox version is probably a good idea, too. It might still not work, though, because VBox OpenGL sometimes does that. :shrug:

Another option: it works, but is really, really slow. Does your host CPU have hardware virtualisation support?

Either way, I don't really see much benefit of doing it this way. Running Android itself (Android-x86, specifically) in VirtualBox makes more sense, because you're virtualising instead of emulating ARM, so it works infinitely faster. Of course your code cannot depend on any native ARM code for this to work, so that's one downside.

Harold Ramis Drugs
Dec 6, 2010

by Y Kant Ozma Post
I've been assigned the following program for my android development class:

Ninja Game

I can't figure out how to successfully import the AndEngine.java file into my project. Specifically, i'm stuck on the step where we need to create a "SimpleGame" class by extending the "BaseGameActivity" class from AndEngine. My eclipse (I'm using Juno) doesn't recognize a BaseGameActivity class to extend from.

Moey
Oct 22, 2010

I LIKE TO MOVE IT

Gangsta Lean posted:

Does anyone do Android development in VirtualBox? Is it supposed to work?

Cannot offer any help, but why are you developing in a vm?

Adbot
ADBOT LOVES YOU

Harold Ramis Drugs
Dec 6, 2010

by Y Kant Ozma Post
Edit: I need to keep fewer forums windows open at the same time...

Harold Ramis Drugs fucked around with this message at 04:40 on Aug 4, 2012

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