Search Results

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

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

  • Syntax Error? When parsing XML value

    - by Ace Munim
    I don't know if I'm having a syntax error but the compiler is giving me TypeError: 'undefined' is not an object (evaluating 'xmlDoc.getElementsByTagName("icon")[i].childNodes') Its me giving me this problem when im parsing the XML from my server, my actual javascript code is like this var xmlDoc = Obj.responseXML; var count = 0; if(xmlDoc){ while(count <= xmlDoc.getElementsByTagName("item").length){ document.getElementById("flow").innerHTML += "<div class='item'><img class='content' src='" + xmlDoc.getElementsByTagName("icon")[i].childNodes[0].nodeValue.replace(/\s+$/g,' ') +"' /></div>"; count++; } }else{ alert("Unable to parse!"); } and my XML goes like this. <feed> <item> <title>Given Title</title> <icon> http://i178.photobucket.com/albums/w255/ace003_album/Logo-ETC-RGB-e1353503652739.jpg </icon> </item> <item>...</item> <item>...</item> <item>...</item> <item>...</item> <item>...</item> <item>...</item> </feed> i just want to parse the image link and to show it.

    Read the article

  • XML Serialization and Deserialization in C#

    - by SOF User
    <job id="ID00004" name="PeakValCalcO"> <uses file="Seismogram_FFI_0_1_ID00003.grm" link="input" /> <uses file="PeakVals_FFI_0_1_ID00003.bsa" link="output" /> </job> <job id="ID00005" name="SeismogramSynthesis" > <uses file="FFI_0_1_txt.variation-s07930-h00000" link="input" /> <uses file="Seismogram_FFI_0_1_ID00005.grm" link="output" /> </job> Let say I have this XML I want to convert into .net Object how can do this i tried it but it doesn't work correct... public class jobs : List<job> { } public class job { public string id { get; set; } public string name { get; set; } public List<uses> Files { get; set; } } public class uses { public string file { get; set; } public string link { get; set; } } private void Form1_Load(object sender, EventArgs e) { XmlSerializer serializer = new XmlSerializer(typeof(jobs)); TextReader tr = new StreamReader("CyberShake_100.xml"); job b = (job)serializer.Deserialize(tr); tr.Close(); }

    Read the article

  • Android Notification with AlarmManager, Broadcast and Service

    - by user2435829
    this is my code for menage a single notification: myActivity.java public class myActivity extends Activity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.mylayout); cal = Calendar.getInstance(); // it is set to 10.30 cal.set(Calendar.HOUR, 10); cal.set(Calendar.MINUTE, 30); cal.set(Calendar.SECOND, 0); long start = cal.getTimeInMillis(); if(cal.before(Calendar.getInstance())) { start += AlarmManager.INTERVAL_FIFTEEN_MINUTES; } Intent mainIntent = new Intent(this, myReceiver.class); pIntent = PendingIntent.getBroadcast(this, 0, mainIntent, PendingIntent.FLAG_UPDATE_CURRENT); AlarmManager myAlarm = (AlarmManager)getSystemService(ALARM_SERVICE); myAlarm.setRepeating(AlarmManager.RTC_WAKEUP, start, AlarmManager.INTERVAL_FIFTEEN_MINUTES, pIntent); } } myReceiver.java public class myReceiver extends BroadcastReceiver { @Override public void onReceive(Context c, Intent i) { Intent myService1 = new Intent(c, myAlarmService.class); c.startService(myService1); } } myAlarmService.java public class myAlarmService extends Service { @Override public IBinder onBind(Intent arg0) { return null; } @Override public void onCreate() { super.onCreate(); } @SuppressWarnings("deprecation") @Override public void onStart(Intent intent, int startId) { super.onStart(intent, startId); displayNotification(); } @Override public void onDestroy() { super.onDestroy(); } public void displayNotification() { Intent mainIntent = new Intent(this, myActivity.class); PendingIntent pIntent = PendingIntent.getActivity(this, 0, mainIntent, PendingIntent.FLAG_UPDATE_CURRENT); NotificationManager nm = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE); Notification.Builder builder = new Notification.Builder(this); builder.setContentIntent(pIntent) .setAutoCancel(true) .setSmallIcon(R.drawable.ic_noti) .setTicker(getString(R.string.notifmsg)) .setContentTitle(getString(R.string.app_name)) .setContentText(getString(R.string.notifmsg)); nm.notify(0, builder.build()); } } AndroidManifest.xml <uses-permission android:name="android.permission.WAKE_LOCK" /> ... ... ... <service android:name=".myAlarmService" android:enabled="true" /> <receiver android:name=".myReceiver"/> IF the time has NOT past yet everything works perfectly. The notification appears when it must appear. BUT if the time HAS past (let's assume it is 10.31 AM) the notification fires every time... when I close and re-open the app, when I click on the notification... it has a really strange behavior. I can't figure out what's wrong in it. Can you help me please (and explain why, if you find a solution), thanks in advance :)

    Read the article

  • Is this XML file correct for RSS feeding?

    - by Hermet
    Hi guys I am generating a XML-RSS type file from PHP. The output for example is like this <?xml version="1.0" encoding="iso-8859-1"?> <rss version="2.0"> <channel> <title>Mi web mola</title> <link>http://www.dominio.com/blog.php</link> <language>es-ES</language> <description>Mallas y eso</description> <generator>Autor</generator> <item> <title>Articulo de prueba</title> <link>http://www.midominio.com/2342</link> <pubDate>14/06/2010</pubDate> <description><![CDATA[Descripcion de prueba bla bla bla]]></description> <content:encoded><![CDATA[Contenido prueba]]></content:encoded> </item> </channel> </rss> ... and all I can see in the Firefox preview is the title and the description of the blog, not the items, but in the source it appears correctly, so I've thought it must be a parse error or something like that.. What could be wrong? Again, excuse me for my bad english, and thank you very much.

    Read the article

  • remove a duplicate element(with specific value) from xml using linq

    - by Q8Y
    If I have this xml <?xml version="1.0" encoding="utf-8"?> <super> <A value="1234"> <a1 xx="000" yy="dddddd" /> <a1 xx="111" yy="eeeeee" /> <a1 xx="222" yy="ffffff"/> </A> </super> and I need to remove a1 element (that have xx=222) completely. why this won't happen using my code?? i realized that it will delete it only if it was placed the first element(i.e, if i want to delete a1 that have x=000 , it will delete it since its the first one), why is that?? what wrong with the code ?? var employee = from emp in element.Elements("A") where (string)emp.Element("a1").Attribute("xx") == "222" select emp.Element("a1"); foreach (var empployee_1 in employee) { empployee_1.Remove(); } element.Save(@"TheLocation"); thanks alot

    Read the article

  • Does the Quick Search Box search the database in Android? how?

    - by Praveen Chandrasekaran
    i have an database with the values of latitude and longitude. i would need to search those values depends on the user input. does the quick search box can search only the database value with the type-to-search feature. Else i want to put a separate EditText and then do the the search process.. if QSB is possible then how to do that? i want to search and drop a pin on the map.. please make a note of it. Any Idea, tutorial and sample codes are most thankful?

    Read the article

  • linq to xml enumerating over descendants

    - by gh9
    Hi trying to write a simple linq query from a tutorial I read. But i cannot seem to get it to work. I am trying to display both the address in the attached xml document, but can only display the first one. Can someone help me figure out why both aren't being printed. Thank you very much <?xml version="1.0" encoding="utf-8" ?> <Emails> <Email group="FooBar"> <Subject>Test subject</Subject> <Content>Test Content</Content> <EmailTo> <Address>[email protected]</Address> <Address>[email protected]</Address> </EmailTo> </Email> </Emails> Dim steve = (From email In emailList.Descendants("Email") _ Where (email.Attribute("group").Value.Equals("FooBar")) _ Select content = email.Element("EmailTo").Descendants("Address")).ToList() If Not steve Is Nothing Then For Each addr In steve Console.WriteLine(addr.Value) Next Console.ReadLine() End If

    Read the article

  • C# xml read, show error

    - by gloris
    Whats wrong with my code? XmlTextReader textReader = new XmlTextReader(@"D:\xml_file.xml"); textReader.Read(); // If the node has value while (textReader.Read()) { // Move to fist element textReader.MoveToElement(); Console.WriteLine("XmlTextReader Properties Test"); Console.WriteLine("==================="); // Read this element's properties and display them on console Console.WriteLine("id:" + textReader.id.ToString()); Console.WriteLine("name:" + textReader.name.ToString()); Console.WriteLine("time:" + textReader.time.ToString()); } Console.ReadLine() show erron on: id, name, time My XML file: <students> <student> <id>1</id> <name>Rikko Nora</name> <time>2010-03-12</time> </student> <student> <id>2</id> <name>Rikko Nora2</name> <time>2010-05-15</time> </student> </students>

    Read the article

  • Uploading an xml direct to ftp

    - by Joshua Maerten
    i put this direct below a button: XmlDocument doc = new XmlDocument(); XmlElement root = doc.CreateElement("Login"); XmlElement id = doc.CreateElement("id"); id.SetAttribute("userName", usernameTxb.Text); id.SetAttribute("passWord", passwordTxb.Text); XmlElement name = doc.CreateElement("Name"); name.InnerText = nameTxb.Text; XmlElement age = doc.CreateElement("Age"); age.InnerText = ageTxb.Text; XmlElement Country = doc.CreateElement("Country"); Country.InnerText = countryTxb.Text; id.AppendChild(name); id.AppendChild(age); id.AppendChild(Country); root.AppendChild(id); doc.AppendChild(root); // Get the object used to communicate with the server. FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://users.skynet.be"); request.Method = WebRequestMethods.Ftp.UploadFile; request.UsePassive = false; // This example assumes the FTP site uses anonymous logon. request.Credentials = new NetworkCredential("fa490002", "password"); // Copy the contents of the file to the request stream. StreamReader sourceStream = new StreamReader(); byte[] fileContents = Encoding.UTF8.GetBytes(sourceStream.ReadToEnd()); sourceStream.Close(); request.ContentLength = fileContents.Length; Stream requestStream = request.GetRequestStream(); requestStream.Write(fileContents, 0, fileContents.Length); requestStream.Close(); FtpWebResponse response = (FtpWebResponse)request.GetResponse(); response.Close(); MessageBox.Show("Created SuccesFully!"); this.Close(); but i always get an error of the streamreader path, what do i need to place there ? the meening is, creating an account and when i press the button, an xml file is saved to, ftp://users.skynet.be/testxml/ the filename is from usernameTxb.Text + ".xml".

    Read the article

  • how do i keep the aspect ratio on image buttons in android?

    - by clayton33
    i have 5 square ImageButtons that i want to have lined up side by side on the bottom of the screen. I have each one set (different id's) as: <ImageButton android:id="@+id/box1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:adjustViewBounds="true" android:scaleType="fitXY" android:layout_weight="1" android:layout_margin="1dp" /> and i have the background assigned in main java like this: int[] imageIds = new int[] {R.id.box1,R.id.box2,R.id.box3,R.id.box4,R.id.box5}; for(int i = 0; i<5; i++){ imageButtons[i] = (ImageButton) findViewById(imageIds[i]); imageButtons[i].setBackgroundResource(R.drawable.blank); } what i would like to have it do is scale the width to fit neatly side-by-side at the bottom of the screen (which it does now ok), but have the height automatically scale to match the width as well. is this possible? i don't want to use setImageSource because then it puts a border around the imagebutton.

    Read the article

  • How to search within an xml data set?

    - by user187580
    Hi, I have some xml data and I am trying to keyword search data. For example, if I search "some" for the following data it returns me the <id> and <title>. <resource> <id>101</id> <title>Test Environment</title> <description><b>Some</b> description. </description> <type>classroom</type> </resource> <resource> <id>102</id> <title>ABC Test Environment</title> <description><b>Some</b> another description. </description> <type>classroom</type> </resource> ... I had a look on on xpath e.g. $xml->xpath('//title') but looks for elements only. Basically what I need to do is to create a functionality where users can keyword search within the above data set which I receive from third party api in the above format. Any ideas how I can achieve this? using PHP/ Javascript etc. Thanks.

    Read the article

  • why does .apk is not getting installed in android emulator ?

    - by Saravana
    I tried the following code with android 2.3.3 (AVD). When i run this code it waits saying Waiting for HOME ('android.process.acore') to be launched... but keeps on waiting. So i tried running second time .. this time it says [2011-03-04 12:28:39 - DialANumber] Uploading DialANumber.apk onto device 'emulator-5554' [2011-03-04 12:28:39 - DialANumber] Installing DialANumber.apk... [2011-03-04 12:29:14 - DialANumber] HOME is up on device 'emulator-5554' [2011-03-04 12:29:14 - DialANumber] Uploading DialANumber.apk onto device 'emulator-5554' [2011-03-04 12:29:14 - DialANumber] Installing DialANumber.apk... and after some time fails with [2011-03-04 12:31:37 - DialANumber] Failed to install DialANumber.apk on device 'emulator-5554! [2011-03-04 12:31:37 - DialANumber] (null) [2011-03-04 12:31:39 - DialANumber] Launch canceled! the code follows: package com.DialANumber; import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.view.KeyEvent; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.LinearLayout; public class DialANumber extends Activity { EditText mEditText_number = null; LinearLayout mLinearLayout_no_button = null; Button mButton_dial = null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mLinearLayout_no_button = new LinearLayout(this); mEditText_number = new EditText(this); mEditText_number.setText("5551222"); mLinearLayout_no_button.addView(mEditText_number); mButton_dial = new Button(this); mButton_dial.setText("Dial!"); mLinearLayout_no_button.addView(mButton_dial); mButton_dial.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { performDial(); } }); setContentView(mLinearLayout_no_button); } public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_CALL) { performDial(); return true; } return false; } public void performDial(){ if(mEditText_number!=null){ try { startActivity(new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + mEditText_number.getText()))); } catch (Exception e) { e.printStackTrace(); } }//if } } I am just starting to learn developing android apps. please help me out.. Thanks.

    Read the article

  • Can we use preferences accress multiple different acvtivities in android?

    - by Maneesh
    I save preferences in one activities but not able to get saved preferences in other activity. I can access saved preferences in the same activity but not in other one. It is not giving me any error but always gibing null values in second activity. Below is the code: First Activity: SharedPreferences.Editor editor; editor.putString("token", access_token); editor.commit(); Second Activity: SharedPreferences prefs = getSharedPreferences(PREFS_NAME, 0);//getPreferences(0); String restoredtoken = prefs.getString("token", null); if (restoredtoken== null) { ///doing some task; }

    Read the article

  • XML with iPhone app !

    - by totato
    hi .. I just work on web-based application for iPhone, And I try to retrieve data from my website to my app. can I edit XML code for my website as I want to be in my iPhone app? for example, XML for my website is: <item> <title>Announcement title</title> <link>iphone feed</link> <description>Announcement type</description> <category>Students</category> <pubDate>April 5, 2010, 12:50 pm</pubDate> <guid>iphone feed</guid> </item> but I can't retrieve all of this to the tableview in my app. So, I will edit the code to be like this: <item> <category name="staff"> <Announcement title="welcome back"> <description> hope all of you enjoy in the vacation, and welcome back to university </description> </Announcement> </category> </item> Is this the right way?

    Read the article

  • parse a special xml in python

    - by zhaojing
    I have s special xml file like below: <alarm-dictionary source="DDD" type="ProxyComponent"> <alarm code="402" severity="Alarm" name="DDM_Alarm_402"> <message>Database memory usage low threshold crossed</message> <description>dnKinds = database type = quality_of_service perceived_severity = minor probable_cause = thresholdCrossed additional_text = Database memory usage low threshold crossed </description> </alarm> ... </alarm-dictionary> I know in python, I can get the "alarm code", "severity" in tag alarm by: for alarm_tag in dom.getElementsByTagName('alarm'): if alarm_tag.hasAttribute('code'): alarmcode = str(alarm_tag.getAttribute('code')) And I can get the text in tag message like below: for messages_tag in dom.getElementsByTagName('message'): messages = "" for message_tag in messages_tag.childNodes: if message_tag.nodeType in (message_tag.TEXT_NODE, message_tag.CDATA_SECTION_NODE): messages += message_tag.data But I also want to get the value like dnkind(database), type(quality_of_service), perceived_severity(thresholdCrossed) and probable_cause(Database memory usage low threshold crossed ) in tag description. That is, I also want to parse the content in the tag in xml. Could anyone help me with this? Thanks a lot!

    Read the article

  • Populate on demand a TreeView with datas in an XML

    - by m6a-uds
    Hi I have a large XML file (3000+ nodes) that I want to represent in a TreeView on ASP.NET. I cannot databind it to a XMLDataSource because loading the TreeView will then be way too slow (I never even waited long enough to see it finish...) So the solution for this would be to use the PopulateOnDemand property of the TreeNodes to load data only when needed. Problem is, I can't think of a way to acheive this... How can-I, based on the ID of a node, search a XMLDocument to get all the childnodes of the node having this ID? XML would look like that: <document ID=1> <document ID=2> <document ID=3> </document> </document> <document ID=4> </document> </document> There are nor rules on how much levels it can go down or anything...

    Read the article

  • Custom Android layout that handles its children

    - by Gromix
    Hi, I'm trying to create a custom Android control to emulate a LinearLayout with a fancier display. Basically, I want the exact behaviour of a LinearLayout, but also borders, a background, ... I could do it all in XML (works great) but since I have dozens of occurences in my app it's getting hard to maintain. I thought it would be nicer to have something like this: /* Main.xml */ <MyFancyLayout> <TextView /> <ImageView /> </MyfancyLayout> My problem is, I don't want to have to re-write LinearLayout, so is there a way to only change its appearance? I got as far as this, which doesn't work... can anyone think of a better approach? /* MyFancyLayout.xml */ <merge> ... the complex hierarchy to make it look like what I want ... with background attributes etc </merge> and /* MyFancyLayout.java */ public class MyFancyLayout extends LinearLayout { // inflate the XML // move all the real children (as given by main.xml) to the inflated layout // do I still need to override onMeasure and onLayout? } Cheers! Romain

    Read the article

  • How to run an async task afor every x mins in android?

    - by Shan
    how to run the async task at specific time? (I want to run it every 2 mins) I tried using post delayed but it's not working? tvData.postDelayed(new Runnable(){ @Override public void run() { readWebpage(); }}, 100); In the above code readwebpage is function which calls the async task for me.. Right now below is the method which I am using public void onCreate(Bundle savedInstanceState) { readwebapage(); } public void readWebpage() { DownloadWebPageTask task = new DownloadWebPageTask(); task.execute("http://www.google.com"); } private class DownloadWebPageTask extends AsyncTask<String, Void, String> { @Override protected String doInBackground(String... urls) { String response1 = ""; response1=read(); //read is my another function which does the real work response1=read(); super.onPostExecute(response1); return response1; } protected void onPostExecute(String result) { try { Thread.sleep(100); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } TextView tvData = (TextView) findViewById(R.id.TextView01); tvData.setText(result); DownloadWebPageTask task = new DownloadWebPageTask(); task.execute(new String[] { "http://www.google.com" }); } } This is what I my code is and it works perfectly fine but the big problem I drains my battery?

    Read the article

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