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
Thom Yorke raps
Nov 2, 2004


This seems suited to the current rants:
I'm trying to use the Google Maps API for Android. I ran this command:
code:
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
And entered it plus my package name at the right place in the APIs console. Formatted like so:
SHA1;com.company.project

Got an API key. Put it into a layout definition like so:
code:
<com.google.android.maps.MapView
                android:id="@+id/walk_list_map"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:enabled="true"
                android:clickable="true"
                android:apiKey="APIKEY-HERE"
                />
And extended MapActivity in the enclosing Activity. Added this to my AndroidManifest.xml:
nested under manifest:
code:

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <permission
            android:name="com.company.projectname.permission.MAPS_RECEIVE"
            android:protectionLevel="signature"/>
    <uses-permission android:name="com.company.projectname.permission.MAPS_RECEIVE"/>
    <uses-feature
            android:glEsVersion="0x00020000"
            android:required="true"/>
nested under application:
code:
        <meta-data
                android:name="com.google.android.maps.v2.API_KEY"
                android:value="APIKEY-here"/>
        <uses-library android:required="true" android:name="com.google.android.maps" />
And every time I load my view that has a map in it, I get IOExceptions received 3 response from server, which when I googled means I have an incorrect API key.

I have explicitly set IntelliJ to use the ~/.android/debug.keystore for its cert, I have deleted debug.keystore and regenerated it and used that to make another key, that still didn't work. Running out of things to try, anyone have any thoughts on where I'm going wrong?

Adbot
ADBOT LOVES YOU

Thom Yorke raps
Nov 2, 2004


If I have a service, and inside this service I start multiple threads, is it possible for these threads to be killed by the OS to free up memory, WITHOUT the Service also getting killed?

Thom Yorke raps
Nov 2, 2004


5436 posted:

Which IDE do people generally prefer? Eclipse or IntelliJ IDEA?

I vastly prefer IntelliJ, I think the autocomplete is much better. Not a big fan of their 12.0 release though, the keyboard keeps freezing and requiring me to click somewhere with the mouse to fix it.

Doctor w-rw-rw- posted:

If its under enough pressure to kill the threads it'll probably be under enough pressure to kill the service? My preferred pattern for using threads, if you must, is using executor services. Shutdown on stop, start on start. It's a bit more nuanced than that but it worked well. What are you trying to do, exactly?
I have http PUT requests that cannot be lost. Every time one is generated, I shove it in a SQLite database and send a broadcast to my request runner service. That starts a thread to run all the pending requests in the database. It does this by loading all the requests with SYNCHRONIZED=0, then setting SYNCHRONIZED=1 for each request. If a request fails, it sets SYNCHRONIZED=0. If it succeeds, SYNCHRONIZED=2. But if the thread were to get killed, SYNCHRONIZED would remain at 1 until the service is killed and restarted, at which point it sets all of the requests with SYNCHRONIZED=1 to SYNCHRONIZED=0.

Thom Yorke raps
Nov 2, 2004


Karthe posted:

Can you guys help me figure out what to do?

I've got a DialogFragment with a ListView that displays all user-created tags. I want to set it up to enable the user to edit tag labels while also allowing them to long-click a row to bring up the Contextual Action Bar. The CAB will allow the user to delete multiple tags at once as per the Android Design docs.

I can't long-press any of the rows in the ListView because the EditText and ImageButton are covering the View. I tried setting up the ImageButton's OnLongClickListener to do a view.performLongClick(), but that hasn't produced the desired result. I'm stuck finding that nice mix between "editable space" and "clickable space". Any ideas?


If I long click an edit text I expect to get the "Paste" pop up, not multi select. Maybe support a long click on the delete buttons and make them toggleable?

Thom Yorke raps
Nov 2, 2004


I'm writing code to communicate with a backend over REST. Storing data, login, running business logic type stuff. I'm trying to decide how to handle async communication - I could use callbacks, but I'm worried about the anonymous inner classes keeping a reference to the Activity even after it is destroyed, and code running without a valid context. My other idea is to use a bound service as described here: http://developer.android.com/guide/components/bound-services.html
Is there anything obvious I am missing?

Thom Yorke raps
Nov 2, 2004


Fluue posted:

Whoops! I must have deleted that line when refactoring..

I'm still receiving the same error though. I tried a solution provided on StackOverflow (changing my activity name for Results.java to .Results in AndroidManifest.xml) but that still results in the same error and app crash. Is there a specific debug method I should look at to determine where things are going wrong?

Debug the code and look at why it is null. You need to find out where you assign it a value and why that code isn't executing, or where it is set to null. If you only set things using setter methods then this is relatively easy.

Also I would check out Volley for image loading and caching. It has a NetworkImageView that handles everything real nice for you including caching. If you (or anyone) has any Volley questions just ask because I've been looking at it quite extensively recently.

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

Thom Yorke raps
Nov 2, 2004


LeftistMuslimObama posted:

I have an idea for an app that I want to start developing, but it will definitely require server component because it involves sharing data between multiple users and those users being able to send each other notifications and such. I'm very comfortable with Java and I've got a enough practice at SQL for the purposes of this app. What I've never done, however, is any programming involving client-server communication. If anyone can point me at some resources or tutorials to get me started at figuring that bit out, I'd be grateful. My two big questions are:
* Without paying for hosting, how do I go about setting up some kind of server to code on and test against? For the purposes of development I think a server either running virtually on my PC or on a headless box on my home network would be fine, but I don't really know where to start in getting that set up.
* Where can I go to get more information about communication between Android apps and a remote server?

I would consider checking out some BaaS like CloudMine or Parse, then you can just use their APIs and not run a server yourself.

Adbot
ADBOT LOVES YOU

Thom Yorke raps
Nov 2, 2004


Do you have the Actionbar Sherlock dependency defined correctly in the module set up? What sdk level is the module set to?

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