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
Doctor w-rw-rw-
Jun 24, 2008
I think ViewPagerIndicator also has the same control. If so then use that library, as the same guy behind ActionBarSherlock is behind VPI, so you're assured some level of quality.

Adbot
ADBOT LOVES YOU

Glimm
Jul 27, 2005

Time is only gonna pass you by

Doctor w-rw-rw- posted:

I think ViewPagerIndicator also has the same control. If so then use that library, as the same guy behind ActionBarSherlock is behind VPI, so you're assured some level of quality.

It's similar, but somewhat different from the new implementation in the Play Store.

Just to add a link VPI is available here:
https://github.com/JakeWharton/Android-ViewPagerIndicator

(If you're interested in the differences they're explained pretty well in Kirill's post: https://plus.google.com/108761828584265913206/posts/Cwk7joBV3AC)

it is
Aug 19, 2011

by Smythe
I have a spinner with this XML
code:
        <Spinner
            android:id="@+id/spinner1"
            android:entries="@array/electronics"
            android:prompt="@string/select_device"
            android:layout_width="216dp"
            android:layout_height="wrap_content" />
how do I turn that into Java?

I tried this and it didn't work; the spinner is completely blank:
code:
		electronics = new Spinner(context);
		electronics.setId(ELECTRONICS_ID);
		electronics.setPrompt(context.getString(R.string.select_device));
		ArrayAdapter<String> electronicsAdapter = new ArrayAdapter<String>(context, R.layout. R.array.electronics);
		electronicsAdapter.setDropDownViewResource(ELECTRONICS_ID);
		electronics.setAdapter(electronicsAdapter);
		LayoutParams electronicsLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);

Glimm
Jul 27, 2005

Time is only gonna pass you by

it is posted:

I have a spinner with this XML
code:
        <Spinner
            android:id="@+id/spinner1"
            android:entries="@array/electronics"
            android:prompt="@string/select_device"
            android:layout_width="216dp"
            android:layout_height="wrap_content" />
how do I turn that into Java?

I tried this and it didn't work; the spinner is completely blank:
code:
		electronics = new Spinner(context);
		electronics.setId(ELECTRONICS_ID);
		electronics.setPrompt(context.getString(R.string.select_device));
		ArrayAdapter<String> electronicsAdapter = new ArrayAdapter<String>(context, R.layout. R.array.electronics);
		electronicsAdapter.setDropDownViewResource(ELECTRONICS_ID);
		electronics.setAdapter(electronicsAdapter);
		LayoutParams electronicsLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);

You probably want to reference the Spinner you created in xml, something like:

code:
		electronics = (Spinner) findViewById(R.id.spinner1);
Check this page out for more info on using Spinners:
http://developer.android.com/guide/topics/ui/controls/spinner.html

IAmKale
Jun 7, 2007

やらないか

Fun Shoe
I'm working with SpannableStrings now and can't figure out why this code...

Java code:
SpannableString span = new SpannableString(cs);
span.setSpan(new ForegroundColorSpan(R.color.appGrey), 0, cs.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
span.setSpan(new StyleSpan(android.graphics.Typeface.ITALIC), 0, cs.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
...won't italicize the string. The foreground color applies correctly, but no matter which order I place it, the italics never stick. Am I doing something wrong?

IAmKale
Jun 7, 2007

やらないか

Fun Shoe
How clean is an app's uninstall? Sometime today I uninstalled my app from my tablet to do a clean install, something I'd done many times before without issue. Today, though, the app started crashing whenever it tried to access its sqlite database, complaining that a table that is most assuredly there did not exist. I've tried everything I can think of to fix the issue - I've rolled back code changes, tried to reinstall using an older version of the database I'm working with, tried installing the app on a virtual device, nothing has worked. It's like the library I was using to load the database onto my device (SQLite Asset Helper) just stopped working...I put in almost two hours trying to determine what the problem is and nothing worked.

I'm in the middle of rooting my device, thinking a clean slate might knock loose something that was freaking out, but I'm curious if it's possible for a SQLite database to not get deleted after an app uninstall, causing issues with the app's attempts to load a newer version on reinstall. I really can't think of any other reason why my app that was working one moment would all of a sudden stop working the next. And I wasn't even getting a proper crash report via logcat! The app would just crash the moment I tapped the icon (disabling an initial call to a database allowed the app's UI to load, but any time I tried to query the database it would instantly crash, complaining that a table in the database didn't exist).

This poo poo is maddening :argh:

QuarkJets
Sep 8, 2008

Even if the old SQLite database wasn't deleted, that certainly wouldn't explain a problem where the program claims that a table is missing when it is definitely there.

How certain are you that you're checking the correct database? Can you ascertain whether the app is actually accessing the same sqlite file that you've checked and that the table is definitely there? Have you checked for an sqlite file in the SD card vs the phone's internal memory?

Maybe you could try deleting the SQLite file (by which I mean back it up somewhere and then delete it)?

IAmKale
Jun 7, 2007

やらないか

Fun Shoe

QuarkJets posted:

Even if the old SQLite database wasn't deleted, that certainly wouldn't explain a problem where the program claims that a table is missing when it is definitely there.

How certain are you that you're checking the correct database? Can you ascertain whether the app is actually accessing the same sqlite file that you've checked and that the table is definitely there? Have you checked for an sqlite file in the SD card vs the phone's internal memory?

Maybe you could try deleting the SQLite file (by which I mean back it up somewhere and then delete it)?
I'm positive I was checking the correct database. It was literally a moment of, uninstall working app, launch from Eclipse to reinstall, instant crash. I was reinstalling the app with a new modified database (SQLite Asset Helper grabs whatever zipped DB file you place in assets/databases/ and moves it into place as a new database provided you increment the version number in a class extended from it), but I've done that process plenty of times before now with no issue.

The app eventually started working shortly after I posted my rant last night. I don't have anything to back this up, but it feels as though Eclipse stopped loading the SQLite Asset Helper library when I launched the app. I typically got a "Successfully opened <database name>" log entry from that library whenever I started the app, but while the app was crashing no such message appeared.

Anyway, the app started launching properly before I went to bed last night. I started with code from two revisions ago with an old database (basically at a point at which I knew for a fact it was working), then worked my way up through three revisions until I hit the end. The app launched properly every time and I hadn't changed a single thing. :suicide:

Hot Yellow KoolAid
Aug 17, 2012
Hey, I need to make a view for an app that I'm making. Everything's in the early stages, so all I'm really looking for here is a basic pointers/XML. Bear with me, I am new to android...

This view needs to be a 10x10 spreadsheet style grid with defined borders between cells. The individual cells need to be able to hold integer values up to 5 digits. The background color of the individual cells must change depending on certain conditions. The individual cells also need to be selectable by touching, and I probably need to implement the android-equivalent of a listener to trigger a popup whenever one of the cells is selected.

Like I said, I'm fairly new so any and all help is appreciated. All my GUI experience is in C#, so I am still learning the equivalent terminologies.

father vivian
May 5, 2008

WE'VE OBTAINED ENERGY RECOVERY PILLS
hey all, I have been digging around for a while and cant find a straight answer anywhere concerning this. If I put an very basic app on the market for free, that has NO other functionality that can be unlocked, can I ask for donations and provide a link for this? I found several sources saying this is fine, and a few others that claim they have had their apps pulled for it.

There did not seem to be anything in the distribution agreement or program policies that addresses this, if I overlooked something is there a link anyone can provide? --Thanks

IAmKale
Jun 7, 2007

やらないか

Fun Shoe
Is it possible to programmaticaly move to the top of a fragment? I'm seeing instances in which the contents of a fragment change but I have to manually scroll to the top because the scroll position is remembered from when I was halfway down the page when I requested new information.

Edit: I figure it out, ScrollView's smoothScrollTo does just this.

IAmKale fucked around with this message at 03:46 on May 6, 2013

QuarkJets
Sep 8, 2008

father vivian posted:

hey all, I have been digging around for a while and cant find a straight answer anywhere concerning this. If I put an very basic app on the market for free, that has NO other functionality that can be unlocked, can I ask for donations and provide a link for this? I found several sources saying this is fine, and a few others that claim they have had their apps pulled for it.

There did not seem to be anything in the distribution agreement or program policies that addresses this, if I overlooked something is there a link anyone can provide? --Thanks

It's okay, but only if you receive donations via the android market payment system or in-app billing. Google takes a percentage off of the top (I think 30%). The Paypal donation library for Androids counts as "in-app billing" so you could try that

IAmKale
Jun 7, 2007

やらないか

Fun Shoe
Okay, I have a real problem this time that no amount of Googling has solved. I'm loading some results from a database using a loaderManager. The results return just fine when I query the contentProvider, but unfortunately the app crashes with a StaleDataException whenever I rotate my device. Based on some testing, this code is the culprit:

Java code:
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor)
{
    // If we've returned results, then pass them and the webSearches cursor along to be displayed
    if(cursor.moveToFirst())
    {
        // Get a cursor containing additional web searches and merge it at the end of the results cursor 
        MatrixCursor searchesCursor = getWebSearchesCursor(searchTerm, false);
        Cursor[] cursors = { cursor, searchesCursor };
        // TODO: Figure out why merging cursors here causes staledataexception after rotation
        Cursor results = new MergeCursor(cursors);
        // Display the cursor in the ListView
        adapter.changeCursor(results);
    }
    // If no results were returned, then return suggestions for web searches
    else
    {
        // Get a cursor containing additional web searches 
        MatrixCursor noResults = getWebSearchesCursor(searchTerm, true);
        adapter.changeCursor(noResults);    
    }

    // Show the listView and hide the progress spinner
    toggleListView(SHOW);
}
The call to getWebSearchesCursor() returns a MatrixCursor with some additional search prompts to accompany any returned results. I discovered that changing adapter.changeCursor(results) to adapter.changeCursor(cursor) fixes the error, so it looks like merging the MatrixCursor searchesCursor to the returned cursor produces the error.

My question is, why?

I want to be able to add my own items to the end of the returned cursor. Is there a better way to merge the two cursors so that I don't get this exception after rotation?

jkyuusai
Jun 26, 2008

homegrown man milk
We had some deadlines move around and after some begging, the I/O team allowed my company to transfer one of our two I/O registrations to me. :toot:
So many sessions being done by people who I've been getting great information from since starting my journey in Android over the last year or so. I'll do my best to come back after the conference and point out any that seemed useful.

kitten smoothie
Dec 29, 2001

Have fun. It's been 2 months since registration and I am still pissed that my 3 year streak of I/O attendance got broken this time around.

Doh004
Apr 22, 2007

Mmmmm Donuts...
Hey Android thread,

I've been our company's iOS lead for the past 10 months and have been enjoying it so far. I was just tasked with running our summer internship program where we're going to be having 3 interns create our company's Android app by "copying" (not code) our iPhone/iPad app. I know, this is a bit ridiculous and I'd rather not have it this way, but you deal with the card you're dealt.

This came as a shock to me as I've only merely scratched the surface of Android development and haven't touched Java in several years. I am now in a rush mode to get knowledgeable about the whole process so that these interns are not led blindly. I've read through the OP and will be reading through the various tutorials and I'm gonna start tinkering around with a bunch of existing projects out there and get my hands dirty.

I was just wondering if there were any tips/guidelines for people that are coming from iOS. I'd like to think I'm somewhat familiar with mobile development, but I know best practices and the way things are done can vary greatly between communities. Any help would be greatly appreciated :)

Doctor w-rw-rw-
Jun 24, 2008
I have done both iOS and Android dev professionally for three years. PM me with some details and I'll make some time to get back to you about potential pitfalls, things to use, and stuff to keep an eye on.

Doh004
Apr 22, 2007

Mmmmm Donuts...

Doctor w-rw-rw- posted:

I have done both iOS and Android dev professionally for three years. PM me with some details and I'll make some time to get back to you about potential pitfalls, things to use, and stuff to keep an eye on.

Thanks, youdaman :respek:

Thermopyle
Jul 1, 2003

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

Google just announced Android Studio, which is an Android IDE based on IntelliJ.

jkyuusai
Jun 26, 2008

homegrown man milk
Oh my god this android studio demo is amazing.

Thermopyle
Jul 1, 2003

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

jkyuusai posted:

Oh my god this android studio demo is amazing.

Yes it is. I also like how they're using the best Jetbrains theme: Darkula.

Sereri
Sep 30, 2008

awwwrigami

Hello intelliJ, get hosed eclipse

jkyuusai
Jun 26, 2008

homegrown man milk

Sereri posted:

Hello intelliJ, get hosed eclipse

Hmm how will this affect intellij's monetization? I assume Google isn't going to charge for AS.

Also, new service to translate apps, and alpha/beta testing from the Dev console.

jkyuusai fucked around with this message at 17:39 on May 15, 2013

Thermopyle
Jul 1, 2003

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

jkyuusai posted:

Hmm how will this affect intellij's monetization? I assume Google isn't going to charge for AS.

Intellij Community Edition is free.

In other news you can now do beta testing and staged rollouts via the developer console.

zeekner
Jul 14, 2007

I'm curious what the relationship is here. If this is Google working with Jetbrains, then all this stuff will just end up in the full version.

If they are just forking the community version and none of it will end up in the full version I'll be pretty annoyed.

jkyuusai
Jun 26, 2008

homegrown man milk

Salvador Dalvik posted:

I'm curious what the relationship is here. If this is Google working with Jetbrains, then all this stuff will just end up in the full version.

If they are just forking the community version and none of it will end up in the full version I'll be pretty annoyed.

In ADT panel. Jet brains CTO is speaking now. Based on what he's saying, i think, all the work in android studio will make it back to all versions of intellij.

zeekner
Jul 14, 2007

It looks like most of the Android Studio functionality will make it in IntelliJ 13, but that's not out till December.

http://blogs.jetbrains.com/idea/2013/05/intellij-idea-13-early-preview-is-out/

Guess I'll have to try Studio and see if it's worth switching, hopefully the workspace config transfers over.

Posting Principle
Dec 10, 2011

by Ralp
Somewhere, Mike Wilson is crying.

QuarkJets
Sep 8, 2008

I want Android Studio right now. Oh look, the early preview is up (hopefully I don't run into too many bugs)

more like dICK
Feb 15, 2010

This is inevitable.
Speaking of IntelliJ and Android...

It's been a couple months since I've done anything with Android, but it looks like they changed the layout of the sdk with the latest update (moving certain tools into the new build-tools directory). I'm using IntelliJ 12.1.3, and it can't find the tools anymore. Is there an easy way to get IntelliJ working again with the new layout?

Doctor w-rw-rw-
Jun 24, 2008
Holy loving poo poo.

Volley.

Every single pitfall that the presenter pointed was something I encountered in making network requests. Every single solution and diagram was something I had drawn up as a solution but was never given time to implement properly.every feature addressed a deficiency I needed.

And it's backwards-compatible to older versions of android. Wow. Great!

Glimm
Jul 27, 2005

Time is only gonna pass you by

Doctor w-rw-rw- posted:

Holy loving poo poo.

Volley.

Every single pitfall that the presenter pointed was something I encountered in making network requests. Every single solution and diagram was something I had drawn up as a solution but was never given time to implement properly.every feature addressed a deficiency I needed.

And it's backwards-compatible to older versions of android. Wow. Great!

Yeah Volley looks extremely useful. I'm excited to use it!

Now I don't know what to look at first, OkHttp/Picasso (http://corner.squareup.com/2013/05/picasso-one-dot-oh.html) or Volley?

Probably Volley.

Doctor w-rw-rw-
Jun 24, 2008
They said that they compared it to a bunch of other libs out there and that itwvperformance trounced the others'.

jkyuusai
Jun 26, 2008

homegrown man milk
Also they spoke at the qa after the panel about someone that is working on plugging okhttp into volley. This would give the side benefit of making volley use SPDY!

Thermopyle
Jul 1, 2003

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

I haven't touched Android development in a year or so, but I have to say this IO has made me want to pick it up again. A little bit.

zeekner
Jul 14, 2007

They just posted the recorded Volley video if anyone missed it. I'm really excited to try this, it'll replace a ton of code and libraries for me.

https://www.youtube.com/watch?v=yhv8l9F44qo

UraniumAnchor
May 21, 2006

Not a walrus.
Has anybody used the Google Play Licensing stuff? Any degree of success with it or is it hilariously easy to bypass?

jkyuusai
Jun 26, 2008

homegrown man milk
Asked jet brains guys about android studio features. They said they're currently in a preview version of the full version of Intellij with the official release coming in December.

QuarkJets
Sep 8, 2008

jkyuusai posted:

Asked jet brains guys about android studio features. They said they're currently in a preview version of the full version of Intellij with the official release coming in December.

The preview version was linked in the thread, either this page or the previous one. Looks pretty slick. You should check it out!

e: It was this page. Here's the link again: http://developer.android.com/sdk/installing/studio.html

Adbot
ADBOT LOVES YOU

more like dICK
Feb 15, 2010

This is inevitable.

jkyuusai posted:

Asked jet brains guys about android studio features. They said they're currently in a preview version of the full version of Intellij with the official release coming in December.

So is Android in Intellij just going to be broken until December? http://youtrack.jetbrains.com/issue/IDEA-107311

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