Search Results

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

Page 148/1032 | < Previous Page | 144 145 146 147 148 149 150 151 152 153 154 155  | Next Page >

  • android: how to add an image button?

    - by Yang
    I am trying to replace my previous ugly text button with an imagebutton. However, after changing the XML file with the following ImageButton code, my application won't even start. Why? <ImageButton android:layout_height="fill_parent" android:id="@+id/refresh" android:src="@drawable/refresh" />

    Read the article

  • flush XML tags having certain value

    - by azathoth
    Hello all I have a webservice that returns an XML like this: <?xml version="1.0" encoding="UTF-8"?> <contractInformation> <contract> <idContract type="int">87191827</idContract> <region type="varchar">null</region> <dueDate type="varchar">null</dueDate> <contactName type="varchar">John Smith</contactName> </contract> </contractInformation> I want to empty every tag that contains the string null, so it would look like this: <?xml version="1.0" encoding="UTF-8"?> <contractInformation> <contract> <idContract type="int">87191827</idContract> <region type="varchar"/> <dueDate type="varchar"/> <contactName type="varchar">John Smith</contactName> </contract> </contractInformation> How do I accomplish that by using XSLT?

    Read the article

  • Android Service setForeground While Display Sleeps

    - by c12
    I have a background Android Service that's purpose is to communicate with another device (non-phone) using a Bluetooth socket. Everything works fine except that the service gets stopped and restarted by the OS when the phone display is sleeping. This restart sometimes leaves a 15-20 minute gaps where there is no communication between the Service and the Bluetooth device and I need to be able to query the device every minute. Is startForeground the proper approach? Attempted to use: startForeground(int, Notification) //still see gaps when phone sleeps Service: public class ForegroundBluetoothService extends Service{ private boolean isStarted = false; @Override public void onDestroy() { super.onDestroy(); stop(); } /** * @see android.app.Service#onBind(android.content.Intent) */ @Override public IBinder onBind(Intent intent) { return null; } /** * @see android.app.Service#onStartCommand(android.content.Intent, int, int) */ @Override public int onStartCommand(Intent intent, int flags, int startId) { loadServiceInForeground(); return(START_STICKY); } private void loadServiceInForeground() { if (!isStarted) { isStarted=true; Notification notification = new Notification(R.drawable.icon, "Service is Running...", System.currentTimeMillis()); Intent notificationIntent = new Intent(this, MainScreen.class); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0); notification.setLatestEventInfo(this, "Notification Title", "Service is Running...", pendingIntent); startForeground(12345, notification); try{ queryTheBluetoothDevice(); } catch(Exception ex){ ex.printStackTrace(); } } } private void stop() { if (isStarted) { isStarted=false; stopForeground(true); } } }

    Read the article

  • XML to JSON - losing root node

    - by Mike
    I'm using net.sf.json with a Java project and it works great. The conversion of this XML: <?xml version="1.0" encoding="UTF-8"?> <important-data certified="true" processed="true"> <timestamp>232423423423</timestamp> <authors> <author> <firstName>Tim</firstName> <lastName>Leary</lastName> </author> </authors> <title>Flashbacks</title> <shippingWeight>1.4 pounds</shippingWeight> <isbn>978-0874778700</isbn> </important-data> converts to this in JSON: { "@certified": "true", "@processed": "true", "timestamp": "232423423423", "authors": [ { "firstName": "Tim", "lastName": "Leary" }], "title": "Flashbacks", "shippingWeight": "1.4 pounds", "isbn": "978-0874778700" } However, the root tag <important-data> is lost in the conversion. Being new to XML and JSON, I am not sure if this is suppose to be the correct behaviour. If not, is there any way to tell net.sf.json to convert it while keeping the root node property? Thanks.

    Read the article

  • How do you rename the child XML elements used in an XML Serialized List<string>?

    - by GrZeCh
    Hello, I'm serializing to XML my class where one of properties has type List<string>. public class MyClass { ... public List<string> Properties { get; set; } ... } XML created by serializing this class looks like this: <MyClass> ... <Properties> <string>somethinghere</string> <string>somethinghere</string> </Properties> ... </MyClass> and now my question. How can I change my class to achieve XML like this: <MyClass> ... <Properties> <Property>somethinghere</Property> <Property>somethinghere</Property> </Properties> ... </MyClass> after serializing. Thanks for any help!

    Read the article

  • linq to xml selection/update

    - by gleasonomicon
    If I have the following xml, how would I use linq to xml blank out the date fields in each video node? I wanted to do it for the purpose of a comparison in a unit test. <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <main> <videos> <video> <id>00000000-0000-0000-0000-000000000000</id> <title>Video Title</title> <videourl>http://sample.com</videourl> <thumbnail>http://sample.com</thumbnail> <dateCreated>2011-01-12T18:54:56.7318386-05:00</dateCreated> <dateModified>2011-02-12T18:54:56.7318386-05:00</dateModified> <Numbers> <Number>28</Number> <Number>78</Number> </Numbers> </video> <video> <id>00000000-0000-0000-0000-000000000000</id> <title>Video Title</title> <videourl>http://sample.com</videourl> <thumbnail>http://sample.com</thumbnail> <dateCreated>2011-01-12T18:54:56.7318386-05:00</dateCreated> <dateModified>2011-02-12T18:54:56.7318386-05:00</dateModified> <Numbers> <Number>28</Number> <Number>78</Number> </Numbers> </video> </videos>

    Read the article

  • Important(useful) websites for the "Android" related stuff

    - by PM - Paresh Mayani
    Hello all Androiders, As such There is no particular repository for Android, i would like to initiate this. Now, let me clear about my idea: My idea is that Wherever you find any website and if you find it helps for the Android, then pls try to post here. This post works as a common Android-Database storing all the website-links which are either of Articles, code, examples, pdf, or any. So that whenever anybody having doubt regarding Android Stuff, then they can easily browse through links and may easily find the solution. and At the time of submitting the link, you feel it helps to others, but in future, may you return back to the post for searching the link for finding solution of your problem. So please share links.

    Read the article

  • Javascript function with PHP throwing a "Illegally Formed XML Syntax" error

    - by Joe
    I'm trying to learn some javascript and i'm having trouble figuring out why my code is incorrect (i'm sure i'm doing something wrong lol), but anyways I am trying to create a login page so that when the form is submitted javascript will call a function that checks if the login is in a mysql database and then checks the validity of the password for the user if they exist. however I am getting an error (Illegally Formed XML Syntax) i cannot resolve. I'm really confused, mostly because netbeans is saying it is a xml syntax error and i'm not using xml. here is the code in question: function validateLogin(login){ login.addEventListener("input", function() { $value = login.value; if (<?php //connect to mysql mysql_connect(host, user, pass) or die(mysql_error()); echo("<script type='text/javascript'>"); echo("alert('MYSQL Connected.');"); echo("</script>"); //select db mysql_select_db() or die(mysql_error()); echo("<script type='text/javascript'>"); echo("alert('MYSQL Database Selected.');"); echo("</script>"); //query $result = mysql_query("SELECT * FROM logins") or die(mysql_error()); //check results against given login while($row = mysql_fetch_array($result)){ if($row[login] == $value){ echo("true"); exit(0); } } echo("false"); exit(0); ?>) { login.setCustomValidity("Invalid Login. Please Click 'Register' Below.") } else { login.setCustomValidity("") } }); } the code is in an external js file and the error throws on the last line. Also from reading i understand best practices is to not mix js and php so how would i got about separating them but maintaining the functionality i need? thanks!

    Read the article

  • Restructure an xml document

    - by krishna
    here is my structure of xml document, <worldpatentdata> <patent-family> <exchange-documents>......</exchange-documents> <exchange-documents>......</exchange-documents> <exchange-documents>......</exchange-documents> <familymember>.....</familymember> <exchange-documents>......</exchange-documents> <exchange-documents>......</exchange-documents> <familymember>.....</familymember> <exchange-documents>......</exchange-documents> <exchange-documents>......</exchange-documents> <familymember>.....</familymember> </patent-family> </worldpatentdata> In the above xml structure,all the element is found to be child node of element. I want these elements as childnode of element,so that the xml have the following structure, <worldpatentdata> <patent-family> <familymember>..... <exchange-documents>......</exchange-documents> <exchange-documents>......</exchange-documents> <exchange-documents>......</exchange-documents> </familymember> <familymember>..... <exchange-documents>......</exchange-documents> <exchange-documents>......</exchange-documents> </familymember> <familymember>..... <exchange-documents>......</exchange-documents> <exchange-documents>......</exchange-documents> </familymember> </patent-family> </worldpatentdata> can anybody help me on this? thanks

    Read the article

  • Should xml represent a set or a list?

    - by sixtyfootersdude
    I always think of xml like a set data structure. Ie: <class> <person>john</person> <person>sarah</person> </class> Is equivalent to: <class> <person>sarah</person> <person>john</person> </class> Question One: Are these two things logicly equivalant? Are you allowed to make things like this in xml? <methodCall> <param>happy</param> <param>sad</param> </methodCall> Or do you need to do it like this: <methodCall> <param arg="1">happy</param> <param arg="2">sad</param> </methodCall> Question Two: Are these two things logically equivalent? Question Three: Is xml usually treated like a set or a list?

    Read the article

  • Creating a 'flexible' XML schema

    - by Fiona Holder
    I need to create a schema for an XML file that is pretty flexible. It has to meet the following requirements: Validate some elements that we require to be present, and know the exact structure of Validate some elements that are optional, and we know the exact structure of Allow any other elements Allow them in any order Quick example: XML <person> <age></age> <lastname></lastname> <height></height> </person> My attempt at an XSD: <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="person"> <xs:complexType> <xs:sequence> <xs:element name="firstname" minOccurs="0" type="xs:string"/> <xs:element name="lastname" type="xs:string"/> <xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded" /> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> Now my XSD satisfies requirements 1 and 3. It is not a valid schema however, if both firstname and lastname were optional, so it doesn't satisfy requirement 2, and the order is fixed, which fails requirement 4. Now all I need is something to validate my XML. I'm open to suggestions on any way of doing this, either programmatically in .NET 3.5, another type of schema etc. Can anyone think of a solution to satisfy all 4 requirements?

    Read the article

  • How do I use XPath with a default namespace with no prefix?

    - by Scott Stafford
    What is the XPath (in C# API to XDocument.XPathSelectElements(xpath, nsman) if it matters) to query all MyNodes from this document? <?xml version="1.0" encoding="utf-8"?> <configuration> <MyNode xmlns="lcmp" attr="true"> <subnode /> </MyNode> </configuration I tried /configuration/MyNode which is wrong because it ignores the namespace. I tried /configuration/lcmp:MyNode which is wrong because lcmp is the URI, not the prefix. I tried /configuration/{lcmp}MyNode which failed because Additional information: '/configuration/{lcmp}MyNode' has an invalid token. EDIT: I can't use mgr.AddNamespace("df", "lcmp"); as some of the answerers have suggested. That requires that the XML parsing program know all the namespaces I plan to use ahead of time. Since this is meant to be applicable to any source file, I don't know which namespaces to manually add prefixes for. It seems like {my uri} is the XPath syntax, but Microsoft didn't bother implementing that... true?

    Read the article

  • Android XML-RPC Serialization Issue

    - by Josh Pennington
    I am attempting to use Android XML-RPC and for some calls I get the following exception: W/System.err( 837): java.io.IOException: Cannot serialize java.lang.Object@43759748 It looks like it is having troubles serializing the returned data, but I cannot find much documentation on how to actually use Android XML-RPC. The way I am using Android XML-RPC is as follows: Object response = (Object)client.call("sales_order.list", new Object()); This one is pretty odd. I have tried setting this call up in a few different ways (using HashMaps, not passing second variable, etc) and the response I get is that sales_order.list is not a valid Method. I have been able to login to the service using the following code: this.sessionId = (String)client.call("login", this.apiUserName, this.apiPassword); Does anyone have any ideas or a good resource on how to use Android XML-RPC? Thanks

    Read the article

  • Developing for iPhone or Android?

    - by Peter Bridger
    I'd like to start developing for iPhone or Android in my spare time, as a chance to learn something new but also hoping make some extra income. I'm not sure which is the best development for me to start developing on. I own an iPhone, but I don't have a Mac (which I would need to use the SDK), plus with the iPhone I believe there's an annual charge to develop for it. As far as I understand Android, the SDK is free and can be used on Windows. Professionally I develop using .net and C#, which sounds more similar to the Java based Android enviroment. Another negative I perceive against iPhone is it has a much more crowded App Store, I would think apps get better exposure on Android?

    Read the article

  • Retrieving content of a txt file from URL to Android

    - by eightx2
    I would like to be able to retrieve contents of a .txt file from the internet, and load it in an EditText. I tried using the code on this page: Reading Text File From Server on Android It didn't work, as you might have guessed. I've read on numerous sites about this type of problem, but I can't get anything to work. Someone suggested AndroidHttpClient (http://developer.android.com/reference/android/net/http/AndroidHttpClient.html), but I simply can't find any examples with this. As I'm a newbie in Android programming, I would love if someone could please give me a small example.

    Read the article

  • how to invoke an activity of a library project from an android apps

    - by Austin
    I have an open source android code that I need to use in my android apps. It has all the source code as well as resource files, manifest files and class path. It can be compiled as a separate android apps. I have constraints for using the open source. 1. I can't change a single line of code. 2. I can't use it as a separate apps. These constraints are non negotiable. What I have done is I have compiled the open source as class library(in Eclipse: Project Properties-Android- Tick check box Is Library). This has resulted in generation of .class files(in bin) for the java files and resource files. This open source has an android activity that i want to open from my application. So I have linked the directory of these sets of class files in the source section of my java build path( in .classpath). I have declared the activity in my manifest file with proper action intent filters. Now when I am trying to call activity from my code, its not working. Cleaning and rebuilding doesn't help. However, if I build the open source project and my apps in the same workspace of eclipse and link the open source in my apps in exact same manner it works fine. I am not able to identify the difference. All settings seems to be same(all files are identical in both the cases). But only in the second case it works. I have tried it as jar file also. I have build the open source as project library and exported it into a jar file(excluding manifest file). But in that case I am getting the following error UNEXPECTED TOP-LEVEL EXCEPTION: java.lang.IllegalArgumentException: already added: .... Conversion to Dalvik format failed with error 1 This I guess is coming because the android library(2.2) has been included twice in my apps( one for building my apps & another for building the open source). I dont know how to avoid this. Cleaning the project doesn't help. What i require is to use the open source and invoking it's activities in my apps without violating the constraints. If i can use the open source as bunch of .class files then great, or else any other way will do fine. Please look into it and let me know. Thanks

    Read the article

  • how to use a non standard tld with android

    - by CommentLuv
    I have rooted my android and am able to edit the hosts file to redirect .com and other standard tld's to my local server with no problems. non standard tld's do not work though. eg. my shop orders system is at http://fired.wok which works find on local machines when added to my windows and linux hosts files but is not resolvable from within my android device. I can use firedwok.co.uk) in the hosts file to point to my local machine but I'd much rather have fired.wok to work so I can use an android tablet to enter orders and deliveries. so, how to make android work with a tld like .wok ?

    Read the article

  • Android SDK: Hello World won't run !

    - by RedRoses
    Hello, This is a very very beginner question regarding Android Development I am trying to create and run the Hello world example from the Android SDK website, but I can't see anything appearing on the screen. It appears to me that Eclipse just hangs at this point: [2010-11-05 09:55:47 - HelloAndroid] ------------------------------ [2010-11-05 09:55:47 - HelloAndroid] Android Launch! [2010-11-05 09:55:47 - HelloAndroid] adb is running normally. [2010-11-05 09:55:47 - HelloAndroid] Performing com.example.helloandroid.HelloAndroid activity launch [2010-11-05 09:55:48 - HelloAndroid] Automatic Target Mode: launching new emulator with compatible AVD 'AVD2' [2010-11-05 09:55:48 - HelloAndroid] Launching a new emulator with Virtual Device 'AVD2' [2010-11-05 09:55:51 - HelloAndroid] New emulator found: emulator-5554 [2010-11-05 09:55:51 - HelloAndroid] Waiting for HOME ('android.process.acore') to be launched... [2010-11-05 09:57:10 - HelloAndroid] WARNING: Application does not specify an API level requirement! [2010-11-05 09:57:10 - HelloAndroid] Device API version is 8 (Android 2.2) [2010-11-05 09:57:10 - HelloAndroid] HOME is up on device 'emulator-5554' [2010-11-05 09:57:10 - HelloAndroid] Uploading HelloAndroid.apk onto device 'emulator-5554' [2010-11-05 09:57:12 - HelloAndroid] Installing HelloAndroid.apk... [2010-11-05 09:59:33 - HelloAndroid] Success! [2010-11-05 09:59:33 - HelloAndroid] Starting activity com.example.helloandroid.HelloAndroid on device emulator-5554 So it says "Starting activity ..." but nothing ever starts and it's already been more than 30 mins. What could be wrong?? Thanks !

    Read the article

  • Add badge for tab widget android

    - by user3496459
    I want to add badge for tab widget at android. i use android-viewbadger lib, but i not set badge show to image here code: tabs = (TabWidget) findViewById(android.R.id.tabs); badge = new BadgeView(this, tabs, 2); // badge.setBackgroundResource(R.drawable.badge_28); badge.setBadgePosition(BadgeView.POSITION_TOP_RIGHT); badge.setWidth(14); badge.setHeight(14); badge.show();

    Read the article

  • How can I create my own Android Home Screen Launcher

    - by Sam_k
    I want to know how I can create my own customised home screen for Android. I have used Viewpager to add and remove screens from the home screen, creating 5 screens as default, and then adding and removing further pages in with ViewPager. I have tried both Viewpager and PagerAdapter, as per this link. Is this the best approach so that in future I can add widgets and shortcuts with viewpager and make a launcher icon?

    Read the article

  • Trying to parse xml file for javascript quiz

    - by App_beginner
    Hi I am trying to create a javascript quiz, that gets the questions from a xml file. At the moment I am only starting out trying to parse my xml file without any success. Can anyone point me to what I am doing wrong? <html> <head> <title>Test</title> </head> <body> <div class="items"> </div> <script type="text/javascript"> var quizXML = '<quiz><Sporsmal tekst="bla bla bla"/><alternativer><tekst>bla</tekst><tekst>bli</tekst><tekst correct="yes">ble</tekst></alternativer><Sporsmal tekst="More blah"/><alternativer><tekst>bla bla</tekst><tekst correct="yes">bli bli</tekst><tekst>ble ble</tekst></alternativer></quiz>' var quizDOM = $.xmlDOM( quizXML ); quizDOM.find('quiz > Sporsmal').each(function() { var sporsmalTekst = $(this).attr('tekst'); var qDiv = $("<div />") .addClass("item") .addClass("sporsmal") .appendTo($(".spmArr")); var sTekst = $("<h2/>") .html(sporsmalTekst) .appendTo(qDiv); } </script> </body> </html> When I try this in my browser the classes and div are not being created. And the page is just blank. Am i doing something wrong when I intialize the xml?

    Read the article

  • Android: How to properly exit application when inconsistent condition is unavoidable?

    - by Bevor
    First of all I already read about all this discussion that it isn't a good idea to manually exit an Android application. But in my case it seems to be needed. I have an AsyncTask which does a lof of operations in background. That means downloading data, saving it to local storage and preparing it for usage in application. It could happen that there is no internet connection or something different happens. For all that cases I have an Exception handling which returns the result. And if there is an exception, the application is unusable so I need to exit it. My question is, do I have to do some unregistration unloading or unbinding tasks or something when I exit the application by code or is System.exit(0) ok? I do all this in an AsyncTask, see my example: public class InitializationTask extends AsyncTask<Void, Void, InitializationResult> { private ProcessController processController = new ProcessController(); private ProgressDialog progressDialog; private Activity mainActivity; public InitializationTask(Activity mainActivity) { this.mainActivity = mainActivity; } @Override protected void onPreExecute() { super.onPreExecute(); progressDialog = new ProgressDialog(mainActivity); progressDialog.setMessage("Die Daten werden aufbereitet.\nBitte warten..."); progressDialog.setIndeterminate(true); //means that the "loading amount" is not measured. progressDialog.setCancelable(false); progressDialog.show(); }; @Override protected InitializationResult doInBackground(Void... params) { return processController.initializeData(); } @Override protected void onPostExecute(InitializationResult result) { super.onPostExecute(result); progressDialog.dismiss(); if (!result.isValid()) { AlertDialog.Builder dialog = new AlertDialog.Builder(mainActivity); dialog.setTitle("Initialisierungsfehler"); dialog.setMessage(result.getReason()); dialog.setPositiveButton("Ok", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); //TODO cancel application System.exit(0); } }); dialog.show(); } } }

    Read the article

< Previous Page | 144 145 146 147 148 149 150 151 152 153 154 155  | Next Page >