Search Results

Search found 4819 results on 193 pages for 'brian lang'.

Page 7/193 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • What to do of exceptions when implementing java.lang.Iterator

    - by Vincent Robert
    The java.lang.Iterator interface has 3 methods: hasNext, next and remove. In order to implement a read-only iterator, you have to provide an implementation for 2 of those: hasNext and next. My problem is that these methods does not declare any exceptions. So if my code inside the iteration process declares exceptions, I must enclose my iteration code inside a try/catch block. My current policy has been to rethrow the exception enclosed in a RuntimeException. But this has issues because the checked exceptions are lost and the client code no longer can catch those exceptions explicitly. How can I work around this limitation in the Iterator class? Here is a sample code for clarity: class MyIterator implements Iterator { @Override public boolean hasNext() { try { return implementation.testForNext(); } catch ( SomethingBadException e ) { throw new RuntimeException(e); } } @Override public boolean next() { try { return implementation.getNext(); } catch ( SomethingBadException e ) { throw new RuntimeException(e); } } ... }

    Read the article

  • "java.lang.ArrayIndexOutOfBoundsException" with System.arraycopy()

    - by Noona
    These few lines of code are giving me a "java.lang.ArrayIndexOutOfBoundsException" exception, could someone please take a look and point out why (the exception is caused in the second arraycopy() call): byte [] newContentBytes = EntityUtils.toByteArray((serverResponse.getEntity())); newContent = new String(newContentBytes); System.out.println( newContent); byte [] headerBytes = headers.getBytes(); byte[] res = new byte[newContentBytes.length + headerBytes.length]; //headerBytes. System.arraycopy(headerBytes, 0, res, 0, headerBytes.length); System.out.println( "length: " + newContentBytes.length); System.arraycopy(newContentBytes, 0, res, newContentBytes.length , newContentBytes.length); The problem is in allocating res size, for example if I write new byte[newContentBytes.length + headerBytes.length+ 2000] instead the exception doesn't occur, so what should the accurate size be?

    Read the article

  • starting subactivity for the second time causes java.lang.OutOfMemoryError

    - by Zacherl
    Hi there, I am developing a simple app which does a little bit of image-processing. It's divided in two activities; the main one with some display elements and the second one which is used to capture images off the phone's camera. To discribe my problem: I start the app, capture an image (by starting a new Intent with the subactivity) and all data is displayed correctly. If I capture another image after this, I run in an java.lang.OutOfMemoryError - bitmap size exceeds VM budget I dont store the captured bitmap, in the second activity I just extract some data from it and pass it to the main-activity; finishing (finish()) the sub-activity afterwards. I really dont know what I can do about it. Thanks in advance! greetings, Zacherl PS: It is my first approach to android, so I apologize for any stupid beginner error I did; if someone needs any further information, I would be happy to provide it.

    Read the article

  • java.lang.UnsatisfiedLinkError, mach-o but wrong architecture on Mac10.6.2

    - by Yinan
    I was trying to run a project in my local machine. I tried to load this jnilib file which I got from a running instance of this project on my Mac 10.6.2, System.load(lib.getAbsolutePath()); then I got this exception thrown: java.lang.UnsatisfiedLinkError, mach-o but wrong architecture I have check the jnilib with file command: libScreenMatchProxy.jnilib: Mach-O dynamically linked shared library i386 I guess this is because the jnilib file is compiled in 32bit but the Java comes with Mac10.6 is 64bit. So I go to Java Preference and set Java to use 32bit first. But it didn't work. As mentioned above, this jnilib file is copied from a running instance of the project on my Mac, so it should work. I don't understand why it working in the installed application but not in my Eclipse.

    Read the article

  • java.lang.NoClassDefFoundError: com/google/appengine/tools/enhancer/Enhance

    - by user1204337
    I am new to GAE, I follow the instructions on http://code.google.com/eclipse/docs/install-eclipse-3.7.html. I got the installation and registration done pretty fast. But when I tried to build the helloWorld project in Eclipse, before I can do anything, Eclipse gives me an error says "java.lang.NoClassDefFoundError: com/google/appengine/tools/enhancer/Enhance" and it is very weird. Because when you expand the app engine sdk, you can easily find the Enhance class under related jar file. I also tried Enhance e = null; and it is working. It seems that my eclipse just cannot find it. I don't know why it is not working, I am using JDK1.6, I reinstall my eclipse and the google plugins, I even disabled my firewall. Please help!!!

    Read the article

  • Exception in thread "main" java.lang.NoClassDefFoundError

    - by Manu
    package pack; public class sample{ public static void main(String input[]) { NumberFormat numberFormat = new DecimalFormat("#,##0.00##"); System.out.println(numberFormat.format(44533125.00)); } } the code is working fine in the current dir.. (c:/myprogram/). after that i copy the sample.class file and paste it in other dir(d:/myprogram). i got error while running, like " Exception in thread "main" java.lang.NoClassDefFoundError: sample (wrong name: pack/sample)" In java .class file can run anywhere right? but why i am not able to run?

    Read the article

  • Blackberry Development, java.lang.outofmemoryerror

    - by Nikesh Yadav
    Hi Forum, I am new to Blackberry development (I am using Eclipse with Blackberry plug-in), I am trying to read a text file, which I placed in the "src" folder of my Blackberry project and this text file just contain a word "Test". when I run the program, I gets "UncaughtException: java.lang.outofmemoryerror". Here is the code I am using, where "speech.txt" is the file I am trying to read and is placed in the "src" folder - public class SpeechMain extends MainScreen { public SpeechMain() { try { Class myClass = this.getClass(); InputStream is = null; is = myClass.getResourceAsStream("speech.txt"); InputStreamReader isr = new InputStreamReader(is); char c; while ((c = (char)isr.read()) != -1) { add(new LabelField("" + c)); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); add(new LabelField(e.getMessage())); } } } Thanks in advance. Thanks, Nikesh

    Read the article

  • java.lang.UnsupportedClassVersionError in eclipse

    - by Derek
    Hi all, I am not a Java programmer really, so I am posting this question. The exception is being thrown java.lang.UnsupportedClassVersionError in my main class in an eclipse project. If I comment out the imports that this class has, it compiles and runs fine. If I put the imports back in, it does not work. Does this mean that the libraries I am importing were compiled with a newer or older version of java than I have? when i do java -version on the system i get 1.5_07 I could've sworn this was actually working last week, but maybe some setting in eclipse got tweaked? Is the Java Build Path in eclipse what I need to look for to check the JRE and compiler versions?

    Read the article

  • Why hovering in this menu is not working in IE?

    - by janoChen
    When a anchor is hovered in this menu it should turn its background white. It works in Firefox and Chrome but in IE the words just disappear and the background doesn't turn white. CSS: #lang { float: right; padding: 0 0 0 0; margin: 50px 25px 0 0; width: 285px; } #lang li { font-size: 10px; float: right; } #lang li a#english, #spanish, #chinese { color: #FFF; float: right; padding-right: 20px; padding-top: 2px; padding-bottom: 2px; width: 200px; /* ie fix */ } #lang li a#english { padding-left: 231px; } #lang li a#spanish { padding-left: 228px; } #lang li a#chinese { padding-left: 219px; } #lang li a:hover { background: #FFF; color: #444; } #lang li.current a { background: #FFF !important; color: #444 !important; cursor: default; } HTML: <ul id="lang"> <li <?php if($lang_file=='lang.en.php') {echo 'class="current"';} ?>><a id="english" href="index.php?lang=en">english</a></li> <li <?php if($lang_file=='lang.es.php') {echo 'class="current"';} ?>><a id="spanish" href="index.php?lang=es">español</a></li> <li <?php if($lang_file=='lang.zh-tw.php') {echo 'class="current"';} ?>><a id="chinese" href="index.php?lang=zh-tw">??(??)</a></li> <li <?php if($lang_file=='lang.zh-cn.php') {echo 'class="current"';} ?>><a id="chinese" href="index.php?lang=zh-cn">??(??)</a></li> </ul>

    Read the article

  • java.lang.reflect.InvocationTargetException in Java

    - by manoj
    if(locs!=null) { System.out.println("location are not null"); Iterator ite = locs.iterator(); DefaultComboItem locObj = null; ArrayList locCode = null; String cod=null; String name=null; while(ite.hasNext()) { locCode = (ArrayList) ite.next(); Iterator iter = locCode.iterator(); while(iter.hasNext()) { cod=(String)iter.next(); System.out.println("Code="+cod); name=(String)iter.next(); System.out.println("name="+name); locObj = new DefaultComboItem(cod, name); colRet.add(locObj); } } } on executing above code i am getting "java.lang.reflect.InvocationTargetException" Please help me

    Read the article

  • non-static method setPrzechowaj(java.lang.String) cannot be referenced froma a static context

    - by bigbluedragon
    hey i have problem with JDialogForm. I have created it using netbeans 6.8. That JDialogForm have textfield and button below it. and here is some code... private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { String sciezka = jTextField1.getText(); if (sciezka.length() > 0) { Zmienne_pomocnicze.setPrzechowaj(sciezka); } } Now i want to copy that string "sciezka" to my main window but if I do it like this public class Zmienne_pomocnicze { public String n; public void setPrzechowaj (String neew) { n = neew; } public String getPrzechowaj () { return n; } } i get error in jButton1: non-static method setPrzechowaj(java.lang.String) cannot be referenced froma a static context any ideas?

    Read the article

  • the best way to make codeigniter website multi-language. calling from lang arrays depends on lang se

    - by artmania
    Hi friends, I'm researching hours and hours, but I could not find any clear, efficient way to make it :/ I have a codeigniter base website in English and I have to add a Polish language now. What is the best way to make my site in 2 language depending visitor selection? is there any way to create array files for each language and call them in view files depends on Session from lang selection? I don't wanna use database. Appreciate helps! I'm running out of deadline :/ thanks!!

    Read the article

  • java.lang.OutOfMemoryError: unable to create new native thread for multiple threads

    - by Kaustubh Ranjan Singh
    static class solver implements Runnable { static calculator(problem){ //Some code if(condition) {solver s = new solver(newproblem); new Thread(s).start();} } Public solver(int newproblem) { this.problem = newproblem ; } public void run() { // TODO Auto-generated method stub calculator(promblem); } } i am having a big array maze of 100x100 and i am trying to solve it and i am getting an error java.lang.OutOfMemoryError: unable to create new native thread(after running a code for some times). How can solve this , How can i use ExecutorService i think that will solve the problem or i want something like thisIf Number of generated threads4K then stop the first 100 threads

    Read the article

  • java.lang.NoClassDefFoundError when the file is there

    - by tsOverflow
    I've tried to look around for postings that might help me, cant find any. I am deploying an ear to JBoss4 server, and I started having this problem since I added a new project. this new project is defined as Java project in eclipse, and the EAR project has an EJB project that has the new Java project as one of the projects as its dependent upon - if deployed on JBoss locally through eclipse, there's no problem and everything goes smoothly But when being deployed to JBoss in test environment (outside eclipse), kept getting java.lang.NoClassDefFoundError on one of the classes that are defined in the new Java project. I looked inside the EAR file to get to the jar (EJB project), and then inside the jar, I can see the directory structure and all the class files from the new Java project - ie. The class that it complains about is right there inside the EAR-JAR and matching the exact structure that it's looking for. I am at lost to what else I can look at. Any pointers are greatly appreciated! Thanks

    Read the article

  • java.lang.ClassCastException: org.apache.xerces.jaxp.DocumentBuilderFactoryImpl while starting the w

    - by venkat
    Hi, As part of our application we are using apache's xerces jaxp parser. When we deploy the application on weblogic9.2, we are getting the following error. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.cxf.wsdl.WSDLManager' defined in class path resource [META-INF/cxf/cxf.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.apache.cxf.wsdl11.WSDLManagerImpl]: Constructor threw exception; nested exception is java.lang.ClassCastException: org.apache.xerces.jaxp.DocumentBuilderFactoryImpl As per our analysis, i)The weblogic is trying to to load its own DocumentBuilderFactoryImpl which is present in weblogic.jar instead of apache's xerces. We tried the following to force the weblogic to load DocumentBuilderFactoryImpl from xerces i)we have added the following tag into weblogic.xml true ii)we have put latest versions of xalan in jre/lib/endorced folder. this didnt resolve our problem. ii) we have added entries in weblogic-application.xml webapp.encoding.default UTF-8 javax.jws. org.apache.xerces. org.apache.xerces.jaxp.* ii)Added the following entry in weblogic-application.xml <parser-factory> <saxparser-factory>org.apache.xerces.jaxp.SAXParserFactoryImpl</saxparser-factory> <document-builder-factory>org.apache.xerces.jaxp.DocumentBuilderFactoryImpl </document-builder-factory> org.apache.xalan.processor.TransformerFactoryImpl iii)Added jaxp.properties to load DocumentBuilderFactoryImpl from xerces to the jre/lib and started the server.In this case, the weblogic didnt start. iv)Then we started the server first and then copied the jaxp.properties file during the run time when server starts.But no success None of the above worked for us. Any help is highly appreciated. Thanks in advance, Venkat.

    Read the article

  • java.lang.VerifyError on method that worked a minute ago

    - by Travis
    Apologies in advance but I have never seen this error before and don't know what to include. I am using NetBeans and suddenly began getting this error: Exception in thread "AWT-EventQueue-0" java.lang.VerifyError: (class: market/CostOperations, method: <init> signature: ()V) Constructor must call super() or this() at Bluebuild.Main.refreshTables(Main.java:748) at Bluebuild.Main.formComponentShown(Main.java:649) at Bluebuild.Main.access$100(Main.java:28) at Bluebuild.Main$2.componentShown(Main.java:374) at java.awt.Component.processComponentEvent(Component.java:6095) at java.awt.Component.processEvent(Component.java:6043) at java.awt.Container.processEvent(Container.java:2041) at java.awt.Window.processEvent(Window.java:1836) at java.awt.Component.dispatchEventImpl(Component.java:4630) at java.awt.Container.dispatchEventImpl(Container.java:2099) at java.awt.Window.dispatchEventImpl(Window.java:2478) at java.awt.Component.dispatchEvent(Component.java:4460) at java.awt.EventQueue.dispatchEvent(EventQueue.java:599) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161) at java.awt.EventDispatchThread.run(EventDispatchThread.java:122) I have not a clue what happened. I didn't even modify market/CostOperations. Here's the constructor though: public CostOperations() throws ParserConfigurationException, SAXException, IOException { //Open the xml file DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); f = new File(dbName); doc = builder.parse(f); System.out.println(f.canWrite()); //Create the XPath XPathFactory xpfactory = XPathFactory.newInstance(); path = xpfactory.newXPath(); } In Debug Mode I get this: debug: Have no FileObject for C:\Program Files (x86)\Java\jdk1.6.0_20\jre\lib\sunrsasign.jar Have no FileObject for C:\Program Files (x86)\Java\jdk1.6.0_20\jre\classes I just need to know what is causing the error and how to fix it. Thanks!

    Read the article

  • java.lang.ClassCastException: $Proxy99 cannot be cast

    - by svaret
    Hi, I am using JBoss4.2.2 and java6. The deployed ear's name is apa.ear In a servlet I have the following code line: placeBid = (PlaceBid) context.lookup("apa/" + PlaceBid.class.getSimpleName() + "/remote"); I have a generated jboss-app.xml like this: <jboss-app> <loader-repository>apa:app=ejb3</loader-repository> </jboss-app> When trying to get the PlaceBid via the context I get this exception java.lang.ClassCastException: $Proxy99 cannot be cast to se.nextit.actionbazaar.buslogic.PlaceBid The PlaceBid interface looks like this: @Remote public interface PlaceBid { Long addBid(String userId, Long itemId, Double bidPrice); } When I run the example coming with EJB3 in action it works. EJB3 in action sample code comes with ant building. I want to use Maven so I have rearranged the code some. However, I don't understan what I am doing wrong here. I have some thoughts about the jboss-app.xml file. I am not sure of how its content should look like. Grateful for any help. Best wishes Lasse

    Read the article

  • Duration of Excessive GC Time in "java.lang.OutOfMemoryError: GC overhead limit exceeded"

    - by jilles de wit
    Occasionally, somewhere between once every 2 days to once every 2 weeks, my application crashes in a seemingly random location in the code with: java.lang.OutOfMemoryError: GC overhead limit exceeded. If I google this error I come to this SO question and that lead me to this piece of sun documentation which expains: The parallel collector will throw an OutOfMemoryError if too much time is being spent in garbage collection: if more than 98% of the total time is spent in garbage collection and less than 2% of the heap is recovered, an OutOfMemoryError will be thrown. This feature is designed to prevent applications from running for an extended period of time while making little or no progress because the heap is too small. If necessary, this feature can be disabled by adding the option -XX:-UseGCOverheadLimit to the command line. Which tells me that my application is apparently spending 98% of the total time in garbage collection to recover only 2% of the heap. But 98% of what time? 98% of the entire two weeks the application has been running? 98% of the last millisecond? I'm trying to determine a best approach to actually solving this issue rather than just using -XX:-UseGCOverheadLimit but I feel a need to better understand the issue I'm solving.

    Read the article

  • java.lang.IllegalStateException: missing behavior definition for the preceding method call getMessag

    - by user362199
    Hi All, I'm using EasyMock(version 2.4) and TestNG for writing UnitTest. I have a following scenario and I cannot change the way class hierarchy is defined. I'm testing ClassB which is extending ClassA. ClassB look like this public class ClassB extends ClassA { public ClassB() { super("title"); } @Override public String getDisplayName() { return ClientMessages.getMessages("ClassB.title"); } } ClassA code public abstract class ClassA { private String title; public ClassA(String title) { this.title = ClientMessages.getMessages(title); } public String getDisplayName() { return this.title; } } ClientMessages class code public class ClientMessages { private static MessageResourse messageResourse; public ClientMessages(MessageResourse messageResourse) { this.messageResourse = messageResourse; } public static String getMessages(String code) { return messageResourse.getMessage(code); } } MessageResourse Class code public class MessageResourse { public String getMessage(String code) { return code; } } Testing ClassB import static org.easymock.classextension.EasyMock.createMock; import org.easymock.classextension.EasyMock; import org.testng.Assert; import org.testng.annotations.Test; public class ClassBTest { private MessageResourse mockMessageResourse = createMock(MessageResourse.class); private ClassB classToTest; private ClientMessages clientMessages; @Test public void testGetDisplayName() { EasyMock.expect(mockMessageResourse.getMessage("ClassB.title")).andReturn("someTitle"); clientMessages = new ClientMessages(mockMessageResourse); classToTest = new ClassB(); Assert.assertEquals("someTitle" , classToTest.getDisplayName()); EasyMock.replay(mockMessageResourse); } } When I'm running this this test I'm getting following exception: java.lang.IllegalStateException: missing behavior definition for the preceding method call getMessage("title") While debugging what I found is, it's not considering the mock method call mockMessageResourse.getMessage("ClassB.title") as it has been called from the construtor (ClassB object creation). Can any one please help me how to test in this case. Thanks.

    Read the article

  • java.lang.NoSuchMethodError: main Exception in thread "main" .

    - by russell
    I Cant understand why this messege come--------- java.lang.NoSuchMethodError: main Exception in thread "main" . I know it expecting main() method but as i m building an applet which does not contain main method rather contain init() method.So what will i do??My code is s follow --- import java.applet.*; import java.awt.*; public class Ballbewegung1 extends Applet implements Runnable { // Initialisierung der Variablen int x_pos = 10; // x - Position des Balles int y_pos = 100; // y - Position des Balles int radius = 20; // Radius des Balles public void init() { setBackground (Color.blue); } public void start () { // Schaffen eines neuen Threads, in dem das Spiel l?uft Thread th = new Thread (this); // Starten des Threads th.start (); } public void stop() { } public void destroy() { } public void run () { // Erniedrigen der ThreadPriority um zeichnen zu erleichtern Thread.currentThread().setPriority(Thread.MIN_PRIORITY); // Solange true ist l?uft der Thread weiter while (true) { // Ver?ndern der x- Koordinate x_pos ++; // Neuzeichnen des Applets repaint(); try { // Stoppen des Threads f?r in Klammern angegebene Millisekunden Thread.sleep (20); } catch (InterruptedException ex) { // do nothing } // Zur?cksetzen der ThreadPriority auf Maximalwert Thread.currentThread().setPriority(Thread.MAX_PRIORITY); } } public void paint (Graphics g) { g.setColor (Color.red); g.fillOval (x_pos - radius, y_pos - radius, 2 * radius, 2 * radius); } } And I dont know how to use code tag.so plz someone ans.

    Read the article

  • How to fix this java.lang.LinkageError?

    - by Péter Török
    I am trying to configure a custom layout class to Log4J as described in my previous post. The class uses java.util.regex.Matcher to identify potential credit card numbers in log messages. It works perfectly in unit tests (I can also programmatically configure a logger to use it and produce the expected output). However when I try to deploy it with our app in JBoss, I get the following error: --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM --- ObjectName: jboss.web.deployment:war=MyWebApp-2010_02-SNAPSHOT.war,id=476602902 State: FAILED Reason: java.lang.LinkageError: java/util/regex/Matcher I couldn't even find any info on this form of the error - typically LinkageError seems to show up with a "loader constrain violation" message, like in here. Technical details: we use JBoss 4.2, Java 5, Log4J 1.2.12. We deploy our app in an .ear, which contains (among others) the above mentioned .war file, and the custom layout class in a separate jar file. We override the default settings in jboss-log4J.xml with our own log4j.properties located in a different folder, which is added to the classpath at startup, and is provided via Carbon. I can only guess: are two different Matcher class versions loaded from somewhere, or is Matcher loaded by two different classloaders when it is used from the jar and the war? What does this error message mean, and how can I fix it?

    Read the article

  • Can't select data from MySQL database: java.lang.NullPointerException

    - by Devel
    Hi, I'm trying to select data from database using this code: //DATABASE ResultSet rs; String polecenie; Statement st; String[] subj; public void polacz() { try { Class.forName("com.mysql.jdbc.Driver"); Connection pol=DriverManager.getConnection("jdbc:mysql://localhost:3306/testgenerator", "root", "pospaz"); st = pol.createStatement(); lblPolaczonoZBaza.setText("Polaczono z baza danych testgenerator"); } catch (Exception ek) { statusMessageLabel.setText("Can't connect to d: "+ek); } polecenie = "select * from subjects"; try { rs = st.executeQuery(polecenie); int i=0; while (rs.next()){ subj[i] = rs.getString("name"); i++; } st.close(); } catch (Exception ek) { statusMessageLabel.setText("Can't select data: "+ek); } } The second catch shows exception: java.lang.NullPointerException I looked everywhere and I can't find the solution. I'd be grateful for any help.

    Read the article

  • Dynamically class creating by using Java Reflection, java.lang.ClassNotFoundException

    - by rubby
    Hi all; i want to use reflection in java, i want to do that third class will read the name of the class as String from console. Upon reading the name of the class, it will automatically and dynamically (!) generate that class and call its writeout method. If that class is not read from input, it will not be initialized. I wrote that codes but i am always taking to "java.lang.Class.Not.Found.Exception", and i don't know how i can fix it. Can anyone help me? class class3 { public Object dynamicsinif(String className, String fieldName, String value) throws Exception { Class cls = Class.forName(className,true,null); Object obj = cls.newInstance(); Field fld = cls.getField(fieldName); fld.set(obj, value); return obj; } public void writeout3() { System.out.println("class3"); } } public class Main { public static void main(String[] args) throws Exception { System.out.println("enter the class name : "); BufferedReader reader= new BufferedReader(new InputStreamReader(System.in)); String line=reader.readLine(); String x="Text1"; try{ class3 trycls=new class3(); Object gelen=trycls.dynamicsinif(line, x, "rubby"); Class yeni=(Class)gelen; System.out.println(yeni); }catch(ClassNotFoundException ex){ System.out.print(ex.toString()); } } }

    Read the article

  • java.lang.IllegalArgumentException: View not attached to window manager

    - by alex2k8
    I have an activity that starts AsyncTask and shows progress dialog for the duration of operation. The activity is declared NOT be recreated by rotation or keyboard slide. <activity android:name=".MyActivity" android:label="@string/app_name" android:configChanges="keyboardHidden|orientation" > <intent-filter> </intent-filter> </activity> Once task completed, I dissmiss dialog, but on some phones (framework: 1.5, 1.6) such error is thrown: java.lang.IllegalArgumentException: View not attached to window manager at android.view.WindowManagerImpl.findViewLocked(WindowManagerImpl.java:356) at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:201) at android.view.Window$LocalWindowManager.removeView(Window.java:400) at android.app.Dialog.dismissDialog(Dialog.java:268) at android.app.Dialog.access$000(Dialog.java:69) at android.app.Dialog$1.run(Dialog.java:103) at android.app.Dialog.dismiss(Dialog.java:252) at xxx.onPostExecute(xxx$1.java:xxx) My code is: final Dialog dialog = new AlertDialog.Builder(context) .setTitle("Processing...") .setCancelable(true) .create(); final AsyncTask<MyParams, Object, MyResult> task = new AsyncTask<MyParams, Object, MyResult>() { @Override protected MyResult doInBackground(MyParams... params) { // Long operation goes here } @Override protected void onPostExecute(MyResult result) { dialog.dismiss(); onCompletion(result); } }; task.execute(...); dialog.setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface arg0) { task.cancel(false); } }); dialog.show(); From what I have read (http://bend-ing.blogspot.com/2008/11/properly-handle-progress-dialog-in.html) and seen in Android sources, it looks like the only possible situation to get that exception is when activity was destroyed. But as I have mentioned, I forbid activity recreation for basic events. So any suggestions are very appreciated.

    Read the article

  • transmit a java.lang.reflect.Proxy over a network

    - by panzi
    Is there a convenient way to transmit an object including its code (the class) over a network (not just the instance data)? Don't ask me why I want to do this. It's in an assignment. I asked several times if that is really what they meant and the didn't rephrase their answer so I guess they really want us to transmit code (not just the field data) over a network. To be honest I have no clue why we need a Proxy in this assignment anyway, just writing a simple class would do IMO. The assignment says that we should instantiate the proxy on the server and transmit it to the client (and yes, they talk about a java.lang.reflect.Proxy, they name this class). Because there is no class file for a proxy I can't deploy that. I guess I would have to somehow read out the bytecode of the generated Proxy, transmit it to the client and then load it. Which makes absolutely no sense at all, but this seems what they want us to do. I don't get why.

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >