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
Tunga
May 7, 2004

Grimey Drawer

Salvador Dalvik posted:

Give this a shot:
http://jgilfelt.github.io/android-actionbarstylegenerator/

It has an option to customize the overflow menu color (but it's flaky in ABS, I've been meaning to try it in ABC). I forget the exact method to customize that color, but you can set a unique color in that utility and look at the results. I think it might have involved a 9-patch image as well, so look at the resources.
I should have mentioned this too, I tried this thing earlier but it doesn't have a combination that works. You either end up with black text on the Action Bar or white text on the overflow.

But I'll grab a couple of close-ish outputs and see if I can figure out a way to mash them together.

If not I'll just use the Dark overflow instead.

Tunga fucked around with this message at 00:11 on Aug 19, 2013

Adbot
ADBOT LOVES YOU

melon cat
Jan 21, 2010

Nap Ghost
Just starting up in Android development. A quick question about creating an AVD. I want to create one that emulates my current Samsung Galaxy Ace. This guide on Tutsplus says that I need to download manufacturer-supplied add-ons to do exactly this, but it's not really telling me how to find those. Where are you supposed to get these files?

Also, I know that this is such a rookie question, but this particular guide also uses examples that involve the use of the command prompt (but it offers no explanation on how to set it up). I'm trying to use the Run > cmd from the Start menu, but that's not working at all. Is there an alternate command line that I'm suppose do to be using from the Android SDK, or something?

melon cat fucked around with this message at 03:46 on Aug 19, 2013

Angryhead
Apr 4, 2009

Don't call my name
Don't call my name
Alejandro




The regular Android emulator is terrible, give Genymotion a shot.

Tunga
May 7, 2004

Grimey Drawer
Just to close off my issue regarding using Dark style action bar with a Light overflow menu, all I actually needed to do was override the overflow icon with the one from here (and similar). Code:

code:
    <style name="AppTheme"
           parent="android:Theme.Holo.Light">
        <item name="android:actionBarStyle">@style/AppActionBarStyle</item>
        <item name="android:actionOverflowButtonStyle">@style/AppOverflowButtonStyle</item>
        <item name="android:actionMenuTextColor">#FFFFFF</item>
    </style>

    <style name="AppActionBarStyle"
           parent="android:Widget.Holo.Light.ActionBar.Solid.Inverse">
        <item name="android:background">#AA66CC</item>
        <item name="android:titleTextStyle">@style/AppActionBarTitleText</item>
    </style>

    <style name="AppActionBarTitleText"
           parent="android:TextAppearance.Holo.Widget.ActionBar.Title">
        <item name="android:textColor">#FFFFFF</item>
    </style>

    <style name="AppOverflowButtonStyle"
           parent="android:Widget.Holo.ActionButton.Overflow">
        <item name="android:src">@drawable/ic_menu_overflow</item>
    </style>

Claeaus
Mar 29, 2010
I've started looking into AsyncTask and planning on implementing it in my project. However, I would prefer if I could keep them separate from the rest of the code as I've got quite a nice MVC thing going on.

The problem is that I have some methods that are quite time consuming which makes it a bit hard to find a place to put the publishProcess() call.


For example:
code:
doInBackground()
{
    model.timeConsumingCalculations();
    publishProcess();
}
I don't like the idea of putting the AsyncTask inside the model as that would kind of mix it together with the UI I feel. Or should I use the Runnable class and make the model itself run on different threads or something. What would be a good way of solving this and keeping the different parts encapsulated?

A COMPUTER GUY
Aug 23, 2007

I can't spare this man - he fights.

Claeaus posted:

I've started looking into AsyncTask and planning on implementing it in my project. However, I would prefer if I could keep them separate from the rest of the code as I've got quite a nice MVC thing going on.

The problem is that I have some methods that are quite time consuming which makes it a bit hard to find a place to put the publishProcess() call.


For example:
code:
doInBackground()
{
    model.timeConsumingCalculations();
    publishProcess();
}
I don't like the idea of putting the AsyncTask inside the model as that would kind of mix it together with the UI I feel. Or should I use the Runnable class and make the model itself run on different threads or something. What would be a good way of solving this and keeping the different parts encapsulated?

Awhile ago on a project in school, one of my classmates did something like this:
code:
public class ExecuteOnBackgroundThreadTask extends AsyncTask<Void, Void, Void> {
  Runnable preExecute, inBackground, postExecute;
  Handler handler;

  public ExecuteOnBackgroundThreadTask(Runnable preExecute, Runnable inBackground, Runnable postExecute) {
    this.preExecute = preExecute;
    this.inBackground = inBackground;
    this.postExecute = postExecute;
  }

  public void onPreExecute() {
    handler = new Handler();
    if (preExecute != null) {
      handler.post(preExecute);
    }
  }


  public Void doInBackground(Void... params) {
    handler = new Handler();
    if (inBackground != null) {
      handler.post(inBackground);
    }
    return null;
  }

  public void onPostExecute(Void result) {
    handler = new Handler();
    if (postExecute != null) {
      handler.post(postExecute);
    }
  }
}
in a utility class. He used it whenever he needed operations to run in the background that don't need to return any values.

evilentity
Jun 25, 2010
What are you guys using for prototyping the gui? I remember seeing some html5 templates or whatever but cant find them. There are also some psd graphics, but that doesnt sound very flexible.

JawnV6
Jul 4, 2004

So hot ...
How easy is it to use the USB port on Android?

OTG seems like overkill and puts way too much burden on the phone. Ideally, I'd have an app on the Android device expose a simple interface over USB that the host would poke and prod at, making the app show data. Basically, can I take over the USB port and use it like I would if I'd designed the whole device or is Mass Storage the only way it'll ever show up?

Targeting a single device for what that matters.

zeekner
Jul 14, 2007

JawnV6 posted:

How easy is it to use the USB port on Android?

OTG seems like overkill and puts way too much burden on the phone. Ideally, I'd have an app on the Android device expose a simple interface over USB that the host would poke and prod at, making the app show data. Basically, can I take over the USB port and use it like I would if I'd designed the whole device or is Mass Storage the only way it'll ever show up?

Targeting a single device for what that matters.

Is the host a PC or a microcontroller? There is a USB accessory kit based on AVR8 and ARM32 MCUs, and it exposes a high-speed serial interface. Its compatible with most devices released in the last year or two.

Otherwise, some apps abuse ADB as a bridge to smuggle data. The best example would be PDANet, which uses that method to enable tethering on devices without root access.

JawnV6
Jul 4, 2004

So hot ...

Salvador Dalvik posted:

There is a USB accessory kit based on AVR8 and ARM32 MCUs, and it exposes a high-speed serial interface. Its compatible with most devices released in the last year or two.

Micro. This is precisely what I need. Thanks!

I've found the AOA documentation on the Android site and it really sounds like they've got a kit, but I'm lost as to where I'd order one. This is enough to get me started though

zeekner
Jul 14, 2007

JawnV6 posted:

Micro. This is precisely what I need. Thanks!

I've found the AOA documentation on the Android site and it really sounds like they've got a kit, but I'm lost as to where I'd order one. This is enough to get me started though

The easiest one to find is probably the Arduino ADK, which is the simplified version of the official ADK 2011. It's an Atmega2560 in USB host mode, I used one for a personal project a year ago and it worked pretty well. Only downside is that the phone expects to charge from it, so battery powered hosts won't work very well.

There is the ADK 2012, which is the ARM cortex version with audio capability, but I haven't used it yet.

melon cat
Jan 21, 2010

Nap Ghost

Angryhead posted:

The regular Android emulator is terrible, give Genymotion a shot.
So glad you told me about this. I found the original emulator to be really cumbersome. Thanks!

BlockChainNetflix
Sep 2, 2011

melon cat posted:

So glad you told me about this. I found the original emulator to be really cumbersome. Thanks!

Seconding this. I'm now kinda concerned it's running too fast compared to a real Android device. Also it has USB support.

Hughlander
May 11, 2005

Are there any best practices for dealing with color profiles differences across devices? I have some graphics designed for iOS and their more muted colors that look like clown vomit when loaded on a Samsung device. Up till recently you could set up color profiles as a user on the Samsung but they removed that. Is there anything that can be done programatically?

admiraldennis
Jul 22, 2003

I am the stone that builder refused
I am the visual
The inspiration
That made lady sing the blues

BLT Clobbers posted:

Seconding this. I'm now kinda concerned it's running too fast compared to a real Android device. Also it has USB support.

Haha, yeah, it does run faster than actual phones.

Genymotion is an amazing tool and I use it all the time, but it's not exactly good for testing, say, animations, memory usage, and screen size factors. You still need the AVD emu and real phones for lots of polish stuff.

Volguus
Mar 3, 2009
My company recently started to display some interest in developing for Android. I have never written a line of code for this OS, so I am doing a lot of reading nowadays. One of the applications that we want to develop is a service that will be made available for free on Google Play, but that will offer paid downloadable content to allow it to do more things (it's a text to speech engine, and we want to sell various languages/countries/variants).

Now, from all the reading that I've done, it appears that the In-App billing API only provides a way to associate product IDs (SKUs) with your application, and the google servers only tell you what is available and what did the user buy so far. Additionally, should the user want to buy an additional product, they're quite handy. The question I have: what about the data? In my case the language file. Do I have to bundle everything that I have with the main application? The problem with that is that I will have to update the application when new languages become available (as they are developed).

Or do I have to host a service myself that the application can use to download the content (and query for what's available)?

All that I could see from the various articles and the google docs is that i essentially only have these 2 options (there is that extension APK as well, up to 2GB, but that still requires publishing and users to update their existing app).


Am I missing something here? Is there a way to have Google Play host everything for me (the various packages) and for users to just buy them? I thought about just publishing different APKs (one the main service, and the rest as languages), but then how do I find out what's installed and what's not? The androidmarketapi library doesn't look very appealing since it's a 3rd party library that google can choose to break at any time.


What did you guys do when you had such a requirement?

JawnV6
Jul 4, 2004

So hot ...

Salvador Dalvik posted:

Only downside is that the phone expects to charge from it, so battery powered hosts won't work very well.

Running up against this now :/ Is there any way to disable charging? The naive thought to drop the 5v just made it think the cable was gone :v:

Glimm
Jul 27, 2005

Time is only gonna pass you by

rhag posted:

Or do I have to host a service myself that the application can use to download the content (and query for what's available)?

This would work, I think this is how SwiftKey etc. do language packs I think.

quote:

Am I missing something here? Is there a way to have Google Play host everything for me (the various packages) and for users to just buy them? I thought about just publishing different APKs (one the main service, and the rest as languages), but then how do I find out what's installed and what's not? The androidmarketapi library doesn't look very appealing since it's a 3rd party library that google can choose to break at any time.

This is another option. One can use the PackageManager API to determine what the user has installed. To share data between the packs and the main app you might want to use a shared user id. There might be better ways to handle that though - I've never done something like that.

Volguus
Mar 3, 2009

Glimm posted:

This is another option. One can use the PackageManager API to determine what the user has installed. To share data between the packs and the main app you might want to use a shared user id. There might be better ways to handle that though - I've never done something like that.

Hmm...didnt know about the shared user id, yea, that could possibly work. Thanks.

zeekner
Jul 14, 2007

JawnV6 posted:

Running up against this now :/ Is there any way to disable charging? The naive thought to drop the 5v just made it think the cable was gone :v:

Not that I'm aware of, but I'm no EE. For that project I ended up using a Bluetooth serial adapter (like this or a cheap ripoff). The android bluetooth API has good support for the RFCOMM profile so it worked pretty well, but you have all the extra annoyance of managing bluetooth devices.

Tunga
May 7, 2004

Grimey Drawer

rhag posted:

Hmm...didnt know about the shared user id, yea, that could possibly work. Thanks.
There are quite a few apps which use additional "apps" for things like themes or plugins. The first one that comes to mind which is opensource is DashClock. Perhaps you can get some clues about how to approach it from that code.

IAmKale
Jun 7, 2007

やらないか

Fun Shoe
Is it strange to put in an offline ad banner?

My app is free to download with IAP to disable ads. In earlier releases, users could use my app on their offline device as though they'd purchased the no-ads IAP. I didn't think that was fair to paying users (or me), so I put in a banner that prompts people to buy the IAP in instances when the AdMob server couldn't be contacted.

At least one person responded negatively to it, though, so now I'm wondering if I'm going to shoot myself in the foot in the long-term.

Doctor w-rw-rw-
Jun 24, 2008

Karthe posted:

Is it strange to put in an offline ad banner?

My app is free to download with IAP to disable ads. In earlier releases, users could use my app on their offline device as though they'd purchased the no-ads IAP. I didn't think that was fair to paying users (or me), so I put in a banner that prompts people to buy the IAP in instances when the AdMob server couldn't be contacted.

At least one person responded negatively to it, though, so now I'm wondering if I'm going to shoot myself in the foot in the long-term.

Mobile connectivity is generally poo poo. Sacrificing usability to do right by your paying users in this way won't net you any more money, and it destroys your freemium funnel. That's two pretty lovely alternatives. Is there a third?

IAmKale
Jun 7, 2007

やらないか

Fun Shoe

Doctor w-rw-rw- posted:

Mobile connectivity is generally poo poo. Sacrificing usability to do right by your paying users in this way won't net you any more money, and it destroys your freemium funnel. That's two pretty lovely alternatives. Is there a third?
Honest question, am I sacrificing usability by placing a "tap here to get rids of ads" view that's the same size as an ad the user would see if they were online? The ad's not an interstitial, and it's only a 50dp tall TextView located at the bottom of the screen in the same container that an ad would appear.

And what do you mean by, "it destroys your freemium funnel"? Just to clarify, my app is a Japanese-English dictionary - there's nothing freemium in my app. All functionality is enabled regardless of whether the user has purchased the upgrade to remove ads. It seemed to be the easiest way to get people to use the app while still leaving open a small window for people to support my work.

As for a third alternative, there's not a whole lot I have to work with. Like I said earlier, all functionality is available to users the moment they download the app. I could just charge for the app, but it seems pretty common knowledge that that monetization model is more successful on iOS than on the Android side of things.

This is my first Android app rodeo, so I'm honestly not sure what works or doesn't work when it comes to monetizing apps.

Doctor w-rw-rw-
Jun 24, 2008

Karthe posted:

Honest question, am I sacrificing usability by placing a "tap here to get rids of ads" view that's the same size as an ad the user would see if they were online? The ad's not an interstitial, and it's only a 50dp tall TextView located at the bottom of the screen in the same container that an ad would appear.

And what do you mean by, "it destroys your freemium funnel"? Just to clarify, my app is a Japanese-English dictionary - there's nothing freemium in my app. All functionality is enabled regardless of whether the user has purchased the upgrade to remove ads. It seemed to be the easiest way to get people to use the app while still leaving open a small window for people to support my work.

As for a third alternative, there's not a whole lot I have to work with. Like I said earlier, all functionality is available to users the moment they download the app. I could just charge for the app, but it seems pretty common knowledge that that monetization model is more successful on iOS than on the Android side of things.

This is my first Android app rodeo, so I'm honestly not sure what works or doesn't work when it comes to monetizing apps.

I misread. I thought your app disables itself if the ad doesn't fill. Yeah, just make it less convenient for free users vs paid users. People determined to not spend money will do many things to not pay.

Doctor w-rw-rw- fucked around with this message at 01:31 on Sep 3, 2013

kitten smoothie
Dec 29, 2001

Doctor w-rw-rw- posted:

Mobile connectivity is generally poo poo. Sacrificing usability to do right by your paying users in this way won't net you any more money, and it destroys your freemium funnel. That's two pretty lovely alternatives. Is there a third?

Maybe a happy medium is that if AdMob is unavailable, you also check if you can DNS resolve play.google.com and get a route to it. Only display the "buy the IAP" banner if both conditions are true.

That way, if your user is really, truly offline, then you don't bug them. After all they can't buy your IAP if they don't have an internet connection.

On the other hand, if they're a rooted user who blackholed AdMob in their /etc/hosts, and they're butthurt because they're still seeing a banner, then screw them.

Glimm
Jul 27, 2005

Time is only gonna pass you by

Looks like 4.4 KitKat has been announced, no SDK updates yet though:
http://www.android.com/kitkat/

A COMPUTER GUY
Aug 23, 2007

I can't spare this man - he fights.

Glimm posted:

Looks like 4.4 KitKat has been announced, no SDK updates yet though:
http://www.android.com/kitkat/



Boy, isn't it great that there's gonna be another new Android version? 4.3's been out for like a whole month or something!

Doctor w-rw-rw-
Jun 24, 2008

Ulysses S. Grant posted:



Boy, isn't it great that there's gonna be another new Android version? 4.3's been out for like a whole month or something!

Psh. You effectively have a 2.3 target and a 4.0+ target. That's a piece of cake next to the Eclair-Gingerbread-Honeycomb compatibility I had to do back in my day, when we had to walk uphill both ways (granted, in SF, you still generally have to literally walk uphill both ways). Gone are the days of lovely incomplete SQLite support, a missing String.isEmpty implementation, and poisoned HttpURLConnection connection pools.

*shakes cane*

zeekner
Jul 14, 2007

Besides, Google's pretty much given up on core OS changes, it's all Play services and support library additions from here on out.

Yay, I guess?

Doctor w-rw-rw-
Jun 24, 2008

Salvador Dalvik posted:

Besides, Google's pretty much given up on core OS changes, it's all Play services and support library additions from here on out.

Yay, I guess?

Well, they moved core OS apps from the OS to the Play Store, more like. Makes sense that a lot of that stuff doesn't need to be carrier-certified and would benefit from a more iterative update cycle. I think having to live on their own platform will help them make it more livable for all of their developers.

Now if only Android had an animation framework that didn't totally blow.

Peanut and the Gang
Aug 24, 2009

by exmarx
Greetings androidians *chuckles heartily*

In my app, I (my coworker) have added a new url scheme called poop:// so you can put poop://pasta/ in the browser and it'll forward to my app and do whatever. This is the part of the code that adds it, I'm pretty sure, in the android manifest.

code:
<intent-filter>
    <data     android:scheme="poop" />                                
    <action   android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.BROWSABLE" />
    <category android:name="android.intent.category.DEFAULT" /> 
</intent-filter>
Now in the mail app, urls such as http://www.google.com are automatically linkified so people can click them, but looking at an email with poop://pasta/ doesnt automatically get linkified! :wth:
But that's something I want.

Is this something I need to add a permission for, a la <uses-permission android:name="android.permission.INTERNET" /> or what.

What do I do! Please help me, android buffs! I need to dip into your pool of knowledge!

5TonsOfFlax
Aug 31, 2001
Why would you do that, when you could actually use http and your real domain name? Then for public content with these urls, people with the app get the choice of opening it in the app and people without get a webpage you serve at that URL.

Peanut and the Gang
Aug 24, 2009

by exmarx

5TonsOfFlax posted:

Why would you do that, when you could actually use http and your real domain name? Then for public content with these urls, people with the app get the choice of opening it in the app and people without get a webpage you serve at that URL.

Duuuuuuude, there's a whole bunch of other poo poo its used for, so much that I dont even know it all. These urls are auto-generated from our app and just used as easy links to get to parts of the app or export/import data to/from other devices. Sending the url as an email is one of the ways to transfer the information to another device.
I'm probably gonna sound like a douchehole when I say this, but I just want this defect fixed by friday because the higher ups want it fixed by then and I dont want anyone on my team to get decapitated from the fallout if anything goes into disarray.

Glimm
Jul 27, 2005

Time is only gonna pass you by

5TonsOfFlax posted:

Why would you do that, when you could actually use http and your real domain name? Then for public content with these urls, people with the app get the choice of opening it in the app and people without get a webpage you serve at that URL.

One reason to do that would be to have one link you can email out to all mobile users as iOS doesn't support redirecting http://foo to a particular application.

I'm not sure of a solution to this problem other than sending out two links, but I'd be interested in hearing what you come up with. Have you tried sending the email as html and having an explicit anchor tag?

Glimm fucked around with this message at 03:37 on Sep 5, 2013

Peanut and the Gang
Aug 24, 2009

by exmarx
Yeah, we got poop://blah/ working in iOS, and mail.app linkifies it right which is super duper (mail.app did have a problem with long urls but I got that sorted out today). Now we want it to work on android too.

Glimm posted:

Have you tried sending the email as html and having an explicit anchor tag?
Our app pretty much sends you to the compose email screen with the url and lets the user add any other text they want, so html email is a no-can-do.

Peanut and the Gang fucked around with this message at 03:41 on Sep 5, 2013

Glimm
Jul 27, 2005

Time is only gonna pass you by

Another option is to have the email link to a web address which will redirect to your custom scheme. Will be a bit annoying since it means the browser has to open for a split second, but I don't really know another way to handle it.

Peanut and the Gang
Aug 24, 2009

by exmarx

Glimm posted:

Another option is to have the email link to a web address which will redirect to your custom scheme. Will be a bit annoying since it means the browser has to open for a split second, but I don't really know another way to handle it.

I see, but I don't see that happening in a reasonable amount of time, as I don't have access to touch the server-side code, and I doubt I can get a hold of someone to add in that feature in just a few days.
Thanks for the advice so far. I will continue researching (and weeping) on the morrow.

IAmKale
Jun 7, 2007

やらないか

Fun Shoe
I need to pass multiple values along to a ContentProvider when I run a query(). I know that, typically, I can pass a value along with the URI by appending the value to the end of the URI. Is it safe/sane to add a pipe-delimited string as the end value, and then split it on the pipes from within the ContentProvider? Something like this:

content://com.test/GetMatchingEntries/1|34|72|114

The simplest way to handle this (in my opinion) would be to pass an ArrayList via a Bundle to the ContentProvider when I call query(), but I'm not sure if that's possible or not.

Adbot
ADBOT LOVES YOU

Thom Yorke raps
Nov 2, 2004


barbarianbob posted:

Greetings androidians *chuckles heartily*

In my app, I (my coworker) have added a new url scheme called poop:// so you can put poop://pasta/ in the browser and it'll forward to my app and do whatever. This is the part of the code that adds it, I'm pretty sure, in the android manifest.

code:
<intent-filter>
    <data     android:scheme="poop" />                                
    <action   android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.BROWSABLE" />
    <category android:name="android.intent.category.DEFAULT" /> 
</intent-filter>
Now in the mail app, urls such as http://www.google.com are automatically linkified so people can click them, but looking at an email with poop://pasta/ doesnt automatically get linkified! :wth:
But that's something I want.

Is this something I need to add a permission for, a la <uses-permission android:name="android.permission.INTERNET" /> or what.

What do I do! Please help me, android buffs! I need to dip into your pool of knowledge!

Write your e-mail using HTML
code:
        StringBuilder emailBuilder = new StringBuilder("<!DOCTYPE html><html><body>")
                      .append(context.getString(R.string.email_app_links).append("</body></html>");
        Spanned email = Html.fromHtml(emailBuilder.toString());
        Intent emailIntent = new Intent(Intent.ACTION_SEND);
        emailIntent.setType("message/html");
        emailIntent.putExtra(Intent.EXTRA_EMAIL, recipients);
        emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
        emailIntent.putExtra(Intent.EXTRA_TEXT, email);
        startActivity(emailIntent);
<string name="email_app_links"><![CDATA[<a href=\"poop://poop\">Android</a>]]></string>

I haven't tested this but it should work

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