Search Results

Search found 25798 results on 1032 pages for 'android xml'.

Page 166/1032 | < Previous Page | 162 163 164 165 166 167 168 169 170 171 172 173  | Next Page >

  • AIDL based two way communication

    - by sshasan
    I have two apps between which I want some data exchanged. As they are running in different processes, so, I am using AIDL to communicate between them. Now, everything is happening really great in one direction (say my apps are A and B) i.e. data is being sent from A to B but, now I need to send some data from B to A. I noticed that we need to include the app with the AIDL in the build path of app where the AIDL method will be called. So in my case A includes B in its build path. For B to be able to send something to A, by that logic, B would need A in its build path. This would create a cycle. I am stuck at this point. And I cannot think of a work around this loop. Any help would be greatly appreciated :) . Thanks! ----EDIT---- So, I following the advice mentioned in one of the comments below, I have the following code In the IPCAIDL project the AIDL file resides, its contents are package ipc.android.aidl; interface Iaidl{ boolean pushBoolean(boolean flag); } This project is being used as a library in both the IPCServer and the IPC Client. The IPCServer Project has the service which defines what happens with the AIDL method. The file is booleanService.java package ipc.android.server; import ipc.android.aidl.Iaidl; import android.app.Service; import android.content.Intent; import android.os.IBinder; import android.os.RemoteException; import android.util.Log; public class booleanService extends Service { @Override public IBinder onBind(Intent intent) { return new Iaidl.Stub() { @Override public boolean pushBoolean(boolean arg0) throws RemoteException { Log.i("SERVER(IPC AIDL)", "Truth Value:"+arg0); return arg0; } }; } } The IPCClient file which calls this method is package ipc.android.client2; import ipc.android.aidl.Iaidl; import android.app.Activity; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.ServiceConnection; import android.os.Bundle; import android.os.IBinder; import android.os.RemoteException; import android.view.View; import android.widget.Button; public class IPCClient2Activity extends Activity { Button b1; Iaidl iAIDL; boolean k = false; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); bindService(new Intent("ipc.android.server.booleanService"), conn, Context.BIND_AUTO_CREATE); startService(new Intent("ipc.android.server.booleanService")); b1 = (Button) findViewById(R.id.button1); b1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if(k){ k = false; } else{ k = true; } try { iAIDL.pushBoolean(k); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); } private ServiceConnection conn = new ServiceConnection() { @Override public void onServiceDisconnected(ComponentName name) { // TODO Auto-generated method stub } @Override public void onServiceConnected(ComponentName name, IBinder service) { iAIDL = Iaidl.Stub.asInterface(service); } }; } The manifest file for IPCServer includes the declaration of the service.

    Read the article

  • connecting mysql from android with jdbc

    - by manuraphy
    hai i used the following code to connect mysql in local host from android. it only displays the actions given in catch section . i dont know whether its a connection problem or not package com.test1; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class Test1Activity extends Activity { /** Called when the activity is first created. */ String str="new"; static ResultSet rs; static PreparedStatement st; static Connection con; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final TextView tv=(TextView)findViewById(R.id.user); try { Class.forName("com.mysql.jdbc.Driver"); con=DriverManager.getConnection("jdbc:mysql://10.0.2.2:8080/example","root",""); st=con.prepareStatement("select * from country where id=1"); rs=st.executeQuery(); while(rs.next()) { str=rs.getString(2); } tv.setText(str); setContentView(tv); } catch(Exception e) { tv.setText(str); } } } when executes it displays "new" in the avd. java.lang.management.ManagementFactory.getThreadMXBean, referenced from method com.mysql.jdbc.MysqlIO.appendDeadlockStatusInformation Could not find class 'javax.naming.StringRefAddr', referenced from method com.mysql.jdbc.ConnectionPropertiesImpl$ConnectionProperty.storeTo Could not find method javax.naming.Reference.get, referenced from method com.mysql.jdbc.ConnectionPropertiesImpl$ConnectionProperty.initializeFrom can anyone suggest some solution ? and thankz in advance

    Read the article

  • Tutorials and libraries for OpenGL-ES games on Android

    - by user197141
    What tutorials and libraries are available which can help beginners to develop 2D and 3D games on Android using OpenGL-ES? I'm looking for tutorials which can help me learn OpenGL-ES, and I'm looking for OpenGL-ES libraries which can make life easier for beginners in OpenGL-ES. Since Android is still small, I guess it may be help-full to read iPhone OpenGL-ES tutorials as well, as I suppose the OpenGL-ES functionality is much the same. I have found the following useful information which I would have liked to share: Android tutorials: Basic tutorial covering polygons, no textures anddev forum with some tutorials Other Android OpenGL-ES information: Google IO lecture regarding games, not much OpenGLES The The Khronos Reference Manual is also relevant to have, but its not exactly the best place to start. iPhone OpenGL-ES tutorials (where the OpenGl-ES information is probably useful): http://web.me.com/smaurice/AppleCoder/iPhone_OpenGL/Archive.html http://iphonedevelopment.blogspot.com/2009/05/opengl-es-from-ground-up-table-of.html As for libraries which a beginner might use to get a simpler hands-on experience with OpenGL-ES, I have only found Rokon, which is recently started, thus has many holes and bugs. And it's gnuGPL licensed (at the moment) which means it cannot be used, if we wish to sell our games. What else is out there?

    Read the article

  • Android multiple email attachment using Intent question

    - by yyyy1234
    Hi, I've been working on Android program to send email with attachment (image file , audio file , etc) using Intent with (ACTION_SEND) . THe program is working when email has a single attachment. I used Intent.putExtra( android.content.Intent.EXTRA_STREAM, uri) to attach the designated image file to the mail and it is wokring fine , the mail can be delivered through Gmail . However, when I tried to have multiple images attached to the same mail by calling Intent.putExtra( android.content.Intent.EXTRA_STREAM, uri) multiple times, it failed to work. None of the attachment show up in the email . I searched the SDK documentation and Android programming user group about email attachment but cannot find any related info. However, I've discovered that there's another intent constnat ACTION_SEND_MULTIPLE (available since API level 4 ) which might meet my requirement. Based on SDK documentation, it simply states that it deliver multiple data to someone else , it works like ACTION_SEND , excpet the data is multiple. But I still could not figure out the correct usage for this command. I tried to delcare intent with ACTION_SEND_MULTIPLE , then call putExtra(EXTRA_STREAM, uri) multiple times to attach multiple images , but I got the same errnoenous result just like before, none of the attachment show up in the email. Has anyone tried with ACTION_SEND_MULTIPLE and got it working with multiple email attachment ? Thanks very much for your help. Regards, yyyy1234

    Read the article

  • android.intent.action.SCREEN_ON doesn't work as a receiver intent filter

    - by Jim Blackler
    I'm trying to get a BroadcastReceiver invoked when the screen is turned on. In my AndroidManifest.xml I have specified : <receiver android:name="IntentReceiver"> <intent-filter> <action android:name="android.intent.action.SCREEN_ON"></action> </intent-filter> </receiver> However it seems the receiver is never invoked (breakpoints don't fire, log statements ignored). I've swapped out SCREEN_ON for BOOT_COMPLETED for a test, and this does get invoked. This is in a 1.6 (SDK level 4) project. A Google Code Search revealed this, I downloaded the project and synced it, converted it to work with latest tools, but it too is not able to intercept that event. http://www.google.com/codesearch/p?hl=en#_8L9bayv7qE/trunk/phxandroid-intent-query/AndroidManifest.xml&q=android.intent.action.SCREEN_ON Is this perhaps no longer supported? Previously I have been able to intercept this event successfully with a call to Context.registerReceiver() like so registerReceiver(new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { // ... } }, new IntentFilter(Intent.ACTION_SCREEN_ON)); However this was performed by a long-living Service. Following sage advice from CommonsWare I have elected to try to remove the long-living Service and use different techniques. But I still need to detect the screen off and on events.

    Read the article

  • SOAP web client on Android

    - by BANSAL MOHIT
    Hi I am trying to create a web service client for the android but i am stuck really bad Attached is my code and WSDL file. Please help /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package org.me.androidapplication1; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import org.ksoap2.SoapEnvelope; import org.ksoap2.serialization.SoapObject; import org.ksoap2.serialization.SoapPrimitive; import org.ksoap2.serialization.SoapSerializationEnvelope; import org.ksoap2.transport.AndroidHttpTransport; import org.xmlpull.v1.XmlPullParserException; /** * * @author bansal */ public class MainActivity extends Activity { private String SOAP_ACTION = "http://src/getNews"; private String METHOD_NAME = "getNews"; private String NAMESPACE = "http://src/"; private static final String URL ="http://128.205.201.202:8080/RssService /RssServiceService?WSDL"; /** Called when the activity is first created. */ @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); TextView tv = new TextView(this); SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); request.addProperty("ticker","NASDAQ:INFY"); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); envelope.setOutputSoapObject(request); AndroidHttpTransport androidHttpTransport = new AndroidHttpTransport(URL); try { androidHttpTransport.call(SOAP_ACTION, envelope); SoapPrimitive p = (SoapPrimitive) envelope.getResponse(); tv.setText("Response " + p); } catch (Exception ex) { ex.printStackTrace(); } setContentView(tv); // ToDo add your GUI initialization code here } } Thanks

    Read the article

  • XML-RPC with PHP and GoDaddy? Confusion sets in.

    - by Chris Cooper
    Hey folks, I am attempting to work with XML-RPC via PHP on a GoDaddy server. This same server is hosting a Wordpress Blog that makes use of XML-RPC and is functioning, though that may be unrelated... Whenever I attempt to use any functions that are integrated into PHP for use with XML-RPC, I get an error (function list here: http://us3.php.net/manual/en/ref.xmlrpc.php) e.g.: Fatal error: Class 'xmlrpc_client' not found Is this because XML-RPC's PHP functions are not enabled on my server? If so, how do I go about enabling those - it would seem I would have to install the XML-RPC library to do so and of course I cannot do that on a shared server. Doesn't Wordpress use the same batch of XML-RPC functions though (it works fine)? I think I have managed to thoroughly confuse myself. I have zero experience with XML-RPC.

    Read the article

  • Android Share - Facebook SDK - ShareActionProvider

    - by Vlasto Benny Lava
    I am trying to implement sharing a simple string inside my application. Obviously everything other than Facebook works. As far as I know, now I have to use their Facebook SDK to post statuses on a wall. However, if I do implement it using their SDK, is there a way to have it incorporated into the chooser (default or ShareActionProvider) and somehow override it and insert the Facebook SDK's implementation? Or do I have to create a dedicated button? //EDIT package com.example.shareactionproviderdemo; import android.app.Activity; import android.content.Intent; import android.os.Bundle; public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Intent sharingIntent = new Intent(Intent.ACTION_SEND); sharingIntent.setType("text/plain"); sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Test message"); startActivity(Intent.createChooser(sharingIntent, "Share using")); } }

    Read the article

  • I can't compile android projetc wiht JNI code

    - by lobi
    I'm trying to build simple android app with some JNI code. When I press build project in eclipse I get this error: Description Resource Path Location Type fatal error: algorithm: No such file or directory Tracker line 56, external location: /home/slani/code/OpenCV-2.4.6-android-sdk/sdk/native/jni/include/opencv2/core/core.hpp C/C++ Problem make: *** [obj/local/armeabi/objs/detect_jni/detect_jni.o] Error 1 Tracker C/C++ Problem Line 56 in core.hpp contains the relevant include. This is my Android.mk file jni folder: LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) include /home/slani/code/OpenCV-2.4.6-android-sdk/sdk/native/jni/OpenCV.mk LOCAL_MODULE := detect_jni LOCAL_SRC_FILES := detect_jni.cpp include $(BUILD_SHARED_LIBRARY) This is my Aplication.mk file in jni folder: APP_STL := gnustl_static APP_CPPFLAGS := -frtti -fexceptions APP_ABI := armeabi-v7a APP_PLATFORM := all This is my .cpp file: #include <jni.h> #include <opencv/cv.h> #include <opencv2/imgproc/imgproc.hpp> #include <opencv2/features2d/features2d.hpp> using namespace cv; extern "C"{ JNIEXPORT void JNICALL Java_com_slani_tracker_OpenCamera_findObject((JNIEnv *env, jlong addRgba, jlong addHsv); JNIEXPORT void JNICALL Java_com_slani_tracker_OpenCamera_findObject((JNIEnv *env, jlong addRgba, jlong addHsv) { Mat& rgba = *(Mat*)addRgba; Mat& hsv = *(Mat*)addHsv; cvtColor(rgba, hsv,CV_RGBA2HSV); } } Can someone please help me? What could be causing this problem? Thanks

    Read the article

  • Simple Android Binary Text Clock

    - by Hristo
    Hello, I want to create a simple android binary clock but my application crashes. I use 6 textview fields: 3 for the decimal and 3 for the binary representation of the current time (HH:mm:ss). Here's the code: import java.text.SimpleDateFormat; import java.util.Calendar; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class Binary extends Activity implements Runnable { Thread runner; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); if (runner == null) { //start the song runner = new Thread(this); runner.start(); } } @Override public void run() { TextView hours_dec = (TextView) findViewById(R.id.hours_dec); TextView mins_dec = (TextView) findViewById(R.id.mins_dec); TextView secs_dec = (TextView) findViewById(R.id.secs_dec); TextView hours_bin = (TextView) findViewById(R.id.hours_bin); TextView mins_bin = (TextView) findViewById(R.id.mins_bin); TextView secs_bin = (TextView) findViewById(R.id.secs_bin); SimpleDateFormat hours_sdf = new SimpleDateFormat("HH"); SimpleDateFormat mins_sdf = new SimpleDateFormat("mm"); SimpleDateFormat secs_sdf = new SimpleDateFormat("ss"); Calendar cal = Calendar.getInstance(); while (runner != null) { WaitAMoment(); cal.getTime(); hours_dec.setText(hours_sdf.format(cal.getTime())); mins_dec.setText(mins_sdf.format(cal.getTime())); secs_dec.setText(secs_sdf.format(cal.getTime())); hours_bin.setText(String.valueOf(Integer.toBinaryString(Integer.parseInt((String) hours_dec.getText())))); mins_bin.setText(String.valueOf(Integer.toBinaryString(Integer.parseInt((String) mins_dec.getText())))); secs_bin.setText(String.valueOf(Integer.toBinaryString(Integer.parseInt((String) secs_dec.getText())))); } } protected void WaitAMoment() { try { Thread.sleep(100); } catch (InterruptedException e) { }; } }`

    Read the article

  • Android Launcher Shortcuts

    - by Tim
    I have made a simple punch in / punch out time clock application. I want to add the user the option of making a shortcut on the homescreen that will toggle the state of the app(time out / time in) but I don't want this shortcut to open up the app on the screen at all. here is my setupShortcut() private void setupShortcut() { Intent shortcutIntent = new Intent(this, Toggle.class); // shortcutIntent.setClassName(this, Toggle.class.getName()); shortcutIntent.putExtra(EXTRA_KEY, "ToggleShortcut"); shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); Intent intent = new Intent(); intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent); intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "ToggleShortcut"); Parcelable iconResource = Intent.ShortcutIconResource.fromContext(this, R.drawable.app_sample_code); intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconResource); setResult(RESULT_OK, intent); } Toggle.class is an activity that toggles the state for me. In the manifest I have these settings on it <activity android:name=".Toggle" android:exported="true" android:theme="@android:style/Theme.Translucent.NoTitleBar"> As it is now I can create a shortcut on the home screen then press it. The first time I press it it starts the Toggle activity and completes it fine, but it also opens up the TimeClock activity on the screen. If I then hit the back button I go back to the home. I can now press this shortcut and it will start the Toggle activity and not change the screen. Before I added: shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); It would open up the TimeClock activity every time. Now it is just the first time. But I want it to never show anything on the screen when the Toggle shortcut is pressed. Does anyone have any idea of how to get rid of that?

    Read the article

  • Android SMS API

    - by Schildmeijer
    I know that the SMS content provider is not part of the public API (at least not documented), but if I understand correctly it's still possible to use many of the SMS features as long as you know how to use the API(?). E.g it's pretty straightforward to insert an SMS into your inbox: ContentValues values = new ContentValues(); values.put("address", "+457014921911"); contentResolver.insert(Uri.parse("content://sms"), values); Unfortunately this does not trigger the standard "new-SMS-in-your-inbox" notification. Is it possible to trigger this manually? Edit: AFAIK the "standard mail application (Messaging)" in Android is listening for incoming SMSes using the android.permission.RECEIVE_SMS permission. And then, when a new SMS has arrived, a status bar notification is inserted with a "special" notification id. So one solution to my problem (stated above) could be to find, and send the correct broadcast intent; something like "NEW SMS HAS ARRIVED"-intent. Edit: Downloaded a third party messaging application (chompsms) from Android market. This application satisfies my needs better. When i execute the code above the chompsms notice the new sms and shows the "standard status bar notification". So I would say that the standard Android Messaging application is not detecting sms properly? Or am I wrong?

    Read the article

  • HTML5 <video> element on Android does not play

    - by T1000
    Video tags like below plays fine with iPhone, but not Android: <video id="video" width="320" height="240" poster="video/placeholder.jpg" autobuffer controls> <source src="pr6.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'> <source src="pr6.ogv" type='video/ogg; codecs="theora, vorbis"'> </video> With the above code, Android can't even click the clip. It would just see the poster image. Video tag like below however works with Android: <video src="vpr6.mp4" poster="video/placeholder.jpg" onclick="this.play();"/> However, I still need to multiple sources capability (for Firefox ogv support…). Below code does not work (nor do they work if I stick the javascript into the source tags): <video id="video" width="320" height="240" autobuffer controls onclick="this.play();"> <source src="pr6.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'> <source src="pr6.ogv" type='video/ogg; codecs="theora, vorbis"'> </video> With above code, the clip is clickable in Android, but still does nothing. Can anyone help?

    Read the article

  • Serialization Performance and Google Android

    - by Jomanscool2
    I'm looking for advice to speed up serialization performance, specifically when using the Google Android. For a project I am working on, I am trying to relay a couple hundred objects from a server to the Android app, and am going through various stages to get the performance I need. First I tried a terrible XML parser that I hacked together using Scanner specifically for this project, and that caused unbelievably slow performance when loading the objects (~5 minutes for a 300KB file). I then moved away from that and made my classes implement Serializable and wrote the ArrayList of objects I had to a file. Reading that file into the objects the Android, with the file already downloaded mind you, was taking ~15-30 seconds for the ~100KB serialized file. I still find this completely unacceptable for an Android app, as my app requires loading the data when starting the application. I have read briefly about Externalizable and how it can increase performance, but I am not sure as to how one implements it with nested classes. Right now, I am trying to store an ArrayList of the following class, with the nested classes below it. public class MealMenu implements Serializable{ private String commonsName; private long startMillis, endMillis, modMillis; private ArrayList<Venue> venues; private String mealName; } And the Venue class: public class Venue implements Serializable{ private String name; private ArrayList<FoodItem> foodItems; } And the FoodItem class: public class FoodItem implements Serializable{ private String name; private boolean vegan; private boolean vegetarian; } IF Externalizable is the way to go to increase performance, is there any information as to how java calls the methods in the objects when you try to write it out? I am not sure if I need to implement it in the parent class, nor how I would go about serializing the nested objects within each object.

    Read the article

  • How does it affect me as a developer/engineer/company that Android is open source

    - by danke
    I understand the concept of open source, but I just realized now that I understand it from only one view: when I open source my own code. I don't really understand what benefit I'm getting from receiving the same thing. As a regular developer (like the majority of us here), I did not spend the past 4 years of my life working on "developing" the android. So even though I'm a developer, I'm at the end of the developers chain when it comes to the Android (like most of us). I'm really more of an end user. So my interest in Android isn't really to dedicate all my time to it or work on improving its kernel or anything overly ambitious. So with that clear, as a developer considering developing for the Android, how does it really benefit me that it's open source? What's the added benefit that I'm missing? Can other developers share some concrete ways that its open source status actually affects us as developers. Basically I'm trying to understand how we, at this developer level, can make sense of the fact that it's open source, or is its open source status just hype for us at our end developer level. Thanks

    Read the article

  • Why isn't my bundle getting passed?

    - by NickTFried
    I'm trying to pass a bundle of two values from a started class to my landnav app, but according to the debug nothing is getting passed, does anyone have any ideas why? package edu.elon.cs.mobile; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; public class PointEntry extends Activity{ private Button calc; private EditText longi; private EditText lati; private double longid; private double latd; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.pointentry); calc = (Button) findViewById(R.id.coorCalcButton); calc.setOnClickListener(landNavButtonListener); longi = (EditText) findViewById(R.id.longitudeedit); lati = (EditText) findViewById(R.id.latitudeedit); } private void startLandNav() { Intent intent = new Intent(this, LandNav.class); startActivityForResult(intent, 0); } private OnClickListener landNavButtonListener = new OnClickListener() { @Override public void onClick(View arg0) { Bundle bundle = new Bundle(); bundle.putDouble("longKey", longid); bundle.putDouble("latKey", latd); longid = Double.parseDouble(longi.getText().toString()); latd = Double.parseDouble(lati.getText().toString()); startLandNav(); } }; } This is the class that is suppose to take the second point package edu.elon.cs.mobile; import com.google.android.maps.GeoPoint; import com.google.android.maps.MapActivity; import com.google.android.maps.MapController; import com.google.android.maps.MapView; import com.google.android.maps.MyLocationOverlay; import com.google.android.maps.Overlay; import android.content.Context; import android.graphics.drawable.Drawable; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorManager; import android.location.Location; import android.location.LocationManager; import android.os.Bundle; import android.util.Log; import android.widget.EditText; import android.widget.TextView; public class LandNav extends MapActivity{ private MapView map; private MapController mc; private GeoPoint myPos; private SensorManager sensorMgr; private TextView azimuthView; private double longitudeFinal; private double latitudeFinal; double startTime; double newTime; double elapseTime; private MyLocationOverlay me; private Drawable marker; private GeoPoint finalPos; private SitesOverlay myOverlays; public LandNav(){ startTime = System.currentTimeMillis(); } public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.landnav); Bundle bundle = this.getIntent().getExtras(); if(bundle != null){ longitudeFinal = bundle.getDouble("longKey"); latitudeFinal = bundle.getDouble("latKey"); } azimuthView = (TextView) findViewById(R.id.azimuthView); map = (MapView) findViewById(R.id.map); mc = map.getController(); sensorMgr = (SensorManager) getSystemService(Context.SENSOR_SERVICE); LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE); Location location = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER); int longitude = (int)(location.getLongitude() * 1E6); int latitude = (int)(location.getLatitude() * 1E6); finalPos = new GeoPoint((int)(latitudeFinal*1E6), (int)(longitudeFinal*1E6)); myPos = new GeoPoint(latitude, longitude); map.setSatellite(true); map.setBuiltInZoomControls(true); mc.setZoom(16); mc.setCenter(myPos); marker = getResources().getDrawable(R.drawable.greenmarker); marker.setBounds(0,0, marker.getIntrinsicWidth(), marker.getIntrinsicHeight()); me = new MyLocationOverlay(this, map); myOverlays = new SitesOverlay(marker, myPos, finalPos); map.getOverlays().add(myOverlays); } @Override protected boolean isRouteDisplayed() { return false; } @Override protected void onResume() { super.onResume(); sensorMgr.registerListener(sensorListener, sensorMgr.getDefaultSensor(Sensor.TYPE_ORIENTATION), SensorManager.SENSOR_DELAY_UI); me.enableCompass(); me.enableMyLocation(); //me.onLocationChanged(location) } protected void onPause(){ super.onPause(); me.disableCompass(); me.disableMyLocation(); } @Override protected void onStop() { super.onStop(); sensorMgr.unregisterListener(sensorListener); } private SensorEventListener sensorListener = new SensorEventListener() { @Override public void onAccuracyChanged(Sensor arg0, int arg1) { // TODO Auto-generated method stub } private boolean reset = true; @Override public void onSensorChanged(SensorEvent event) { newTime = System.currentTimeMillis(); elapseTime = newTime - startTime; if (event.sensor.getType() == Sensor.TYPE_ORIENTATION && elapseTime > 400) { azimuthView.setText(Integer.toString((int) event.values[0])); startTime = newTime; } } }; }

    Read the article

  • Creating ListView with check boxes...Android

    - by deewangan
    Hello, I am trying to create a listview that has check box beside each item. (i am following a code from the book android), but i can't get it to work, every time i run it, it crashes. since i am very new to this android staff, i have no clue what to do to get it to work, any help is appreciated.the code is below. *i have created two layout files in names of list and list_item. the code for the main activity: public class ListDemoActivity extends ListActivity { /** Called when the activity is first created. */ String[] listItems = {"exploring", "android","list", "activities"}; private SimpleCursorAdapter adapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.lists); //setListAdapter(new ArrayAdapter(this,android.R.layout.simple_list_item_1, listItems)); //setContentView(R.layout.lists); Cursor c = getContentResolver().query(People.CONTENT_URI, null, null, null, null); startManagingCursor(c); String[] cols = new String[]{People.NAME}; int[] names = new int[]{R.id.row_tv}; adapter = new SimpleCursorAdapter(this,R.layout.list_item,c,cols,names); this.setListAdapter(adapter); } } the lists file content: <?xml version="1.0" encoding="utf-8"?> and the list_item file content: <?xml version="1.0" encoding="utf-8"?>

    Read the article

  • What's wrong with debugging in Eclipse on Android?

    - by Sebastian Dwornik
    I've obviously been spoiled by Visual Studio, because although I'm just learning Android and the Eclipse environment, debugging apps in Eclipse is becoming a serious detriment to further development. For example, Eclipse will compile this divide by zero just fine: public class Lesson2Main extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate (savedInstanceState); int i = 1 / 0; TextView tv = new TextView (this); tv.setText ("Hello, Android!"); setContentView (tv); } } And then, when it executes it under the debugger, I will get a full screen of useless debug info, non of which actually points me to the specific line containing the error. The stackTrace is null within the exception ('e') info tree, and it simply states a message stating 'ArithmeticException'. (that's nice, how about you point me in the direction of where you found it!?) I've looked all over the screen and am baffled that this IDE can't get this right. Does developing with Eclipse resort everyone back to 1991 with printf() like logging at every interval then to track down bugs? Seriously. Is there a configuration or plug-in that I'm missing to help with this? I haven't tested this case with XCode, but if the iPhone dev. IDE handles this more like Visual Studio, then no wonder the Android marketplace has so few apps. I'm excited about Android, but it seems that Eclipse is getting in the way.

    Read the article

  • android python full integration

    - by Grzegorz Oledzki
    Is there a way to fully integrate Python with Java code on Android platform? Yes, I saw the question about running Python on Android and Android Scripting Environment (ASE). But that doesn't seem to be enough (correct me if I am wrong). I wanted to be able not only to invoke a Python script from within Java code, but have a full integration. The feature I need the most is the ability to have a state of execution of python code saved and be able to run several parts of code on demand against the same execution state. On JavaSE I would rely on Jython. I believe its simplest example shows it all (and some other features too, like something I would call variable state introspection): http://www.jython.org/archive/21/docs/embedding.html PythonInterpreter interp = new PythonInterpreter(); System.out.println("Hello, brave new world"); interp.exec("import sys"); interp.exec("print sys"); interp.set("a", new PyInteger(42)); interp.exec("print a"); interp.exec("x = 2+2"); PyObject x = interp.get("x"); System.out.println("x: "+x); System.out.println("Goodbye, cruel world"); Is it possible on Android? Is ASE a way to go?

    Read the article

  • Android Bluetooth Cross Platform Interoperability

    - by Philipp
    Hi, I have a Bluetooth service that I programmed for .Net on a Windows machine and I would like my Android 2.1 phone to connect to it. The server is listening for the same UUID which the Android is using to connect. But the connection is failing. When I try to connect to devices that are not listening for that UUID, I get an exception with the message "Service discovery failed", but when I try to connect to the server that is listening for the right UUID a message box pops up saying: "There was a problem pairing with bluetooth device." And I get an exception with the message "Connection timed out." So it looks like the server and the Android are communicating, but there is some sort of failure during handshaking. I know that the Android requires that the server is paired with the phone and also encrypts the communication channel. Does anyone know which specifications are used to do this? I would love to get my server to respond properly to the connection attempt. Thanks!

    Read the article

  • Android: CustomListAdapter

    - by primal
    Hi, I have implemented a custom list view which looks like the twitter timeline. adapter = new MyClickableListAdapter(this, R.layout.timeline, mObjectList); setListAdapter(adapter); The constructor for MyClickableListAdapter is as follows private class MyClickableListAdapter extends ClickableListAdapter{ public MyClickableListAdapter(Context context, int viewId, List objects) { super(context, viewId, objects); } ClickableListAdapter extends BaseAdapter and implements the necessary methods. The xml code for the list view is as follows <ListView android:id="@+id/android:list" android:layout_width="fill_parent" android:layout_height="wrap_content" /> This is what it looks like. I have 3 questions 1) I tried registering a context menu for the list view by adding the line after setting the list adapter registerforContextMenu(getListView()); But on long-click the menu doesnt get displayed. I cannot understand what I am doing wrong! 2) Is it possible to display a textview above the listview? I tried it by adding the code for textview above the listview. But then, only the textview gets displayed. 3) I have seen in many twitter clients that on clicking post a window pops up from the top covering only some portion of the screen and rest of the timeline is visible. How can this be done possibly without starting a new activity? Any help would be much appreciated..

    Read the article

  • Android Signal analysis + some filters.

    - by Profete162
    Hello, as the world cup is the main sport event and the Vuvuzelas are the most annoying sound in the world, I had an idea to remove them definitively by reading this new ( http://www.popsci.com/diy/article/2010-06/simple-software-can-filter-out-vuvuzela-whine) that told us that the sound has some frequencies at 233Hz + 466,932,1864Hz. I have already made a lot of Android application by myself but never touching the signal analysis and filtering part, so here are a few questions, I do not ask for precise answer but maybe links and tutorial to find something to work on. I guess that a new Android phone has the CPU and power to make real-time filtering. 1) How can I intercept the sound coming from the Jack microphone - Line-IN plug- ( I plan to link my TV to my phone with Jack to Jack plug). My question is totally software and coding, I have all the wires and adapters to plug a jack into my android phone Line IN. 2) Are there some Fourier analysis librairies, may I have a look to Java libraries on the web and import them to my Android project? I really apologize because my question seem not precise, but I think that would be something great. Thank you for your answers.

    Read the article

  • Call .NET Webservice with Android

    - by Lasse P
    Hi, I know this question has been asked here before, but I don't think those answers were adequate for my needs. We have a SOAP webservice that is used for an iPhone application, but it is possible that we need an Android specific version or a proxy of the service, so we have the option to go with either SOAP or JSON. I have a few concerns about both methods: SOAP solution: Is it possible to generate java source code from a WSDL file, if so, will it include some kind of proxy class to invoke the webservice and will it work in the Android environment at all? Google has not provided any SOAP library in Android, so i need to use 3rd party, any suggestion? What about the performance/overhead with parsing and transmitting SOAP xml over the wire versus the JSON solution? JSON solution: There is a few classes in the Android sdk that will let me parse JSON, but does it support generic parsing, like if I want the result to be parsed as a complex type? Or would I need to implement that myself? I have read about 2 libraries before here on Stackoverflow, GSON an Jackson. What is the difference performance and usability (from a developers perspective) wise? Do you guys have any experince with either of those libraries? So i guess the big question is, what method to go with? I hope you can help me out. Thanks in advance :-)

    Read the article

  • I am using jquery ajax using text() but any html written in the XML doesn't render?

    - by Xtian
    So I have Jquery Ajax working real nice, but an issue I am having is in my XML if I want to bold a work or Italicize a sentence, if I do it in the XML using HTML tags it will not show up. I am pretty sure it is due to using the .text(). Any suggestions on a work around for this? $(document).ready(function(){ $.ajax({ type: "GET", url: "xml/sites.xml", dataType: "xml", success: function(xml) { $(xml).find('site').each(function(){ $(this).find('desc').each(function(){ var brief = $(this).find('brief').text(); var long = $(this).find('long').text(); var url = $(this).find('url').text(); $('<div class="brief"></div>').html(brief).appendTo('#link_'+id);

    Read the article

  • Android newbie installing Eclipse, having issues....

    - by Jeff
    I am a web developer, new to app development and Java/Android. I am about to follow some tutorials to get started learning but I'm running into a wall. The Android dev site says the recommended way to build Android apps is in Java using the Eclipse plug in. So I downloaded Eclipse Classic and unzipped it on to get this error: "A Java Runtime Environment (JRE) or Java Development Kit (JDK) must be available in order to run Eclipse. No Java virtual machine was found after searching the following locations: /Users//Desktop/eclipse/Eclipse.app/Contents/MacOS/jre/bin/java java in your current PATH" Any idea what the issue is and how I can fix it? Again, newbie to java, jre, android, so I apologize if this question has already been asked. In my research I've discovered that most of the posts or solutions I've found are tough for me to follow. There's always a few unclear items that are probably prohibiting me from getting the answer I need. So I'm hoping someone can walk me through installing or configuring whatever I need to regarding Java so I can continue installing Eclipse and begin learning. I should probably note that I'm on Mac OSX 10.6.6 Snow Leopard. Please let me know if you need any other info. Thanks so much in advance for any and all help!!!

    Read the article

< Previous Page | 162 163 164 165 166 167 168 169 170 171 172 173  | Next Page >