Search Results

Search found 11792 results on 472 pages for 'android webview'.

Page 52/472 | < Previous Page | 48 49 50 51 52 53 54 55 56 57 58 59  | Next Page >

  • Challenges in multi-player Android Game Server with RESTful Nature

    - by Kush
    I'm working on an Android Game based on Contract Bridge, as a part of my college Summer Internship project. The game will be multi-player such that 4 Android devices can play it, so there's no BOT or CPU player to be developed. At the time of getting project, I realized that most of the students had already worked on the project but none of their works is reusable now (for variety of reasons like, undocumented code and design architecture, different platform implementation). I have experience working on several open source projects and hence I emphasis to work out on this project such that components I make become reusable as much as possible. Now, as the game is multi-player and entire game progress will be handled on server, I'm currently working on Server's design, since I wanted to make game server reusable such that any client platform can use it, I was previously confused in selecting Socket or REST for Game Server's design, but later finalized to work on REST APIs for the server. Now, since I have to keep all players in-sync while they make movements in game, on server I've planned to use Database which will keep all players' progress, specific for each table (in Bridge, 4 players play on single table, and server will handle many such game tables). I don't know if its an appropriate decision to use database as shared medium to track progress of each game table (let me know if there's an appropriate or better option). Obviously, when game is completed for the table, data for that table on server's database is discarded. Now the problem is that, access to REST service is an HTTP call, so as long as client doesn't make any request, server will remain idle, and consider a situation where A player has played a card on his device and the device requests to apply this change on the server. Now, I need to let rest of the three devices know that the player has played a card, and also update view on their device. AFAIK, REST cannot provide a sort-of Push-notification system, since the connection to the server is not persistent. One solution that I thought was to make each device constantly poll the server for any change (like every 56 ms) and when changes are found, reflect it on the device. But I feel this is not an elegant way, as every HTTP request is expensive. (and I choose REST to make game play experience robust since, a mobile device tends to get disconnected from Internet, and if there's Socket-like persistent connection then entire game progress is subject to lost. Also, portability on client-end is important) Also, imagining a situation where 10 game tables are in progress and 40 players are playing, a server must be capable to handle flooded HTTP requests from all the devices which make it every 56 ms. So I wonder if the situation is assumed as DoS attack. So, explaining the situation, am I going on the right track for the server design? I wanted to be sure before I proceed much further with the code.

    Read the article

  • Android SDK PATH Error: doesn´t find home directory

    - by THeo Oliveira
    I use Ubuntu 12.10 and I tried to follow this guide Install android sdk and eclipse in Ubuntu 12.04 but I keep getting this error: Error: The AVD manager normally uses the user's profile directory to store AVD files. However it failed to find the default profile directory. To fix this, please set the environment variable ANDROID_SDK_HOME to a valid path such as ¨~¨. Any ideas how can I fix this?

    Read the article

  • Best solution for multiplayer realtime Android game

    - by piotrek
    I plan to make multiplayer realtime game for Android (2-8 players), and I consider, which solution for multiplayer organization is the best: Make server on PC, and client on mobile, all communition go through server ( ClientA - PC SERVER - All Clients ) Use bluetooth, I don't used yet, and I don't know is it hard to make multiplayer on bluetooth Make server on one of devices, and other devices connect ( through network, but I don't know is it hard to resolve problem with devices over NAT ? ) Other solution ?

    Read the article

  • Android AsyncTask context problem, help!

    - by dnkoutso
    I've been working with AsyncTasks in Android and I am dealing with a strange issue. Take a simple example, an Activity with one AsyncTask. The task on the background does not do anything spectacular, it just sleeps for 8 seconds. At the end of the AsyncTask in the onPostExecute() method I am just setting a button visibility status to View.VISIBLE, only to verify my results. Now, this works great until the user decides to change his phones orientation while the AsyncTask is working (within the 8 second sleep window). I understand the Android activity life cycle and I know the activity gets destroyed and recreated. This is where the problem comes in. The AsyncTask is referring to a button and apparently holds a reference to the context that started the AsyncTask in the first place. I would expect, that this old context (since the user caused an orientation change) to either become null and the AsyncTask to throw an NPE for the reference to the button it is trying to make visible. Instead, no NPE is thrown, the asynctask thinks that the button reference is not null, sets it to visible. The result? Nothing is happening on the screen! I have tackled this by keeping and updating the context reference into the AsyncTask. This is cumbersome and prone to leaks. Here's the code: public class Main extends Activity { private Button mButton = null; private Button mTestButton = null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mButton = (Button) findViewById(R.id.btnStart); mButton.setOnClickListener(new OnClickListener () { @Override public void onClick(View v) { new taskDoSomething().execute(0l); } }); mTestButton = (Button) findViewById(R.id.btnTest); } private class taskDoSomething extends AsyncTask<Long, Integer, Integer> { @Override protected Integer doInBackground(Long... params) { Log.i("LOGGER", "Starting..."); try { Thread.sleep(8000); } catch (InterruptedException e) { e.printStackTrace(); } return 0; } @Override protected void onPostExecute(Integer result) { Log.i("LOGGER", "...Done"); mTestButton.setVisibility(View.VISIBLE); } } } Try executing and while the AsyncTask is working change your phones orientation.

    Read the article

  • Android landscape mod game.

    - by davidv
    I am beginner in android game development. I want my game to run only in landscape fullscreen mod (currently I have Optimus 2X with resolution 800x480 in landscape), and I dont know how to set it. I found the fullscreen mod settings, and tried some landscape mod (set orientation:landscape in AndroidManifest), but the game is now crashing and its very unstable (eg. when i change phone orientation). So is there any way to do that? Thank you for help.

    Read the article

  • Android Photosphere Viewer Application

    - by Frisbetarian
    I'm aiming to develop an android app that simply views photosphere files. It should utilize the compass to pan around the sphere when the user moves his/her phone. I'm not aiming to create photospheres via the phone's camera with it, just upload the necessary jpegs and view them. Could anyone offer any advice as to how I could go about with implementing an API that views and gives the option to manipulate photosphere files?

    Read the article

  • Android beginner: understanding MotionEvent actions

    - by Dave
    I am having trouble getting my activity to return a MotionEvent.ACTION_UP. Probably a beginner's error. In LogCat, I'm only seeing the ACTION_MOVE event (which is an int value of 3). I also see the X/Y coordinates. No ACTION_DOWN and no ACTION_UP. I looked everywhere for a solution. I found one question on a forum that seems to be the same as my issue, but no solution is proposed: http://groups.google.com/group/android-developers/browse_thread/thread/9a9c23e40f02c134/bf12b89561f204ad?lnk=gst&q=ACTION_UP#bf12b89561f204ad Here's my code: import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.MotionEvent; import android.webkit.WebView; public class Brand extends Activity { public WebView webview; public float currentXPosition; public float currentYPosition; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); webview = new WebView(this); setContentView(webview); webview.loadUrl("file:///android_asset/Brand.html"); } @Override public boolean onTouchEvent(MotionEvent me) { int action = me.getAction(); currentXPosition = me.getX(); currentYPosition = me.getY(); Log.v("MotionEvent", "Action = " + action); Log.v("MotionEvent", "X = " + currentXPosition + "Y = " + currentYPosition); if (action == MotionEvent.ACTION_MOVE) { // do something } if (action == MotionEvent.ACTION_UP) { // do something } return true; } }

    Read the article

  • Android HttpsURLConnection and JSON for new GCM

    - by Ryan Gray
    I'm overhauling certain parts of my app to use the new GCM service to replace C2DM. I simply want to create the JSON request from a Java program for testing and then read the response. As of right now I can't find ANY formatting issues with my JSON request and the google server always return code 400, which indicates a problem with my JSON. http://developer.android.com/guide/google/gcm/gcm.html#server JSONObject obj = new JSONObject(); obj.put("collapse_key", "collapse key"); JSONObject data = new JSONObject(); data.put("info1", "info_1"); data.put("info2", "info 2"); data.put("info3", "info_3"); obj.put("data", data); JSONArray ids = new JSONArray(); ids.add(REG_ID); obj.put("registration_ids", ids); System.out.println(obj.toJSONString()); I print my request to the eclipse console to check it's formatting byte[] postData = obj.toJSONString().getBytes(); try{ URL url = new URL("https://android.googleapis.com/gcm/send"); HttpsURLConnection.setDefaultHostnameVerifier(new JServerHostnameVerifier()); HttpsURLConnection conn = (HttpsURLConnection) url.openConnection(); conn.setDoOutput(true); conn.setDoInput(true); conn.setUseCaches(false); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/json"); conn.setRequestProperty("Authorization", "key=" + API_KEY); System.out.println(conn.toString()); OutputStream out = conn.getOutputStream(); // exception thrown right here. no InputStream to get InputStream in = conn.getInputStream(); byte[] response = null; out.write(postData); out.close(); in.read(response); JSONParser parser = new JSONParser(); String temp = new String(response); JSONObject temp1 = (JSONObject) parser.parse(temp); System.out.println(temp1.toJSONString()); int responseCode = conn.getResponseCode(); System.out.println(responseCode + ""); } catch(Exception e){ System.out.println("Exception thrown\n"+ e.getMessage()); } } I'm sure my API key is correct as that would result in error 401, so says the google documentation. This is my first time doing JSON but it's easy to understand because of its simplicity. Anyone have any ideas on why I always receive code 400? update: I've tested the google server example classes provided with gcm so the problem MUST be with my code.

    Read the article

  • Use Of Android NDK

    - by Shalini Singh
    Hi!!!! i am new for NDK. i want to know what is the benefit of native code in android . By this can we improve our application performance. and main thing exactly when we will use this native code. please clear it. and from where i can get more information............

    Read the article

  • android Platform Versions

    - by Daniel Benedykt
    Hi Does anybody knows when there will be more updated information than the following info provided by google a couple of month ago? http://developer.android.com/intl/zh-CN/resources/dashboard/platform-versions.html maybe another source for more up to date information? Thanks

    Read the article

  • Error Copying Source File in Audio Spectrum Visualizer [closed]

    - by David Dimalanta
    I'm testing this code using LibGDX, Java, and Eclipse to test the music player that detects the frequency. I saw this one on this website plus the link on GitHub: http://gtomee.com/2012/07/28/audio-spectrum-visualizer-with-libgdx/ It works when running on desktop project folder but not on Android project folder and the result is this: 10-10 13:57:45.320: E/AndroidRuntime(9421): FATAL EXCEPTION: GLThread 16845 10-10 13:57:45.320: E/AndroidRuntime(9421): com.badlogic.gdx.utils.GdxRuntimeException: Error copying source file: soundtrack 1 bioman.mp3 (Internal) 10-10 13:57:45.320: E/AndroidRuntime(9421): To destination: tmp/audio-spectrum.mp3 (External) 10-10 13:57:45.320: E/AndroidRuntime(9421): at com.badlogic.gdx.files.FileHandle.copyFile(FileHandle.java:625) 10-10 13:57:45.320: E/AndroidRuntime(9421): at com.badlogic.gdx.files.FileHandle.copyTo(FileHandle.java:534) 10-10 13:57:45.320: E/AndroidRuntime(9421): at com.bodapps.rhythm.Drop.create(Drop.java:393) 10-10 13:57:45.320: E/AndroidRuntime(9421): at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:292) 10-10 13:57:45.320: E/AndroidRuntime(9421): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1505) 10-10 13:57:45.320: E/AndroidRuntime(9421): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240) 10-10 13:57:45.320: E/AndroidRuntime(9421): Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Error stream writing to file: tmp/audio-spectrum.mp3 (External) 10-10 13:57:45.320: E/AndroidRuntime(9421): at com.badlogic.gdx.files.FileHandle.write(FileHandle.java:313) 10-10 13:57:45.320: E/AndroidRuntime(9421): at com.badlogic.gdx.files.FileHandle.copyFile(FileHandle.java:623) 10-10 13:57:45.320: E/AndroidRuntime(9421): ... 5 more 10-10 13:57:45.320: E/AndroidRuntime(9421): Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Error writing file: tmp/audio-spectrum.mp3 (External) 10-10 13:57:45.320: E/AndroidRuntime(9421): at com.badlogic.gdx.files.FileHandle.write(FileHandle.java:293) 10-10 13:57:45.320: E/AndroidRuntime(9421): at com.badlogic.gdx.files.FileHandle.write(FileHandle.java:305) 10-10 13:57:45.320: E/AndroidRuntime(9421): ... 6 more 10-10 13:57:45.320: E/AndroidRuntime(9421): Caused by: java.io.FileNotFoundException: /storage/sdcard0/tmp/audio-spectrum.mp3: open failed: EACCES (Permission denied) 10-10 13:57:45.320: E/AndroidRuntime(9421): at libcore.io.IoBridge.open(IoBridge.java:416) 10-10 13:57:45.320: E/AndroidRuntime(9421): at java.io.FileOutputStream.<init>(FileOutputStream.java:88) 10-10 13:57:45.320: E/AndroidRuntime(9421): at com.badlogic.gdx.files.FileHandle.write(FileHandle.java:289) 10-10 13:57:45.320: E/AndroidRuntime(9421): ... 7 more 10-10 13:57:45.320: E/AndroidRuntime(9421): Caused by: libcore.io.ErrnoException: open failed: EACCES (Permission denied) 10-10 13:57:45.320: E/AndroidRuntime(9421): at libcore.io.Posix.open(Native Method) 10-10 13:57:45.320: E/AndroidRuntime(9421): at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110) 10-10 13:57:45.320: E/AndroidRuntime(9421): at libcore.io.IoBridge.open(IoBridge.java:400) 10-10 13:57:45.320: E/AndroidRuntime(9421): ... 9 more I'm not sure if I come this to the right place for help and suggestions.

    Read the article

  • Entering and retrieving data from SQLite for an android List View

    - by Infiniti Fizz
    Hi all, I started learning android development a few weeks ago and have gone through the developer.android.com tutorials etc. But now I have a problem. I'm trying to create an app which tracks the usage of each installed app. Therefore I'm pulling the names of all installed apps using the PackageManager and then trying to put them into an SQLite database table. I am using the Notepad Tutorial SQLite implementation but I'm running into some problems that I have tried for days to solve. I have 2 classes, the DBHelper class and the actual ListActivity class. For some reason the app force closes when I try and run my fillDatabase() function which gets all the app names from the PackageManager and tries to put them into the database: private void fillDatabase() { PackageManager manager = this.getPackageManager(); List<ApplicationInfo> appList = manager.getInstalledApplications(0); for(int i = 0; i < appList.size(); i++) { mDbHelper.addApp(manager.getApplicationLabel(appList.get(i)).toString(), 0); } } addApp() is a function defined in my AppsDbHelper class and looks as follows: public long createApp(String name, int usage) { ContentValues initialValues = new ContentValues(); initialValues.put(KEY_NAME, name); initialValues.put(KEY_USAGE, usage); return mDb.insert(DATABASE_TABLE, null, initialValues); } The database create is defined as follows: private static final String DATABASE_CREATE = "create table notes (_id integer primary key autoincrement, " + "title text not null, usage integer not null);"; I have commented out all statements that follow fillDatabase(); in the onCreate() method of the ListActivity and so know that it is definetely the problem but I don't know why. I am taking the appName and putting it into the KEY_NAME field of the row and putting 0 into the KEY_USAGE field of the row (because initially, my app will default the usage of each app to 0 (not used yet)). If my addApp() function doesn't take the usage and just puts KEY_NAME into the ContentValues and into the database, it seems to work fine, but I want a column for usage. Any ideas why it is not working? Have I overlooked something? Thanks for your time, InfinitiFizz

    Read the article

  • Why was Android's ContentProvider created?

    - by satur9nine
    The title sums up my question, but to elaborate basically what I want to understand is why the Android designers want apps that need to work with shared data to use a Content Provider rather than just accessing the SQLite database directly? The only reason I can think of is security because certain files can by accessed only be certain processes and in that way the Content Provider is the gatekeeper that ensures each app has the proper privileges before allowing read and/or write access to the database file. Is that the primary reason why ContentProvider was created?

    Read the article

  • How can I detect the Android emulator?

    - by Joe Ludwig
    I would like to have my code run slightly differently when running on the emulator than when running on a device. (For example, using 10.0.2.2 instead of a public URL to run against a development server automatically.) What is the best way to detect when an Android application is running in the emulator?

    Read the article

  • I wanna run an android emulator with disk images

    - by Kyungmin
    hi i'd like to run an android emulator with disk image. so I tried this ./emulator -kernel kernel-qemu -system system.img -ramdisk ramdisk.img -initdata userdata.img -partition-size 512 then error massage is : if you really want to NOT run an AVD, consider using '-data ' to specify a data partition image file (I hope you know what you're doing). so I found userdata-qemu.img from /out/ but i can't find that file. someone help me

    Read the article

  • Make Pong on android using OpenGL-ES

    - by brainydexter
    I am trying to make a simple pong game using opengl-es. I have checked out some of the tutorials/samples, but most of them are pre-dated to 2009. I am familiar with game programming, and consider pong to be the hello-world! Right now, I intend to make it using their supplied SDK (2.3), but eventually I want to make it in NDK, so I can port my other work to android. Would anyone have a good reference for a starting point ? Thanks

    Read the article

  • Project Idea - Android

    - by Darren Young
    Hi, I am trying to come up with some project ideas for my final year at University, and I think that I have one that would offer be a (massive) challenge, and something I could potentially make money from. I just want to check something. Is it possible(from a photograph), to be able to determine somebodys face and the individual parts of that face - eyes, ears, nose, etc? This will probably be via Android. Thanks.

    Read the article

  • Android Touch Event Collision Detection

    - by chrissb
    I'm relatively new to both Java and Android, so hopefully the problem I'm having is stemming from something pretty minor that I've overlooked. I've got a (very early stage) game that I've started working on, for Android using Java. At this stage, when the user touches the screen, if they touched a point at which there is an enemy, the enemies health is decreased and they become immobile (for the current implementation at least). The issue that I'm having is that the touch detection doesn't always seem to work. I've got a testing sprite set up that goes to the eventX and eventY coordinates of the touch down event, and it always seems to collide with the enemy object. Yet, the enemy doesn't always register as being hit, and sometimes a hit is registered when the sprite indicates the touch coordinates were outside of the enemies bounding box. I realise that this probably doesn't mean much without any code, so here's what I've got so far. Be gentle, as this is literally my first attempt at something more than basic movement etc. First off, the MainGamePanel class registers the touch event, and informs the levelmanager class (which is what I set up to monitor/handle enemies) public boolean onTouchEvent(MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN){ levelManager.handleActionDown((int)event.getX(), (int)event.getY()); targetX=event.getX(); targetY=event.getY(); } if (event.getAction() == MotionEvent.ACTION_MOVE) { //the gestures } if (event.getAction() == MotionEvent.ACTION_UP) { //touch was released } return true; } From there, in the levelmanager class the touch event is passed on to all of the enemies within a list array: public static void handleActionDown(int eventX,int eventY){ hit=false; for (enemy1 en : enemy1array){ en.handleActionDown(eventX, eventY); } } The rest of the collision code is handled within the enemies handleActionDown function: public void handleActionDown(int eventX, int eventY) { if(eventX>this.x-enemy1bitmap.getWidth() && eventX<this.x+enemy1bitmap.getWidth() && eventY>this.y-enemy1bitmap.getHeight() && eventY<this.x+enemy1bitmap.getHeight()){ takeDamage(1); levelmanager.setHit(); } } I should probably be using getWidth()/2 and getHeight()/2 for it to be more accurate, but I expanded the area to test this - although I've noticed no improvement. At this stage, the games detection over whether or not the enemy is hit is spotty at best. Generally it takes two or three attempts before a collision is successfully registered, even though the sprite that is being used for testing and set to the eventX and eventY coordinates always indicates that the collision should have worked. Hopefully someone can steer me in the right direction here, and if more information is needed, ask away! Cheers, -Chris

    Read the article

< Previous Page | 48 49 50 51 52 53 54 55 56 57 58 59  | Next Page >