Search Results

Search found 13112 results on 525 pages for 'exception duck'.

Page 80/525 | < Previous Page | 76 77 78 79 80 81 82 83 84 85 86 87  | Next Page >

  • ListView exception for Images + Text

    - by drozzy
    I am trying to create a simple Icon+Text ListView but it does not work. I am using 2.1 Android SDK. My main class is very small slightly modified from the tutorial: public class Stuffs extends ListActivity { static final String[] COUNTRIES = new String[] {"A", "B","C"}; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, R.id.title, COUNTRIES)); } } and my list_item.xml file is this: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation = "horizontal"> <ImageView android:id = "@+id/icon" android:src="@drawable/icon" /> <TextView android:id = "@+id/title" android:padding="10dp" android:textSize="16sp" > </TextView> </LinearLayout> I have also created a "drawable" directory in my res directory and copied a "icon.png" into it. But any time I try to run this the application hangs up unexpected in my android emulator. Am I missing something?

    Read the article

  • An Exception occur in Tablayout.

    - by Kooper
    I wanna add three layout in a TabActivity, but it was force closed when I ran it. Here is the code: import android.app.TabActivity; import android.content.res.Resources; import android.os.Bundle; import android.widget.TabHost; public class Test1 extends TabActivity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Resources res = getResources(); TabHost tabHost = getTabHost(); tabHost.addTab(tabHost.newTabSpec("egcquery").setIndicator("EGCQuery").setContent(R.layout.main1)); tabHost.addTab(tabHost.newTabSpec("PatientInfo").setIndicator("PatientInfo").setContent(R.layout.main2)); tabHost.addTab(tabHost.newTabSpec("Comp_Interp").setIndicator("Comp_Interp").setContent(R.layout.main3)); } }

    Read the article

  • Likelihood of IOError during print vs. write

    - by jkasnicki
    I recently encountered an IOError writing to a file on NFS. There wasn't a disk space or permission issue, so I assume this was just a network hiccup. The obvious solution is to wrap the write in a try-except, but I was curious whether the implementation of print and write in Python make either of the following more or less likely to raise IOError: f_print = open('print.txt', 'w') print >>f_print, 'test_print' f_print.close() vs. f_write = open('write.txt', 'w') f_write.write('test_write\n') f_write.close() (If it matters, specifically in Python 2.4 on Linux).

    Read the article

  • Null pointer exception on .iterator() call

    - by Peter
    I'm getting a strange NullPointerException, evidently thrown by the following line of code: Iterator<Note> it = notes.iterator(); I've checked, and at the time the java.util.TreeSet notes is always non-null (with 15 elements). The TreeSet API says nothing about iterator() throwing NullPointerExceptions. What else could be going here?

    Read the article

  • following code comipling perfectly but showing runtime error . why?

    - by user323422
    //sample.h int calci(int &value) { if(value < 20) throw value; else return value; } class XYX { int m_x; public: XYZ(int &x)try:m_x(a-calci(x)) { }catch (int &a) {} }; class ABC { int m_a; public: ABC():m_a(0) { } void foo() { XYZ xyz(10); } }; int main() { ABC abc; abc.foo(); } //if i replace foo() with following code then it works well void foo() { try{ XYZ xyz(10); }catch(...){} }

    Read the article

  • How can a client gracefully detect when a server disconnects?

    - by Ummar
    I am working on a client-server application. The client continuously reads data from server, so when a server is closed or disconnects then the client crashes. I tried a try/catch block, but it didn't work. My client application is written in C++. I want the client to display some proper message like "Server disconnected," then exit.

    Read the article

  • What happens on a JMS queue when onMessage() throws a JMSException?

    - by user311121
    Hi, I'm using Spring 2.5 with my custom class that implements MessageListener. If a JmsException is thrown in my onMessage( ) method, what happens to the state of the queue? Is the message considered "delivered" by the queue the moment onMessage is called? Or does the JmsException trigger some kind of rollback and the message is re-entered on the queue? Thanks in advance!

    Read the article

  • [grails + xfire] How to handle errors in SOAP services?

    - by Mulone
    Hi all, I'm implementing a web service on the xfire plugin. I was wondering how I'm supposed to handle the errors. I tried with this setup but the error is not returned to the SOAP client: GaSession[] myMethod( String userId ) throws MyException{ GaUser user = GaUser.findByUserId( userId ) if (!user) throw new MyException("user ${userId} does not exist") // do stuff and return valid results } Is there a standard way to handle errors and return them to the client in a clear way? My log is full of messages like: 2010-06-13 18:20:40,926 [Thread-289] DEBUG aegis.XMLClassMetaInfoManager - Mapping file : /com/mycompany/MyClass.aegis.xml not found. Is there a way to fix this? Cheers!

    Read the article

  • MySQL transaction conundrum

    - by David Faitelson
    I need to perform several inserts in a single atomic transaction. For example: start transaction; insert ... insert ... commit; However when MySQL encounters an error it aborts only the particular statement that caused the error. For example, if there is an error in the second insert statement the commit will still take place and the first insert statement will be recorded. Thus, when errors occur a MySQL transaction is not really a transaction. To overcome this problem I have used an error exit handler where I rollback the transaction. Now the transaction is silently aborted but I don't know what was the problem. So here is the conundrum for you: How can I both make MySQL abort a transaction when it encounters an error, and pass the error code on to the caller?

    Read the article

  • Error : The Type Initializer of Daemon.Global threw an exception in c#

    - by srk
    I am using the below class file, where some variables are declared to use in the entire application. Now I used that variable BlockLogOut in another class file to make the value true. I just put this below line and getting error in it.. TypeInitializationException Global.BlockLogOut = True; The weird thing is, it was working fine for many months and i am getting this error now on the above line. Of course i was modifying some other stuffs in the application, but surely not this class file. What would have been the problem? namespace Daemon { class Global { public static bool BlockLogOut = false; } }

    Read the article

  • Cast exception being generated when using the same type of object

    - by David Tunnell
    I was previously using static variables to hold variable data that I want to save between postbacks. I was having problems and found that the data in these variables is lost when the appdomain ends. So I did some research and decided to go with ViewStates: static Dictionary<string, linkButtonObject> linkButtonDictonary; protected void Page_Load(object sender, EventArgs e) { if (ViewState["linkButtonDictonary"] != null) { linkButtonDictonary = (Dictionary<string, linkButtonObject>)ViewState["linkButtonDictonary"]; } else { linkButtonDictonary = new Dictionary<string, linkButtonObject>(); } } And here is the very simple class I use: [Serializable] public class linkButtonObject { public string storyNumber { get; set; } public string TaskName { get; set; } } I am adding to linkButtonDictionary as a gridview is databound: protected void hoursReportGridView_OnRowDataBound(Object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { LinkButton btn = (LinkButton)e.Row.FindControl("taskLinkButton"); linkButtonObject currentRow = new linkButtonObject(); currentRow.storyNumber = e.Row.Cells[3].Text; currentRow.TaskName = e.Row.Cells[5].Text; linkButtonDictonary.Add(btn.UniqueID, currentRow); } } It appears that my previous issues are resolved however a new one has arisin. Sometime when I postback I am getting this error: [A]System.Collections.Generic.Dictionary2[System.String,linkButtonObject] cannot be cast to [B]System.Collections.Generic.Dictionary2[System.String,linkButtonObject]. Type A originates from 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' in the context 'LoadNeither' at location 'C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Type B originates from 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' in the context 'LoadNeither' at location 'C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. I don't understand how there can be a casting issue when I am using the same class everywhere. What am I doing wrong and how do I fix it?

    Read the article

  • What's the best practice in case something goes wrong in Perl code?

    - by Geo
    I saw code which works like this: do_something($param) || warn "something went wrong\n"; and I also saw code like this: eval { do_something_else($param); }; if($@) { warn "something went wrong\n"; } Should I use eval/die in all my subroutines? Should I write all my code based on stuff returned from subroutines? Isn't eval'ing the code ( over and over ) gonna slow me down?

    Read the article

  • SQL Exception error??

    - by Kyle Sevenoaks
    I just came into work and found this where our site should be: SQLException ERROR: connect failed [Native Error: Host 'linux7.fastname.no' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'] [User Info: Array] What does it mean? www.euroworker.no

    Read the article

  • malformed url exception

    - by Bunny Rabbit
    https://twitter.com/sessions?authenticity_token=b1b43178e09c1e6ccec1b3183f1f139f39643aaf&session%5Busername_or_email%5D=ddddd&session%5Bpassword%5D=rrrrr&q=&site_action=https%3A%2F%2Ftwitter.com%2Fsessions&serialized_string=Hello why is this url throwing a java.net.MalformedURLException??

    Read the article

  • About NullPointer Exception in Arraylist

    - by user2234456
    List<PrcSubList> listSl = new ArrayList<PrcSubList>(); if (listSl == null || listSl.size() == 0) { PrcSubList subListAdd=coreService.addSubListByAddAlert(childSub); System.out.println("sublist after insert db :" + subListAdd.getName()); listSl.add(subListAdd); System.out.println(listSl.size() +" sublist after insert list:" + listSl.get(0).getName()); } Ouput with first System.out.println("sublist after insert db :" + subListAdd.getName()); sublist after insert db :SYSTEM_ALERT_12312313 Problem But i have NullPointerException with 2nd System.out.println(listSl.size() +" sublist after insert list:" + listSl.get(0).getName()); Can you help me!

    Read the article

  • jUnit same exception in different cases

    - by coubeatczech
    Hi, I'm writing a jUnit test for a constructor that parses a String and then check numerous things. When there's wrong data, for every thing, some IllegalArgumentException with different message is thrown. So I would like to write tests for it, but how can i recognize what error was thrown? This is how can I do it: @Test(expected=IllegalArgumentException.class) public void testRodneCisloRok(){ new RodneCislo("891415",dopocitej("891415")); } and this is how I would like to be, but I don't know if it is possible to write it somehow: @Test(expected=IllegalArgumentException.class("error1")) public void testRodneCisloRok(){ new RodneCislo("891415",dopocitej("891415")); }

    Read the article

  • Python raises a KeyError (for an out of dictionary key) even though the key IS in the dictionary

    - by ignorantslut
    I'm getting a KeyError for an out of dictionary key, even though I know the key IS in fact in the dictionary. Any ideas as to what might be causing this? print G.keys() returns the following: ['24', '25', '20', '21', '22', '23', '1', '3', '2', '5', '4', '7', '6', '9', '8', '11', '10', '13', '12', '15', '14', '17', '16', '19', '18'] but when I try to access a value in the dictionary on the next line of code... for w in G[v]: #note that in this example, v = 17 I get the following error message: KeyError: 17 Any help, tips, or advice are all appreciated. Thanks.

    Read the article

  • Which of the two exceptions was called?

    - by Rob
    If I have a routine that can throw an ArgumentException in two places, something like... if (Var1 == null) { throw new ArgumentException ("Var1 is null, this cannot be!"); } if (Val2 == null) { throw new ArgumentException ("Var2 is null, this cannot be either!"); } What’s the best way of determining in my calling procedure which of the two exceptions was thrown? Or Am I doing this in the wrong fashion?

    Read the article

< Previous Page | 76 77 78 79 80 81 82 83 84 85 86 87  | Next Page >