exception

Loopj timeout exception in Android

北战南征 提交于 2019-12-25 02:48:21
问题 I am having a strange problem with Loopj Async HTTP library. I sometimes get the response using GET or POST, sometimes the response comes after a long time, some times the response does not come at all. This happens only when wifi is used. I have used loopj in so many projects and those work fine with wifi but not this project. When I use my mobile data 3G connection, always the response comes. I have overridden the onFaliure method and this is what I get when the response from server does

java.net.UnknownHostException:www.google.com

余生长醉 提交于 2019-12-25 02:46:57
问题 I am developing a sanity check web application. I tried getting url response using HttpUrlConnection method but I am getting UnknownHostException. System.setProperty("java.net.preferIPv4Stack" , "true"); String[] uat_targetUrls={"https://www.google.com"}; String[] uat_targetResponse=new String[uat_targetUrls.length]; HttpURLConnection httpUrlConn; httpUrlConn = (HttpURLConnection) new URL(uat_targetUrls[i]) .openConnection(); httpUrlConn.setRequestMethod("GET"); httpUrlConn.setConnectTimeout

Withdraw Exception Java

不想你离开。 提交于 2019-12-25 02:42:23
问题 I have a problem when I ask the user for the amount to be withdrawn from their balance. I have a method called withdraw, and i pass their balance. Then I want to check if the amount that they want to withdraw is less than their balance. If yes, I would like to make the user to retry. So far, it checks for the input but i keep getting an output for each try. public void withdraw (double balance){ System.out.println("How much would you like to withdraw?"); double amount = keyboard.nextDouble();

FATAL EXCEPTION: main error Android development

半世苍凉 提交于 2019-12-25 02:42:10
问题 ERROR : 02-19 21:28:52.920: E/AndroidRuntime(17041): FATAL EXCEPTION: main 02-19 21:28:52.920: E/AndroidRuntime(17041): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.gamecik/com.example.gamecik.MainActivity}: java.lang.ClassCastException: com.google.android.gms.ads.AdView cannot be cast to android.widget.LinearLayout 02-19 21:28:52.920: E/AndroidRuntime(17041): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2304) 02-19 21:28:52.920: E

Android 2.1 & HTC Desire: Is there a bluetooth problem? (CorruptedStreamException)

跟風遠走 提交于 2019-12-25 02:34:41
问题 I made an application that is using Android SDK 2.1. This application uses bluetooth to connect to multiple devices. I have 3 HTC Dreams (Google G1) as test devices. The application is running really fine on them. They are rooted and Android 2.1 is running on them. If I join with my HTC Desire (Android 2.1 Update 1), the streams that read from the bluetooth socket are always closed if there is more than 1 bluetooth connetion open. The exception that is thrown is a IOException and a

Stack overflow error in singleton pattern

删除回忆录丶 提交于 2019-12-25 02:22:04
问题 I have implemented Single Pattern. Here is my code i am getting the an error when i call the Test.BuildData() function. Please help public class WordDataItem { public string Word { get; set; } public string Definition { get; set; } public int WordGroupKey { get; set; } } public class WordDataGroup { public List<WordDataItem> listItem = new List<WordDataItem>(); public int GroupKey { get; set; } } public sealed class WordDataSource { private static WordDataSource _dataSoruce; private List

Is it possible to re-raise an ActiveRecord::Rollback exception from inside a transaction block?

僤鯓⒐⒋嵵緔 提交于 2019-12-25 02:19:18
问题 In my rails app, I have a transaction block in a controller's create action in which I attempt to create two records. def create ActiveRecord::Base.transaction do @foo = Foo.new(params[:foo].except(:bar)) raise ActiveRecord::Rollback unless @foo.save @bar = Bar.new(params[:foo][:bar]) raise ActiveRecord::Rollback unless @bar.save end end I'd like to be able to rescue from the Rollback so I can return an error indicating which save failed. rescue ActiveRecord::Rollback => e @foo.errors = e if

Throwing exception although right IP used

a 夏天 提交于 2019-12-25 02:14:28
问题 package com.example.androidapp; import java.net.InetSocketAddress; import java.util.Collection; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.widget.TextView; import com.nxp.jip.JIPImpl; import com.nxp.jip.PacketHandlerIPv6; import com.nxp.jip.exception.JipException; import com.nxp.jip.service.JenNetIPNetwork; import com.nxp.jip.service.Node; import com.nxp.jip.service.Service; public class Application extends Activity { @Override protected

Throwing exception although right IP used

霸气de小男生 提交于 2019-12-25 02:11:12
问题 package com.example.androidapp; import java.net.InetSocketAddress; import java.util.Collection; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.widget.TextView; import com.nxp.jip.JIPImpl; import com.nxp.jip.PacketHandlerIPv6; import com.nxp.jip.exception.JipException; import com.nxp.jip.service.JenNetIPNetwork; import com.nxp.jip.service.Node; import com.nxp.jip.service.Service; public class Application extends Activity { @Override protected

floating point exception not catchable?

我的未来我决定 提交于 2019-12-25 01:55:15
问题 I have a problem with the floating point exception. When i divide by zero, i get this exception. I tried to catch it, but the solutions on the internet don't work for me. #include<iostream> using namespace std; int main(){ double h{0}; int a{0},b{0},c{0}; cin.exceptions(ios_base::failbit); cout << "Enter Values: "; try{ cin >> a >> b >> c; h = (3/1/a+1/b+1/c); if(a == 0 || b == 0 || c == 0){ throw overflow_error("Division by zero is not allowed!"); } cout << h; } catch(overflow_error e){ cerr