Search Results

Search found 17553 results on 703 pages for 'android sdk 2 1'.

Page 39/703 | < Previous Page | 35 36 37 38 39 40 41 42 43 44 45 46  | Next Page >

  • Android - big game universe

    - by user1641923
    I am new to an Android development, though I have much experience with Java, C++, PHP programming and a bit experience with vector graphics too (basic 3d Studio Max, Flash, etc). I am starting to work on an Android game. It is going to be a 2D space shooter/RPG, and I am not going to use any game engines and any 3D party libs. I really want to create a very large game universe, or even pseudo-infinite (without visible borders, as if it were a 2D projection of a sphere). It should include 10-12 clusters of 7-8 planets/other space objects and random amount of single asteroids/comets, which player can interact with and also not interactive background. I am looking for a least complicated aproach to create such a universe. My current ideas are: Simply create bitmaps with space scenery background so that they can be tiled seamlessly repeated and construct my 2D universe of this tiles, then place interactive objects (planets, other spaceships) on it. Using vector graphics. I would have a solid color background, some random background objects and gradients here and there. My problems here: Lack of knowledge of how well vector graphics is integrated in Android. Performance? Memory usage? Does Android manage big bitmaps well? Do all of the bitmaps have to be in memory during all game process? I am interested in technical details regarding each of the ideas and a suggestion, which I should go with.

    Read the article

  • getting the Contact's Birthday of a HTC Sense phone

    - by Pentium10
    I am not sure, but probably HTC Sense does the following, syncs my Facebook contacts to my phone along with their mobile number and their birthday. This shows well in the agenda and the user panel. But as it turns out it doesn't use the standard SDK way to store the birthdays. As if I use the following code to get the birthday of a contact it returns NO data for those contacts. public String getBirthday() { if (data.containsKey(BIRTHDAY)) { return CRUtils.getString(data, BIRTHDAY); } else { // read birthday Cursor c = ctx.getContentResolver() .query( Data.CONTENT_URI, new String[] { Event.DATA }, Data.CONTACT_ID + "=" + this.getId() + " AND " + Data.MIMETYPE + "= '" + Event.CONTENT_ITEM_TYPE + "' AND " + Event.TYPE + "=" + Event.TYPE_BIRTHDAY, null, null); if (c != null) { try { if (c.moveToFirst()) { String s = c.getString(0); this.setBirthday(s); return s; } } finally { c.close(); } } return ""; } } How can I fix this?

    Read the article

  • NullPointerException in ItemizedOverlay.getIndexToDraw

    - by lyricsboy
    I have a relatively simple MapActivity that I'm trying to make display a list of "camps" within a given map region. I've created a custom subclass of OverlayItem called CampOverlayItem, a custom ItemizedOverlay called CampsOverlay that returns CampOverlayItems, and of course a MapActivity subclass that populates the map. I'm pulling the overlay data from a database using an AsyncTask as created in my activity. The AsyncTask is triggered from a ViewTreeObserver.OnGlobalLayoutListener attached to the MapView. In the onPostExecute method of the AsyncTask, I create a new instance of my CampsOverlay class and pass it a list of the camps returned from the database (which are fetched in doInBackground). I then call: mapView.getOverlays().add(newOverlay); where newOverlay is the CampsOverlay I just created. All of this code runs without error, but when the Map tries to draw itself, I get a NullPointerException with the following stack trace: java.lang.NullPointerException at com.google.android.maps.ItemizedOverlay.getIndexToDraw(ItemizedOverlay.java: 211) at com.google.android.maps.ItemizedOverlay.draw(ItemizedOverlay.java:240) at com.google.android.maps.Overlay.draw(Overlay.java:179) at com.google.android.maps.OverlayBundle.draw(OverlayBundle.java: 42) at com.google.android.maps.MapView.onDraw(MapView.java:476) at android.view.View.draw(View.java:6274) at android.view.ViewGroup.drawChild(ViewGroup.java:1526) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1256) at android.view.ViewGroup.drawChild(ViewGroup.java:1524) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1256) at android.view.View.draw(View.java:6277) at android.widget.FrameLayout.draw(FrameLayout.java:352) at android.view.ViewGroup.drawChild(ViewGroup.java:1526) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1256) at android.view.ViewGroup.drawChild(ViewGroup.java:1524) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1256) at android.view.ViewGroup.drawChild(ViewGroup.java:1524) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1256) at android.view.ViewGroup.drawChild(ViewGroup.java:1524) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1256) at android.view.ViewGroup.drawChild(ViewGroup.java:1524) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1256) at android.view.View.draw(View.java:6277) at android.widget.FrameLayout.draw(FrameLayout.java:352) at android.view.ViewGroup.drawChild(ViewGroup.java:1526) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1256) at android.view.View.draw(View.java:6277) at android.widget.FrameLayout.draw(FrameLayout.java:352) at com.android.internal.policy.impl.PhoneWindow $DecorView.draw(PhoneWindow.java:1883) at android.view.ViewRoot.draw(ViewRoot.java:1332) at android.view.ViewRoot.performTraversals(ViewRoot.java:1097) at android.view.ViewRoot.handleMessage(ViewRoot.java:1613) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:123) at android.app.ActivityThread.main(ActivityThread.java:4203) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:521) at com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:791) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549) at dalvik.system.NativeStart.main(Native Method) Because it seems particularly relevant, here is the code for my ItemizedOverlay subclass: public class CampsOverlay extends ItemizedOverlay<CampOverlayItem> { private ArrayList<Camp> camps = null; public CampsOverlay(Drawable defaultMarker, ArrayList<Camp> theCamps) { super(defaultMarker); this.camps = theCamps; } @Override protected CampOverlayItem createItem(int i) { Camp camp = camps.get(i); CampOverlayItem item = new CampOverlayItem(camp); return item; } @Override protected boolean onTap(int index) { // TODO Auto-generated method stub return super.onTap(index); } @Override public int size() { return camps.size(); } } Does anyone have any idea what could be happening here? I've attempted to verify that everything I have control over is non-null. I can provide more code if necessary.

    Read the article

  • Here’s Two Android Tools That Can Help Cut Down Your Phone Bills

    - by Zainul Franciscus
    Have you been struggling to stay on top of your mobile bills ? With these Android applications, you can send free sms and monitor your mobile usage, so that you’ll never have to go over your monthly mobile allowance. To accomplish this, we will use two Android applications:  HeyWire for sending free local and international sms, and Droid Stats to monitor our monthly phone usage. Both of these applications are available for free from the Android market, so head over to the market, and install them when you are ready.How to Create an Easy Pixel Art Avatar in Photoshop or GIMPInternet Explorer 9 Released: Here’s What You Need To KnowHTG Explains: How Does Email Work?

    Read the article

  • Need information regarding Ubuntu for Android

    - by a.premkumar
    As far as I understand, Ubuntu for Android is not the same as Actual Ubuntu in Desktops. So I am confusing both with each other. Please enlighten me on this. Could Ubuntu on Android run 32bit softwares same as the PC versions do? Or it is just the ARM version that would not be able to run the existing PC version softwares? If it is ARM now, would it be a 32 or 64 bit version in future?(Ofcourse if the mobile device architecture supports it). Will there be a separate version for Tablets, so that there would be no need for separate docking and allows seamless switching from Android to Ubuntu internally on the device? Regards, Premkumar. A

    Read the article

  • Contracting rate for Android development

    - by Robottinosino
    I am a developer, maybe I have a project to work on, not sure how much to "charge" for my work.... Help me find the price? Looking for an contracting rate interval, expressed in EUR, to offer for an Android development gig. Location: Europe, off-site (telecommuting) Environment: Android + HTTP back-end Length of project: 1 month Rate currency: EUR Rate measure: daily or hourly Other skills required: UI design, basic J2EE, web services Client profile: medium business (100+ employees) Previous published apps: 1, on G-Play Design work: partially already done, data flow is established, data models to be built Required graphics/multimedia elements: provided by the client Source control: remove over SSH Team size: one person in development, others (unknown) for marketing, copy, etc. Risk factor: medium Client reputation: modest but established Potential for continued work: absent (for now) Internationalisation/localisation: no Native code (C/C++,...): none, only Android SDK, pure Java Working culture: (based on initial discussion) - high pressure Other projects in the pipe: zero Opportunity to learn from the project or build new skills: 5% Negotiating experience: good Cost of accessories: (licenses, device to debug on) zero If I need to be more precise, please just say how and I will be.

    Read the article

  • Bitdefender Safebox Offers 2GB Free Storage for Android Users

    - by Jason Fitzpatrick
    Android: If you’re always on the lookout for new–and free!–cloud storage solutions, security company BitDefender has a new cloud service for Android uers. Safebox accounts come with a free 2GB storage to get you started. For those of you in the “You can never have enough backups!” camp, Bitdefender’s Safebox is a new offering (currently only available for PC/Android setups) on the remote-storage market. Free personal accounts come with 2GB of storage which is on par with other cloud storage providers. If you’re looking for cloud storage with the maximum number of features and heavy third-party support you’ll want to stick with a well established player like Dropbox. If you’re just looking for some extra storage for overflow media or some redundancy for your current backup solution, Safebox is a viable storage solution. Bitdefender Safebox [via Addicted Tips] Make Your Own Windows 8 Start Button with Zero Memory Usage Reader Request: How To Repair Blurry Photos HTG Explains: What Can You Find in an Email Header?

    Read the article

  • Repurpose an Old Android Phone as a Thermostat

    - by Jason Fitzpatrick
    If you’re interested in setting up a smart thermostat but put off by the high price of models like the Nest Learning Thermostat, this DIY project uses an old Android phone and a little DIY wiring to automate and network your home heating and cooling. What the project lacks for in terms of a polished off-the-shelf presentation, it certainly makes up for in versatility. Check out the above video to see Android Thermostat in action then hit up the link below for more information about the project–including the source code, build schematics, and more. Android Thermostat [via Hack A Day] Why Enabling “Do Not Track” Doesn’t Stop You From Being Tracked HTG Explains: What is the Windows Page File and Should You Disable It? How To Get a Better Wireless Signal and Reduce Wireless Network Interference

    Read the article

  • How To Access the Developer Options Menu and Enable USB Debugging on Android 4.2

    - by Chris Hoffman
    In Android 4.2, the Developer Options menu and USB Debugging option have been hidden. If you need to enable USB Debugging, you can access the Developer Options menu with a quick trick. The developer options aren’t just used by developers. USB Debugging is required by adb, which is used for rooting an Android device, backing it up, installing a custom ROM, taking screenshots from a computer, or doing many other things. Why Does 64-Bit Windows Need a Separate “Program Files (x86)” Folder? Why Your Android Phone Isn’t Getting Operating System Updates and What You Can Do About It How To Delete, Move, or Rename Locked Files in Windows

    Read the article

  • Get Real Multitasking on Android With These 8 Floating Apps

    - by Chris Hoffman
    Android has decent multitasking, but the missing piece of the puzzle is the ability to have multiple apps on-screen at the same time – particularly useful on a larger tablet. Floating apps fill this need. Floating apps function as always-on-top windows, allowing you to watch videos, browse the web, take notes, or do other things while using another app. They demonstrate how Android’s interface is more flexible than iOS and the Modern UI in Windows. Secure Yourself by Using Two-Step Verification on These 16 Web Services How to Fix a Stuck Pixel on an LCD Monitor How to Factory Reset Your Android Phone or Tablet When It Won’t Boot

    Read the article

  • Importing a windows project into android using cocos2d-x

    - by Ef Es
    What I am trying to do today is to import a full project to Android, but no tutorials are available for that that I have seen. My approach was to create a new android project, copy all the classes and resources in the folders and calling ./build_native.sh but I get an error because most of the files are not being included in the project. I tried opening the Android.mk and I can see why "LOCAL_SRC_FILES := AppDelegate.cpp \ HelloWorldScene.cpp" are the only files linked. Should I manually modify the make file or can it be automated by some way I don't know? Thank you. UPDATE: I manually added all files and headers to the make file and I get errors linking Box2D or cocosdenshion libraries.

    Read the article

  • How to Move Your Google Authenticator Credentials to a New Android Phone or Tablet

    - by Chris Hoffman
    Most of the app data on your Android is probably synced online will automatically sync to a new phone or tablet. However, your Google Authenticator credentials won’t — they aren’t synchronized for obvious security reasons. If you’re doing a factory reset, getting a new phone, or just want to copy your credentials to second device, these steps will help you move your authenticator data over so you won’t lose your access codes. How to Factory Reset Your Android Phone or Tablet When It Won’t Boot Our Geek Trivia App for Windows 8 is Now Available Everywhere How To Boot Your Android Phone or Tablet Into Safe Mode

    Read the article

  • Webinar on Cross Platform Development with MonoTouch for the iPhone and Mono for Android on Wednesday

    - by Wallym
    The iPhone and Android are dominant in the marketplace. The two platforms currently have 85% of the smartphone marketplace and are continuing to grow that marketshare. Developers are being tasked with targeting these two platforms. In this session, we’ll take a high level look at how we can use c# and .NET knowledge to share code between iOS and and Android. We’ll look at linked files, using the Xamarin Mobile API, the challenges of running across platforms and frameworks, as well as other features of Visual Studio, Monotouch, MonoDevelop, and Mono for Android that allows us to write as much code that can run on both platforms.Here is the registration link: https://www302.livemeeting.com/lrs/8001676474/Registration.aspx?pageName=2w197495hzh0t56g

    Read the article

  • Run Blustacks or Android to play clash of clans on ubuntu 13.4+

    - by Joe Hanus
    I am trying to get rid of the need to dual boot Ubuntu and windows and one thing I can do with windows I can not do with Linux is to run Bluestacks to play android games my favourite one ow is clash of clans. I have tried different VM's to run android emulators and virtual box but nothing works for clash of clans I can download the game to the VM from Google Play Store but it fails to open If Ubuntu can fix this by making a way to successfully install Bluestacks on Ubuntu or Android with Virtual box with out loading errors of all apps/games it would help the Linux community to become less dependant of Windows. Thanks in advance! go Ubuntu!

    Read the article

  • Jump into Android or learn Java basics first?

    - by daniels
    I am quite proficient in C and know some C++, but never touched Java. Recently I got an idea for an app which I think has potential, and I want to develop it. I am planning to go Android first, cause it doesn't require a mac/iPhone. So my question is: can I go straight to learning Android development, picking up the Java syntax as I go along and need it (after all I don't think it's much different from C/C++), or should I take a couple of weeks to learn the basics of Java first and then start with Android development?

    Read the article

  • Posting to facebook from unity3d on iOS and android

    - by Guye Incognito
    I've made a game in unity3d for iOS and android. We have our own server to manage high scores and stuff like that. We'd also like to have the possibility post high scores to facebook, and also do things like this.. If you and your friend are have both posted a score for our game to facebook and you post a better score then you can send them a notification. I'm reading around about this now, but I'm wondering whats the normal way people do this? Possible ways.. Use the unity facebook SDK Looks like it would work but there are different versions for iOS and android. Call the facebook graph API directly from our server. This would unify the iOS and android versions and also it makes sense as our server holds / deals with all the highscore info. I can just imagine difficulties with logging in / authentication

    Read the article

  • Use Android NDK for portability with iOS?

    - by J-F L-R
    I am currently planning to implement a little painting app using OpenGL ES 1.1. I believe this question applies to any OpenGL ES project. I am starting development on Android and I would like to know if you would recommend writing the drawing logic (using OpenGL) in C++ with the NDK so it will easier to port to iOS, or to use the Java API and being locked on Android. The reason I am asking that is because I have seen mixed opinions on the Web about using the NDK (some people say it is an added level of complexity). From what I have already seen, I believe that I should go with the Java API since I am starting on Android and then, if I decide to go on iOS, to rewrite the OpenGL logic in Objective-C or C++. This should be pretty straightforward since the calls appear to be the same in both languages. What do you think? Am I right?

    Read the article

  • Port flash game to native android

    - by wirate
    Alright here is the problem: the creators of a quite popular flash-based game have asked me to port their game to Android. They are not interested in any other platforms so we don't need to be worrying about iOS or PC. They want the best performance on just Android (I guess that's the point of porting a flash-based game. They could have just went with it) They found Unity 'slow'. How would the performance (on android) of other engines compare? Are they expecting too much i.e. finding Unity slow? I am in favor of Unity since development is a little easier with more things being visual (I am not experienced as you might have guessed). This would be an example of the type of game I am to port Thanks!

    Read the article

  • Alignment of View Elements within a LinearLayout

    - by Adam
    I hate to ask this question; for some reason I can't figure it out on my own. I have a vertical LinearLayout that contains a custom View that I've defined in my app and and a TextView. I'd like my custom View to be aligned on the top of the screen and the TextView to be aligned at the bottom of the screen. Unfortunately, no matter what changes I make to the attributes of the XML file, my custom View always seems to be centered vertically when I run the emulator. The xml is like the following: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="top"> <CustomView android:id="@+id/customID" android:layout_width="wrap_content" android:layout_height="wrap_content" tileSize="24" android:focusableInTouchMode="true" android:layout_gravity="top"/> <TextView android:id="@+id/text" android:text="@string/droidtactoe_layout_text" android:visibility="visible" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center_horizontal" android:textSize="24sp" android:textColor="#00000000" android:layout_gravity="bottom"/> </LinearLayout>

    Read the article

  • How to implement navigation drawer selector similar to Google Play Music

    - by Shivam Bhalla
    I am looking to implement a navigation drawer selector which shows the currently selected item at all times when the drawer is opened and that is retained even when the drawer is closed. Something like this: I have used something like this but it only shows the selector when I click on the list item. This is in my res folder: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" android:drawable="@drawable/list_activated_holo" /> </selector> How do i attain the above shown implementation?Which state do i need to implement? Thanks

    Read the article

  • Record audio via MediaRecorder

    - by Isuru Madusanka
    I am trying to record audio by MediaRecorder, and I get an error, I tried to change everything and nothing works. Last two hours I try to find the error, I used Log class too and I found out that error occurred when it call recorder.start() method. What could be the problem? public class AudioRecorderActivity extends Activity { MediaRecorder recorder; File audioFile = null; private static final String TAG = "AudioRecorderActivity"; private View startButton; private View stopButton; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); startButton = findViewById(R.id.start); stopButton = findViewById(R.id.stop); setContentView(R.layout.main); } public void startRecording(View view) throws IOException{ startButton.setEnabled(false); stopButton.setEnabled(true); File sampleDir = Environment.getExternalStorageDirectory(); try{ audioFile = File.createTempFile("sound", ".3gp", sampleDir); }catch(IOException e){ Toast.makeText(getApplicationContext(), "SD Card Access Error", Toast.LENGTH_LONG).show(); Log.e(TAG, "Sdcard access error"); return; } recorder = new MediaRecorder(); recorder.setAudioSource(MediaRecorder.AudioSource.MIC); recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); recorder.setAudioEncodingBitRate(16); recorder.setAudioSamplingRate(44100); recorder.setOutputFile(audioFile.getAbsolutePath()); recorder.prepare(); recorder.start(); } public void stopRecording(View view){ startButton.setEnabled(true); stopButton.setEnabled(false); recorder.stop(); recorder.release(); addRecordingToMediaLibrary(); } protected void addRecordingToMediaLibrary(){ ContentValues values = new ContentValues(4); long current = System.currentTimeMillis(); values.put(MediaStore.Audio.Media.TITLE, "audio" + audioFile.getName()); values.put(MediaStore.Audio.Media.DATE_ADDED, (int)(current/1000)); values.put(MediaStore.Audio.Media.MIME_TYPE, "audio/3gpp"); values.put(MediaStore.Audio.Media.DATA, audioFile.getAbsolutePath()); ContentResolver contentResolver = getContentResolver(); Uri base = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; Uri newUri = contentResolver.insert(base, values); sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, newUri)); Toast.makeText(this, "Added File" + newUri, Toast.LENGTH_LONG).show(); } } And here is the xml layout. <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/RelativeLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <Button android:id="@+id/start" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="146dp" android:onClick="startRecording" android:text="Start Recording" /> <Button android:id="@+id/stop" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/start" android:layout_below="@+id/start" android:layout_marginTop="41dp" android:enabled="false" android:onClick="stopRecording" android:text="Stop Recording" /> </RelativeLayout> And I added permission to AndroidManifest file. <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="in.isuru.audiorecorder" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" /> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <activity android:name=".AudioRecorderActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.RECORD_AUDIO" /> </manifest> I need to record high quality audio. Thanks!

    Read the article

  • wifi disconnect event

    - by user986474
    when i get disconnect event by this code : public class WifiReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { String ssid="someSsidName"; ConnectivityManager conMan = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); NetworkInfo netInfo = conMan.getActiveNetworkInfo(); WifiInfo wifiInfo = null; if (netInfo.getType() == ConnectivityManager.TYPE_WIFI) { //android connect to wifi } else{ //do somthing } } } i try to know what the ssid name when android disconnect. i mean when android disconnect from wifi i need to know it (this i can know by my code) but what i missing is the ssid name android just disconnect from. there is a way to do that? (i know i can save the name when android connect to wifi and use this name when disconnect but this not the way i want...) thanks in advance!

    Read the article

  • Passing data between android ListActivities in Java

    - by Will Janes
    I am new to Android! I am having a problem getting this code to work... Basically I Go from one list activity to another and pass the text from a list item through the intent of the activity to the new list view, then retrieve that text in the new list activity and then preform a http request based on value of that list item. Log Cat 04-05 17:47:32.370: E/AndroidRuntime(30135): FATAL EXCEPTION: main 04-05 17:47:32.370: E/AndroidRuntime(30135): java.lang.ClassCastException:android.widget.LinearLayout 04-05 17:47:32.370: E/AndroidRuntime(30135): at com.thickcrustdesigns.ufood.CatogPage$1.onItemClick(CatogPage.java:66) 04-05 17:47:32.370: E/AndroidRuntime(30135): at android.widget.AdapterView.performItemClick(AdapterView.java:284) 04-05 17:47:32.370: E/AndroidRuntime(30135): at android.widget.ListView.performItemClick(ListView.java:3731) 04-05 17:47:32.370: E/AndroidRuntime(30135): at android.widget.AbsListView$PerformClick.run(AbsListView.java:1959) 04-05 17:47:32.370: E/AndroidRuntime(30135): at android.os.Handler.handleCallback(Handler.java:587) 04-05 17:47:32.370: E/AndroidRuntime(30135): at android.os.Handler.dispatchMessage(Handler.java:92) 04-05 17:47:32.370: E/AndroidRuntime(30135): at android.os.Looper.loop(Looper.java:130) 04-05 17:47:32.370: E/AndroidRuntime(30135): at android.app.ActivityThread.main(ActivityThread.java:3691) 04-05 17:47:32.370: E/AndroidRuntime(30135): at java.lang.reflect.Method.invokeNative(Native Method) 04-05 17:47:32.370: E/AndroidRuntime(30135): at java.lang.reflect.Method.invoke(Method.java:507) 04-05 17:47:32.370: E/AndroidRuntime(30135): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:907) 04-05 17:47:32.370: E/AndroidRuntime(30135): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665) 04-05 17:47:32.370: E/AndroidRuntime(30135): at dalvik.system.NativeStart.main(Native Method) ListActivity 1 package com.thickcrustdesigns.ufood; import java.util.ArrayList; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; import org.json.JSONException; import org.json.JSONObject; import android.app.ListActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.Button; import android.widget.ListView; import android.widget.TextView; public class CatogPage extends ListActivity { ListView listView1; Button btn_bk; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.definition_main); btn_bk = (Button) findViewById(R.id.btn_bk); listView1 = (ListView) findViewById(android.R.id.list); ArrayList<NameValuePair> nvp = new ArrayList<NameValuePair>(); nvp.add(new BasicNameValuePair("request", "categories")); ArrayList<JSONObject> jsondefs = Request.fetchData(this, nvp); String[] defs = new String[jsondefs.size()]; for (int i = 0; i < jsondefs.size(); i++) { try { defs[i] = jsondefs.get(i).getString("Name"); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } uFoodAdapter adapter = new uFoodAdapter(this, R.layout.definition_list, defs); listView1.setAdapter(adapter); ListView lv = getListView(); lv.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { TextView tv = (TextView) view; String p = tv.getText().toString(); Intent i = new Intent(getApplicationContext(), Results.class); i.putExtra("category", p); startActivity(i); } }); btn_bk.setOnClickListener(new View.OnClickListener() { public void onClick(View arg0) { Intent i = new Intent(getApplicationContext(), UFoodAppActivity.class); startActivity(i); } }); } } **ListActivity 2** package com.thickcrustdesigns.ufood; import java.util.ArrayList; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; import org.json.JSONException; import org.json.JSONObject; import android.app.ListActivity; import android.os.Bundle; import android.widget.ListView; public class Results extends ListActivity { ListView listView1; enum Category { Chicken, Beef, Chinese, Cocktails, Curry, Deserts, Fish, ForOne { public String toString() { return "For One"; } }, Lamb, LightBites { public String toString() { return "Light Bites"; } }, Pasta, Pork, Vegetarian } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setContentView(R.layout.definition_main); listView1 = (ListView) findViewById(android.R.id.list); Bundle data = getIntent().getExtras(); String category = data.getString("category"); Category cat = Category.valueOf(category); String value = null; switch (cat) { case Chicken: value = "Chicken"; break; case Beef: value = "Beef"; break; case Chinese: value = "Chinese"; break; case Cocktails: value = "Cocktails"; break; case Curry: value = "Curry"; break; case Deserts: value = "Deserts"; break; case Fish: value = "Fish"; break; case ForOne: value = "ForOne"; break; case Lamb: value = "Lamb"; break; case LightBites: value = "LightBites"; break; case Pasta: value = "Pasta"; break; case Pork: value = "Pork"; break; case Vegetarian: value = "Vegetarian"; } ArrayList<NameValuePair> nvp = new ArrayList<NameValuePair>(); nvp.add(new BasicNameValuePair("request", "category")); nvp.add(new BasicNameValuePair("cat", value)); ArrayList<JSONObject> jsondefs = Request.fetchData(this, nvp); String[] defs = new String[jsondefs.size()]; for (int i = 0; i < jsondefs.size(); i++) { try { defs[i] = jsondefs.get(i).getString("Name"); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } uFoodAdapter adapter = new uFoodAdapter(this, R.layout.definition_list, defs); listView1.setAdapter(adapter); } } Request package com.thickcrustdesigns.ufood; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.json.JSONArray; import org.json.JSONObject; import android.content.Context; import android.util.Log; import android.widget.Toast; public class Request { @SuppressWarnings("null") public static ArrayList<JSONObject> fetchData(Context context, ArrayList<NameValuePair> nvp) { ArrayList<JSONObject> listItems = new ArrayList<JSONObject>(); InputStream is = null; try { HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost( "http://co350-11d.projects02.glos.ac.uk/php/database.php"); httppost.setEntity(new UrlEncodedFormEntity(nvp)); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); is = entity.getContent(); } catch (Exception e) { Log.e("log_tag", "Error in http connection" + e.toString()); } // convert response to string String result = ""; try { BufferedReader reader = new BufferedReader(new InputStreamReader( is, "iso-8859-1"), 8); InputStream stream = null; StringBuilder sb = null; while ((result = reader.readLine()) != null) { sb.append(result + "\n"); } stream.close(); result = sb.toString(); } catch (Exception e) { Log.e("log_tag", "Error converting result " + e.toString()); } try { JSONArray jArray = new JSONArray(result); for (int i = 0; i < jArray.length(); i++) { JSONObject jo = jArray.getJSONObject(i); listItems.add(jo); } } catch (Exception e) { Toast.makeText(context.getApplicationContext(), "None Found!", Toast.LENGTH_LONG).show(); } return listItems; } } Any help would be grateful! Many Thanks EDIT Sorry very tired so missed out my 2nd ListActivity package com.thickcrustdesigns.ufood; import java.util.ArrayList; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; import org.json.JSONException; import org.json.JSONObject; import android.app.ListActivity; import android.os.Bundle; import android.widget.ListView; public class Results extends ListActivity { ListView listView1; enum Category { Chicken, Beef, Chinese, Cocktails, Curry, Deserts, Fish, ForOne { public String toString() { return "For One"; } }, Lamb, LightBites { public String toString() { return "Light Bites"; } }, Pasta, Pork, Vegetarian } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setContentView(R.layout.definition_main); listView1 = (ListView) findViewById(android.R.id.list); Bundle data = getIntent().getExtras(); String category = data.getString("category"); Category cat = Category.valueOf(category); String value = null; switch (cat) { case Chicken: value = "Chicken"; break; case Beef: value = "Beef"; break; case Chinese: value = "Chinese"; break; case Cocktails: value = "Cocktails"; break; case Curry: value = "Curry"; break; case Deserts: value = "Deserts"; break; case Fish: value = "Fish"; break; case ForOne: value = "ForOne"; break; case Lamb: value = "Lamb"; break; case LightBites: value = "LightBites"; break; case Pasta: value = "Pasta"; break; case Pork: value = "Pork"; break; case Vegetarian: value = "Vegetarian"; } ArrayList<NameValuePair> nvp = new ArrayList<NameValuePair>(); nvp.add(new BasicNameValuePair("request", "category")); nvp.add(new BasicNameValuePair("cat", value)); ArrayList<JSONObject> jsondefs = Request.fetchData(this, nvp); String[] defs = new String[jsondefs.size()]; for (int i = 0; i < jsondefs.size(); i++) { try { defs[i] = jsondefs.get(i).getString("Name"); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } uFoodAdapter adapter = new uFoodAdapter(this, R.layout.definition_list, defs); listView1.setAdapter(adapter); } } Sorry again! Cheers guys!

    Read the article

  • Android MediaPlayer ignores it's internal volume when the system volume changes

    - by Daniel Flower
    Hi, here is my situation: I have a media player playing music in an Android application. I've found that with certain headphones, the volume is much too loud even when the volume is set to it's lowest setting. As a result, I want to change the volume of the music for all volume levels to be 10% of what it normally is (actually, this value is user-defined of course). The following works perfectly: mediaPlayer.setVolume(0.1f, 0.1f); The volume of the music is now at a good level for listening. However, if the user now changes the volume using the volume rocker (thus changing the music stream volume), the media player changes the volume as expected, but it also seems to reset the 'setVolume' parameters to 1.0, causing a massive volume change. Setting the volume back to 0.1 sets the volume to how it should be (which is 10% of the current music stream volume). To quote the Android docs for the MediaPlayer.setVolume method: This API is recommended for balancing the output of audio streams within an application How can you do this if it gets reset to 1.0 each time the system volume changes? Any help muchly appreciated. Thanks.

    Read the article

  • Android Plugin in Eclipse 3.5 on Ubuntu 64bit got problems with properties

    - by Zordid
    Hi there! I got a huge problem with the Android Development Tools ADT running in Eclipse Galileo (3.5.1) on Ubuntu 9.10, 64bit. On this platform, I do not manage to see any property edit dialogs for layout properties. E.g. the one where you can select a string resource ID for text fields, or a drawable ID for image fields or backgrounds. Whenever I click on the ... button next to the property value - nothing happens, except this button disappears. Properties with a list of possible values, e.g. "wrap_content" or "fill_parent" are displayed in a dropdown box directly in the properties field. On a different system I work in a Windows environment with Eclipse 3.4 and the same ADT: no problems whatsoever, everything works fine, the dialogs come perfectly. Does anyone know what to do here? Where's the problem? Why does Eclipse not tell me that something goes wrong? Thanks! NEW DISCOVERIES: I found out that it might not even be an Android problem, but a general Eclipse problem that I can see with all version (Ganymede, Galileo, Helios) on my Linux (Ubuntu) system. It must be a simple UI problem: the button with ... next to the values does not receive the mouse click!! I managed to see the appropriate dialogs to edit the property values by doubleclicking the button - crazy, strange, ugly behavior! But why on earth does nobody else know about this problem - I cannot find anything else on the net about it! Could it be related to this strange "GDK native window problem" on Gnome? HELP!

    Read the article

< Previous Page | 35 36 37 38 39 40 41 42 43 44 45 46  | Next Page >