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
NoDamage
Dec 2, 2000

Gangsta Lean posted:

Does anyone do Android development in VirtualBox? Is it supposed to work?
The Android emulator is super slow as is, I can't even imagine how much slower it will run inside a virtual machine. What you can try instead is installing Android-x86 in another VirtualBox and running Android directly on that, rather than using the emulator inside a VirtualBox. (I do this anyway because it's so much faster than running the emulator natively.)

Adbot
ADBOT LOVES YOU

Doctor w-rw-rw-
Jun 24, 2008

NoDamage posted:

The Android emulator is super slow as is, I can't even imagine how much slower it will run inside a virtual machine. What you can try instead is installing Android-x86 in another VirtualBox and running Android directly on that, rather than using the emulator inside a VirtualBox. (I do this anyway because it's so much faster than running the emulator natively.)

You realize there's official x86 emulation now, right?

NoDamage
Dec 2, 2000

Doctor w-rw-rw- posted:

You realize there's official x86 emulation now, right?
Well now I just feel stupid. Hah.

On another note, after much debugging with Eclipse Memory Analyzer I have learned a painful lesson: never declare a WebView in XML, always create it programmatically, and never set its context to an Activity (use your application context instead). Failure to do so will lead to horrible memory leaks 100% of the time.

Harold Ramis Drugs
Dec 6, 2010

by Y Kant Ozma Post
I'm trying to use the AndEngine.java library for use in a school project, but I don't think I'm correctly adding it to the build path. There are some superclasses in the library that I'm supposed to extend into subclasses for the purposes of the game, but Eclipse is just not recognizing the library at all.

Here's what I'm doing:
1.) Create a new folder in this project's subfolder called "libs"
2.) move andengine.java to that subfolder
3.) right click on it and select Build --> Add to build path

From here, the AndEngine library appears under the "Referenced Libraries" subgroup (It's the only thing in there), and I can open up the AndEngine library to find all the superclasses I'm supposed to be extending. The IDE just doesn't recognize any of them when I try to call them in my code.

Edit: I actually fixed it by adding a specific import statement for one of the classes I needed.

code:
import org.anddev.andengine.ui.activity.BaseGameActivity;
which resolved this:
code:
public class AndEngineMinimalExample extends BaseGameActivity{
"BaseGameActivity" was unrecognized before, the first line of code fixed it.

However, is there any way to make the IDE do this for me? It did not recognize anything from the imported library until I specifically typed out that import statement by hand. None of the subclasses/methods appear in the intellisense

Harold Ramis Drugs fucked around with this message at 23:08 on Aug 4, 2012

mmm11105
Apr 27, 2010

Harold Ramis Drugs posted:

I'm trying to use the AndEngine.java library for use in a school project, but I don't think I'm correctly adding it to the build path. There are some superclasses in the library that I'm supposed to extend into subclasses for the purposes of the game, but Eclipse is just not recognizing the library at all.

Here's what I'm doing:
1.) Create a new folder in this project's subfolder called "libs"
2.) move andengine.java to that subfolder
3.) right click on it and select Build --> Add to build path

From here, the AndEngine library appears under the "Referenced Libraries" subgroup (It's the only thing in there), and I can open up the AndEngine library to find all the superclasses I'm supposed to be extending. The IDE just doesn't recognize any of them when I try to call them in my code.

Edit: I actually fixed it by adding a specific import statement for one of the classes I needed.

code:
import org.anddev.andengine.ui.activity.BaseGameActivity;
which resolved this:
code:
public class AndEngineMinimalExample extends BaseGameActivity{
"BaseGameActivity" was unrecognized before, the first line of code fixed it.

However, is there any way to make the IDE do this for me? It did not recognize anything from the imported library until I specifically typed out that import statement by hand. None of the subclasses/methods appear in the intellisense

That's mostly how java works, but you should be able to import something like
code:
import org.anddev.andengine.ui.*
to get everything (that's public) out of the anddev ui package at once. Adjust where the * goes to for more or less specificity.

Harold Ramis Drugs
Dec 6, 2010

by Y Kant Ozma Post
Here's a video version of my problem:

http://www.andengine.org/blog/tag/tutorial/

I am able to follow the video up to about 1:50, when he changes the name of the extended class from "Activity" to "BaseGameActivity". He is actually able to do it with intellisense, and eclipse automatically added the correct import statement to the top. It won't do this for me.

The andengine jar file is sitting in my referenced libraries tab for this project. The IDE doesn't seem to recognize anything that's in it, including the above BaseGameActivity statement. (The correct import option selected in the video isn't even available to me).

mmm11105 posted:

That's mostly how java works, but you should be able to import something like
code:
import org.anddev.andengine.ui.*
to get everything (that's public) out of the anddev ui package at once. Adjust where the * goes to for more or less specificity.

This doesn't work. However, I forgot to note last time that the AndEngine.jar expands into a list of about ~100 different packages, each one with the objects I need inside. I was thinking the above import statement isn't working because the class files needed are contained within subdivisions of that directory.

Is there a more inclusive way to use the import statement to import all the classes from all the sub-directories of a jar?

Edit: I'm now considering that this might be a symptom of the new release of eclipse (Juno). All of our course materials were prepared for Indigo, so I'll revert to that version and see

Harold Ramis Drugs fucked around with this message at 01:20 on Aug 5, 2012

Gangsta Lean
Dec 3, 2001

Calm, relaxed...what could be more fulfilling?

Moey posted:

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

I don't know, really. I do most of my development in linux nowadays, and I do all of that in a vm. For the kind of work I usually do, I have to switch back and forth between different versions of libraries depending on project, so it usually makes things easier being able to save state at any time or roll back. It looks like that won't be the case for Android development, at least the way I was attempting to do it.

Isn't linux the preferred platform for Android development? I'll probably end up dual booting if so.

rotaryfun
Jun 30, 2008

you can be my wingman anytime
I've not found an elegant solution for including a populated database with an app. Anyone have any experience or do you always check for a database and create it on a first run?

Glimm
Jul 27, 2005

Time is only gonna pass you by

rotaryfun posted:

I've not found an elegant solution for including a populated database with an app. Anyone have any experience or do you always check for a database and create it on a first run?

Does your app have internet access already? Could you download it? Maybe using the APK expansion API?

http://developer.android.com/guide/google/play/expansion-files.html

These are probably terrible ideas, never thought of distributing a database this way. Generally mine are small enough I just create them the first time the app loads.

PT6A
Jan 5, 2006

Public school teachers are callous dictators who won't lift a finger to stop children from peeing in my plane

rotaryfun posted:

I've not found an elegant solution for including a populated database with an app. Anyone have any experience or do you always check for a database and create it on a first run?

I ended including the database as a resource, and copying it into the proper location on first run. It's not ideal, especially if you've got a large database, but it does work.

Doctor w-rw-rw-
Jun 24, 2008

PT6A posted:

I ended including the database as a resource, and copying it into the proper location on first run. It's not ideal, especially if you've got a large database, but it does work.
Why resource and not an asset?

Put it in your SQLiteOpenHelper or whatever it's called, and apply it at database creation or update time. Or something like that.

PT6A
Jan 5, 2006

Public school teachers are callous dictators who won't lift a finger to stop children from peeing in my plane

Doctor w-rw-rw- posted:

Why resource and not an asset?

Put it in your SQLiteOpenHelper or whatever it's called, and apply it at database creation or update time. Or something like that.

Err, yeah, it was an asset. I haven't done enough Android development lately to keep all the terminology straight.

rotaryfun
Jun 30, 2008

you can be my wingman anytime
So I have my first app that I'm building and I've run into a asynctask issue in that I think I need to use it but I don't know just how to do it.

I have a doFirstRun method that is called and run if a setting isn't found in the sharedprefs
code:
private void doFirstRun() {
   SharedPreferences settings = getSharedPreferences("PREFS", MODE_PRIVATE);
   if (settings.getBoolean("isFirstRun", true)) {
      Toast.makeText(this, "first run: \ncreating player database and adding players", Toast.LENGTH_SHORT).show();
       addPlayers();
       SharedPreferences.Editor editor = settings.edit();
       editor.putBoolean("isFirstRun", false);
       editor.commit();
   }
}
It displays the toast message and runs another method to add players to a database.

However, the message is never really displayed and it hangs while adding them.

The way they are added is by passing player information to a object method... 150 of them. This hangs the app for a few seconds until that is finished.
example:
code:
datasource.createPlayer("player", 10, 1, 1, 1, 5, 4, 8);
How can I make this smoother? I tried following this guys example but wasn't successful.
http://labs.makemachine.net/2010/05/android-asynctask-example/

BabyJebus
Jan 19, 2006

rotaryfun posted:

So I have my first app that I'm building and I've run into a asynctask issue in that I think I need to use it but I don't know just how to do it.


Do something like this...

code:
private ProgressDialog progress;

private void doFirstRun() {
   SharedPreferences settings = getSharedPreferences("PREFS", MODE_PRIVATE);
   if (settings.getBoolean("isFirstRun", true)) {
	progress = ProgressDialog.show(this, "First Run", "Creating player database and adding players").show();
	new AddPlayersTask().execute();
   }
}

private class AddPlayersTask extends AsyncTask<Void, Void, Void> {
	@Override
	protected Void doInBackground(Void... voids) {
		addPlayers();
		SharedPreferences.Editor editor = settings.edit();
       		editor.putBoolean("isFirstRun", false);
       		editor.commit();
		return null;
	}

	@Override
	protected void onPostExecute(Void v) {
		progress.dismiss();
	}
}

Doctor w-rw-rw-
Jun 24, 2008

BabyJebus posted:

Do something like this...

code:
private ProgressDialog progress;

private void doFirstRun() {
   SharedPreferences settings = getSharedPreferences("PREFS", MODE_PRIVATE);
   if (settings.getBoolean("isFirstRun", true)) {
	progress = ProgressDialog.show(this, "First Run", "Creating player database and adding players").show();
	new AddPlayersTask().execute();
   }
}

private class AddPlayersTask extends AsyncTask<Void, Void, Void> {
	@Override
	protected Void doInBackground(Void... voids) {
		addPlayers();
		SharedPreferences.Editor editor = settings.edit();
       		editor.putBoolean("isFirstRun", false);
       		editor.commit();
		return null;
	}

	@Override
	protected void onPostExecute(Void v) {
		progress.dismiss();
	}
}

Shouldn't the progressdialog be a member of the asynctask and be started in onPreExecute?

rotaryfun
Jun 30, 2008

you can be my wingman anytime

Doctor w-rw-rw- posted:

Shouldn't the progressdialog be a member of the asynctask and be started in onPreExecute?

I'm getting:
Type mismatch: cannot convert from void to ProgressDialog

Would this be why?

edit:
I changed it to
code:
protected void onPreExecute() {
   progress = ProgressDialog.show(this, "First Run", "Creating player database and adding players").show();
}
Now I'm getting:
The method show(Context, CharSequence, CharSequence) in the type ProgressDialog is not applicable for the arguments (ViewPlayers.AddPlayersTask, String, String)

edit2:
Nevermind, I added changed the context from this to ViewPlayers.this (activity name) and it cleared the error.

edit3:
Got it all up and running. Works great. Thanks for the code help gentlemen!

rotaryfun fucked around with this message at 18:30 on Aug 10, 2012

Doctor w-rw-rw-
Jun 24, 2008

rotaryfun posted:

I'm getting:
Type mismatch: cannot convert from void to ProgressDialog

Would this be why?

edit:
I changed it to
code:
protected void onPreExecute() {
   progress = ProgressDialog.show(this, "First Run", "Creating player database and adding players").show();
}
Now I'm getting:
The method show(Context, CharSequence, CharSequence) in the type ProgressDialog is not applicable for the arguments (ViewPlayers.AddPlayersTask, String, String)

edit2:
Nevermind, I added changed the context from this to ViewPlayers.this (activity name) and it cleared the error.

edit3:
Got it all up and running. Works great. Thanks for the code help gentlemen!

:stonk: are you not using an IDE to edit? You should be able to autocomplete most of that in seconds.

Zero The Hero
Jan 7, 2009

Hey guys, looking for some advice here. I'm trying to do some type of persistent data storage in my app, and after looking around, I decided a FileOutputStream( http://developer.android.com/reference/java/io/FileOutputStream.html ) would probably be best for me. Right now, all I have is a LinearLayout with a series of CheckBoxes. I just need an efficient way to save the data, which is the only way a checklist is ever going to be useful.

As it is right now, my xml file contains all the CheckBoxes, and my java file is pretty clean. I know I'm going to need to read in the data and set the initial states of all the CheckBoxes in the onCreate() function and save in the onPause() and onStop() functions. I assume I could, in each of these functions, address each CheckBox by id and update the info that way. But that's not a good solution, since every time I decided to add a new CheckBox to the cheklist, I'd have to update the layout file, as well as three separate functions in the java file. I was hoping there would be a way to just read every box in sequence and write the whole thing to a file. My C background is telling me to throw them all in a struct and read/write the struct to and from a file each time, but something tells me that's just not going to work here.

Doctor w-rw-rw-
Jun 24, 2008

Zero The Hero posted:

Hey guys, looking for some advice here. I'm trying to do some type of persistent data storage in my app, and after looking around, I decided a FileOutputStream( http://developer.android.com/reference/java/io/FileOutputStream.html ) would probably be best for me. Right now, all I have is a LinearLayout with a series of CheckBoxes. I just need an efficient way to save the data, which is the only way a checklist is ever going to be useful.

As it is right now, my xml file contains all the CheckBoxes, and my java file is pretty clean. I know I'm going to need to read in the data and set the initial states of all the CheckBoxes in the onCreate() function and save in the onPause() and onStop() functions. I assume I could, in each of these functions, address each CheckBox by id and update the info that way. But that's not a good solution, since every time I decided to add a new CheckBox to the cheklist, I'd have to update the layout file, as well as three separate functions in the java file. I was hoping there would be a way to just read every box in sequence and write the whole thing to a file. My C background is telling me to throw them all in a struct and read/write the struct to and from a file each time, but something tells me that's just not going to work here.

You should be able to hook checkboxes up straight into SharedPreferences. I could be wrong, since I haven't done anything like that in a while, and it might have been a function of a PreferencesScreen, but you should probably use SharedPreferences regardless, if it's a mostly static set of checkboxes. Otherwise I dunno.

rotaryfun
Jun 30, 2008

you can be my wingman anytime

Doctor w-rw-rw- posted:

:stonk: are you not using an IDE to edit? You should be able to autocomplete most of that in seconds.

Yeah I'm using Eclipse but for whatever reason it autocompleted to just this

Zero The Hero
Jan 7, 2009

Doctor w-rw-rw- posted:

You should be able to hook checkboxes up straight into SharedPreferences. I could be wrong, since I haven't done anything like that in a while, and it might have been a function of a PreferencesScreen, but you should probably use SharedPreferences regardless, if it's a mostly static set of checkboxes. Otherwise I dunno.

I'm looking at this tutorial: http://developer.android.com/guide/topics/data/data-storage.html#pref
This looks easy, and it would certainly work for storing a lot of binary data, but I'm not sure how this streamlines the process. It looks like I'd still have to address each CheckBox individually, I'm looking for a way to access them through a loop, or something, or together as one entire unit. Or am I just missing something about how preferences work?

Lutha Mahtin
Oct 10, 2010

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

Zero The Hero posted:

Hey guys, looking for some advice here. I'm trying to do some type of persistent data storage in my app, [...] all I have is a LinearLayout with a series of CheckBoxes. I just need an efficient way to save the data, which is the only way a checklist is ever going to be useful.

SQLite, man.

Zero The Hero
Jan 7, 2009

Lutha Mahtin posted:

SQLite, man.

Well, I looked into that. I was hoping to avoid it, partially because it's been a while since I used databases for anything, and partially because I haven't actually figured out all the fields it would need, and I'm not sure how much of a hassle it would be to update(see first reason). But now I'm looking into ListViews and I think it would make using SQLite a lot easier(and vice versa).

Not entirely sure, though. This is the link I'm using: http://developer.android.com/guide/topics/ui/layout/listview.html .
It looks like it can read and display an unspecified amount of data, I just have to make sure it can display that data as checkboxes. And figure out how the loader works.

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.

Glimm
Jul 27, 2005

Time is only gonna pass you by

n0manarmy posted:

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.

I'm not sure what you mean here. The lint tool will complain if you don't use strings.xml, but it's still possible to just use a String programmatically. What issues are you having accessing strings from your resources? It should be something like this:

http://developer.android.com/guide/topics/resources/string-resource.html
code:
strings.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string
        name="string_name"
        >text_string</string>
</resources>


MyClass.java:

MyClass(Context myContext) {
    String string = myContext().getString(R.string.string_name);
}

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));
				
	}

PT6A
Jan 5, 2006

Public school teachers are callous dictators who won't lift a finger to stop children from peeing in my plane
Strange problem... I have some EditTexts that will need to change between actionDone (in which case the IME should close) and actionNext (in which case the focus should move to the next EditText in the list). When I don't see any IME options, it works as it should, where the enter key moves focus to the next EditText. Likewise, when I set the appropriate IME options to IME_ACTION_DONE, it closes as expected. However, when I have an EditText which previous had IME_ACTION_DONE set, but then has IME_ACTION_NEXT set, it closes instead of moving focus to the next EditText.

Is there something I'm failing to understand about how imeOptions is supposed to work?

EDIT: It appears as long as ACTION_DONE is never set, setting IME_ACTION_NEXT works fine. This suggests to me that I need to somehow "clear" the previous imeOptions, but I can't figure out how to do that. I was under the impression that setImeOptions removed all previous options, but I must be mistaken.

EDIT 2: Apparently IME option changes aren't recognized until the IME is closed and re-opened. As well, it seems you need to manually set Next Focus Down after switching from ACTION_DONE to something else. How I ended up getting it working the way I wanted was to write a custom OnEditorActionListener to handle the change of focus the way I wanted.

PT6A fucked around with this message at 22:05 on Aug 16, 2012

Hot Yellow KoolAid
Aug 17, 2012
I've been trying to play with some of the samples in the directory C:\Users\HLC\android-sdks\samples\android-16\LunarLander. To do this, I've been using:
New -> Android Project from existing code -> C:\Users\HLC\android-sdks\samples\android-16\LunarLander

The problem is, this code does not properly resolve the "R" variable, and as such every reference to "R" has the error message "R cannot be resolved to a variable". From google, the most common cause is Eclipse automatically adding an "Import android.R" statement, but this is not the case in my program. The "lunar-layout.xml" has errors in it on every line with the "match_parent" statement:

code:
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2007 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at
  
          [url]http://www.apache.org/licenses/LICENSE-2.0[/url]
  
     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    
    <com.example.android.lunarlander.LunarView
      android:id="@+id/lunar"
      android:layout_width="match_parent"
      android:layout_height="match_parent"/>
    
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
        <TextView
          android:id="@+id/text"
		  android:text="@string/lunar_layout_text_text"
		  android:visibility="visible"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_centerInParent="true"
          android:gravity="center_horizontal"
          android:textColor="#88ffffff"
          android:textSize="24sp"/>
     </RelativeLayout>
</FrameLayout>
The "build" button is greyed out, and I have tried the clean function as well. Is there any way to manually add the correct "R" variable?


Edit: Here's the code for the Lunar Lander and Lunar View classes

Edit 2: I checked the "gen" folder, and there is no R.java file inside

Edit 3: I fixed it after reverting to an old release of eclipse, restarting, reinstalling the android SDK. Not sure which one fixed the problem

Hot Yellow KoolAid fucked around with this message at 03:34 on Aug 19, 2012

rotaryfun
Jun 30, 2008

you can be my wingman anytime
That's odd. Doesn't the resource class get built during compile?

zeekner
Jul 14, 2007

R.java is recreated during compile, but eclipse auto-compiles it as you go, since you need it to reference against to keep autocomplete/intellisense from freaking out.

A common cause for it failing to compile is the wrong java compiler compliance level. In eclipse, right click project -> properties, under Java Compiler, check the compliance level, it should be 1.6, with the default settings box under it checked.

e:
Also, if you tend to use sub-folders for separating out your code (like com.package.appname.subfolder), in those folders you can't indirectly reference the R class, you had to import it (import com.ferg.awfulapp.R;). At least you couldn't a while ago, I don't know if they ever fixed that.

zeekner fucked around with this message at 05:18 on Aug 19, 2012

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

PT6A
Jan 5, 2006

Public school teachers are callous dictators who won't lift a finger to stop children from peeing in my plane
I'm trying to get Eclipse and the Android SDK set up on my laptop. I think I have everything installed properly, but Eclipse and/or ADB will not recognize my phone or my tablet (which are working perfectly with my main computer). I've installed the whole thing on OS X computers successfully multiple times, but this is my first time with a Windows machine, so is there some magic step I'm forgetting? I installed the USB driver for my tablet, but it still won't work.

EDIT: Never mind, the right combination of restarts and unplugging/plugging it in finally got the prick working. I still have no idea why it wasn't working, or what I did to fix it so I can't help anyone else in a similar situation, but the important thing is that it's working now.

PT6A fucked around with this message at 04:26 on Sep 4, 2012

Doctor w-rw-rw-
Jun 24, 2008

PT6A posted:

I'm trying to get Eclipse and the Android SDK set up on my laptop. I think I have everything installed properly, but Eclipse and/or ADB will not recognize my phone or my tablet (which are working perfectly with my main computer). I've installed the whole thing on OS X computers successfully multiple times, but this is my first time with a Windows machine, so is there some magic step I'm forgetting? I installed the USB driver for my tablet, but it still won't work.

EDIT: Never mind, the right combination of restarts and unplugging/plugging it in finally got the prick working. I still have no idea why it wasn't working, or what I did to fix it so I can't help anyone else in a similar situation, but the important thing is that it's working now.

adb kill-server && adb start-server often helps, 'cause it kills and restarts the daemon that connects to the Android devices.

klem_johansen
Jul 11, 2002

[be my e-friend]
I'm trying to launch the Nook's "Shop Details" intent through phonegap (1.4.1). I'm new to Android and I'm a little confused. I need to trigger an intent with javascript. The original intent sample clode looks like this:

code:
import android.content.Intent;
Intent i = new Intent();
i.setAction( "com.bn.sdk.shop.details" );
i.putExtra( "product_details_ean" , "12344567890" );
startActivity( i );
I should be able to use WebIntent, but I can't seem to get it to work. It seems to be included with PhoneGap. I can see the source
which appears to be built into PhoneGap. I can include the .js source, anyway. I saw some instructions that told me to add WebIntent.java to the project's /src/borismus folder but that just creates more errors. Am I barking up the wrong tree?

code:
function seeBook(ean){
          var extras = {};
          extras[WebIntent.product_details_ean] = ean;
         window.plugins.webintent.startActivity({
				url:'',
				action: 'com.bn.sdk.shop.details',
				type: 'text/plain', 
				extras: extras 
            }, 
            function() {
                alert("Book link launched.");
            }, 
            function() {
              alert('Failed.');
            }
          ); 
}
It looks like I'm not implementing webIntent correctly. I'm including webintent.js in my main html but I still get errors indicating that startActivity isn't declared even though I can see it right there.

klem_johansen fucked around with this message at 03:06 on Sep 14, 2012

Sab669
Sep 24, 2009

I'm bashing my head against the keyboard in my iOS class right now because I hate obj-C. Was just digging through the iOS programming thread here and I saw a "C# / .NET for iOS" framework you can buy.... Then I saw it's available for Android too. Has anyone tried it? I really want to do Droid development, but I strongly dislike Java for no good reason other than I'm unfamiliar with it and Eclipse.

Cat Plus Plus
Apr 8, 2011

:frogc00l:

Sab669 posted:

I really want to do Droid development, but I strongly dislike Java for no good reason other than I'm unfamiliar with it and Eclipse.

You could try Scala, at the very least it's free (I think it's better than both Java and C#, for what it's worth).

Doctor w-rw-rw-
Jun 24, 2008

Sab669 posted:

I'm bashing my head against the keyboard in my iOS class right now because I hate obj-C. Was just digging through the iOS programming thread here and I saw a "C# / .NET for iOS" framework you can buy.... Then I saw it's available for Android too. Has anyone tried it? I really want to do Droid development, but I strongly dislike Java for no good reason other than I'm unfamiliar with it and Eclipse.

Re: Mono:
Note: I haven't used Mono, though I have looked into it at work.

You're just trading the devil you know for the devil you don't. Both in terms of iOS -> Android, and in terms of switching to C#. Not that there aren't good reasons for switching, but you also indicate that you hate Objective-C and dislike Java. For the most part, hating on any kind of language quickly becomes trite and repetitive, and doesn't stop people from using them and writing decent software with them. Even PHP, as awful as it is, has a lot of software, some of which is very well-constructed.

Apologies if this comes off as rude, but allowing language hate to dictate your choice of platform is an awful thing to do. Languages are languages. No matter how good a language you use, awful tooling or libraries will ruin it.

As I understand it, C# is, if not in code, then at least in character, very similar to Java, though with a couple of nifty features thrown in and some lessons learned from Java. There's little to nothing fundamentally different in Java, Objective-C, and C#'s flavor of OOP; or rather, it's so similar that Mono can bridge C# to both fairly competently. Nothing is stopping you from trying Mono if you like C#, but keep in mind that your framework is a second-class citizen subject to breakage, and the languages are the least of your problems if you plan to do anything "real" with either platform. Platforms (the sum total of considerations involving available libraries and frameworks and device limitations) are what will dictate how good or bad of a time you have (hint: Android can be pretty bad, usually far worse than iOS).

Also, since you won't be going beneath that abstraction directly, you may encounter unusual difficulty with debugging problems that come up.


Re: Scala:
Scala is going to be strictly worse than Java on Android. Slower, less tooling there, more finagling with bullshit other than just writing an app, which is already tough enough as it is. Not for the faint of heart, if you ask me. The language is good, the libraries are good, but the performance is worse. If nothing is particularly performance-dependent, you'll be in better shape but you're going to have major problems with building the app. Proguard has issues with Scala, and you'll be including a large jar containing the Scala runtime library.

I haven't looked too far into Mirah, but since it can compile its source into Java source, and has no runtime library, it might be easier to debug than Scala.

Lutha Mahtin
Oct 10, 2010

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

Saying "I hate Obj-C and Java, but I like C#" is either really dumb or really incomplete. Dumb if you're referring to syntax itself, given their similarities; incomplete if you're really talking about standard libraries, runtimes, or other things.

i like tacos
Mar 26, 2010

Ask me about being a liar who doesn't actually like tacos and is a disagreeable asshole
So I'm following the steps on developer.android.com and I can't get past this. It says my Android support library is out of date so I click Install/Upgrade and it doesn't work. It says it fails to create that path. Also when I try to download the extras in the Android SDK it just says access denied. Am I doing something wrong? Is there anything I can do to fix it?


Adbot
ADBOT LOVES YOU

Infomaniac
Jul 3, 2007
Support Cartographers Without Borders
I remember coming across the same thing last month, as i recall, the solution was to add it in a different maner, the solution was found somewhat easily at stackoverflow searching "eclipse not recognizing blah, blah, blah...

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