[android-developers] Activities I Don't Want the User to be able to go Back to
Hi, I'm developing a non-realtime Android game, and am having trouble figuring out the best way to sequence and control my activities. For example, when the user first installs and runs the app, he's into Activity 1: The Game. He selects a new game slot (1 of 3) and goes to Activity 2: Create Character, and from there Activity 3: World Map. That scenario highlights two of my problems: 1) If the user presses the back button on Activity 3, I don't want him going back to Activity 2, I'd want him back on the main menu; Activity 1.but 2) When the user does return to Activity 1, I want it to have auto- updated to show his character name in one of the 3 game slots* I just don't know how to control my activity stack, or activity launching process in this manner. Help me, please. *From then on, when he clicks that game slot it goes straight to Activity 3, but that was the easy part! :) Thanks in advance for any assistance! Regards, James -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Activities I Don't Want the User to be able to go Back to
Wow, thanks for the quick responses. That simple for question 1, huh? Call finish()? :) Will do, ta. (I just presumed that once you called StartActivity, that was it, bam, you were out of the calling activity and into the called). What about part 2? I want a visual refresh of Activity A when returning to it from Activity B (or C, or even G), that reflects how the game data that affects Acitivty A has changed since the user left it... -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Multiple Activites That Share 75% of a Layout...Layouts Within Layouts?
Hi there, This one's a bit hard to put into words, with my limited understanding of what I'm asking about, so, please bear with me! :) I'm creating a game where there's a screen that, for the most part, is shared by four different activites - but a key portion of the screen will be completely different, depending upon which activity is active. Basically, on the left will be an image of the player and along the bottom there will be a row of buttons (let's say for Armour, Weapons, Magic, Skills). This leaves the top-right portion, which will need to dynamically change to represent the button pressed. (So, one moment the top-right portion is the armour selection activity, and the next it's the weapon selection activity, and so on.) Is this possible? Can I have a layout within a layout and dynamically point the nested layout at a (nested) layout.xml of my choosing? Or, am I looking at just duplicating most of the layout four times (for the four different activities?) Or, am I going to be looking at linking the four activities to a (the top-right) view component, and then having to dynamically construct all of *that* view's child views based on the currently active activity? Well, that's about as much sense as I can make this question make. If you choose to try and help me, then GOOD LUCK, and many thanks :) Cheers, James -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Multiple Activites That Share 75% of a Layout...Layouts Within Layouts?
Cheers both of you. It is sort of like a tab view...and yet not. How customisable is a tab view? Can I have the tabs at the bottom, for example? (don't worry, I'm just thinking aloud, I *will* do my own research there. As for viw visibility/ViewFlipper: Thanks, I'll look into those too. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Which Android Version to Develop for?
Greetings group! My first post, so apologies if my questions are stupid/obvious/common. I have a team just about ready to start development of a game, but I'm not sure what do do about Android versions. My original intention was to develop for 2.1 - we all have 2.1 phones (Desires and Galaxy S's), so it seemed like a good idea. Emulators are fine, but there's nothing quite like testing your game out on a real phone! However, if we start now, we'll be well into development by the time our phones have been updated to 2.2, so I was wondering how horrendous it would be to switch development over to 2.2 mid-project? As an aside; why, in general, are the games available for Android very simplistic compared to some of the more sophisticated iPhone titles available? Is it simply a matter of as yet unfulfilled potential, or is Android just not really terribly suited to gaming? (I can't imagine why this would be the case). And, finally, I'm desperate for a good read on the best approaches to Android client/server and web service development, and would be very grateful for any and all useful linksstuff about RESTful, JSON and web services in general that is specifically written with Android in mind. Thanks very much for reading, and for any useful information provided. Regards, James -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Help Needed Getting JSON to Jersey Web Service and Consuming it
Hi, I've just recently started out with Android development, and have progressed to the point where I have written a very basic Hello World Jersey RESTful web service, and successfully called it from within my Android App. What I want to do now though, is send a new user record (just name and password for now) to a web service in JSON format. I can create my JSON in the Android app just fine, but I don't know how to get it into the HTTP Request in such a way that the corresponding web service that @Consumes JSON can get at it. So, this is how far I've got: 1) Create Android App User object...(Tick: done that) 2) Turn that into JSON...(Tick: done that) 3) Put it on the HTTP request.(Stuck here! Help!) 4) Call the web service...(Tick: done that) 5) Web service retrieve JSON from request...(Stuck here! Help!) 6) Parse the JSON into server side User object and deal with as I see fit...(Don't worry people, I'll be fine with this bit, thanks!) 7) Profit! ;) Guys and Girls, I really appreciate any help given, you dear, dear kind souls! Cheers, James -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Help Needed Getting JSON to Jersey Web Service and Consuming it
Thanks very much Mr Gies, I'll digest this later and expand upon my requirements if still required. Cheers. On 30 July, 17:25, Brad Gies wrote: > To give you good advice, we probably need to know what your server end > is expecting, and what kind of security you need. > > It could be as simple as what's below (NOTE there is extra stuff you > don't need in here, but it should at least give you what you need) : > > List nvps; > > try > { > InputStream is = null; > > DefaultHttpClient httpclient = new DefaultHttpClient(); > HttpPost httpPost = new HttpPost(urlString); > > String searchParams = getSearchParams(); // just my > function to get what I want to pass > > searchParams = URLEncoder.encode(searchParams, HTTP.UTF_8); > > nvps.add(new BasicNameValuePair("category", searchParams)); > > httpPost.setHeader("User-Agent", "iHotTonight Android > App"); // I set this so my server logs files are easier to read. > httpPost.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8)); > HttpResponse response = httpclient.execute(httpPost); > > HttpEntity entity = response.getEntity(); > > if (entity != null) > { > try > { > is = entity.getContent(); > > String line; > StringBuilder builder = new StringBuilder(); > BufferedReader reader = new BufferedReader(new > InputStreamReader(is), 8192); > while ((line = reader.readLine()) != null) > { > builder.append(line); > } > String retStr = builder.toString(); > // Now get any messages coming back. > if (BistroSharedStatic.DEBUGGING_APP) // I set > this if I want to log my results. > Log.d("GetResults", retStr); > > if (handler != null) // if I passed a Handler to > the create then send the result to the Handler. > sharedFunctions.SendMessage(handler, > HandlerReturnMessage, param1, param2, retStr); > > } > finally > { > entity.consumeContent(); > is = null; > } > } > > } > catch (MalformedURLException e) > { > // TODO Auto-generated catch block > e.printStackTrace(); > if (handler != null) > sharedFunctions.SendMessage(handler, 0, 0, 0, > e.getMessage()); // if I passed in a Handler then send the exception to > the handler. > } > catch (IOException e) > { > // TODO Auto-generated catch block > e.printStackTrace(); > if (handler != null) > sharedFunctions.SendMessage(handler, 0, 0, 0, > e.getMessage()); > } > catch (Exception e) > { > e.printStackTrace(); > if (handler != null) > sharedFunctions.SendMessage(handler, 0, 0, 0, > e.getMessage()); > } > > AND in PHP on the server end: > > $username=$_POST['from']; > $password=$_POST['theirpassword];" > $json_string=$_POST['searchwords']; > > // do the usual stripslashes and mysql_real_escape_string stuff here. > > // now, process the JSON string > $json = json_decode($json_string); > > BUT... depending on the security etc... it can be a lot more > complicated. Hopefully, this is enough to get you started. :) > > On 30/07/2010 7:33 AM, JimBadger wrote: > > > > > > > Hi, > > > I've just recently started out with Android development, and have > > progressed to the point where I have written a very basic Hello World > > Jersey RESTful web service, and successfully called it from within my > > Android App. > > > What I want to do now though, is send a new user record (just name and > > password for now) to a web service in JSON format. > > > I can create my JSON in the Android app just fine, but I don't know > > how to get it into the HTTP Request in such a way that the > > corresponding web service that @Consumes JSON can get at it. > > > So, this is how far I've got: > > > 1) Create Android App User object...(Tick: done that) > > 2) Tur