Questions tagged as 'java'

1
answer

How to get Paramentro in a Web service in C # sent from Android

I'm consuming a Web service developed in C #, from an Android application. When sending simple types per parameter such as string, int, or long, I can get the information usually just by putting the same type in the Web service method declaratio...
asked by 28.03.2014 / 15:55
1
answer

How to delete MySQL database news?

In this link teaches you to list comments (in my case news) using external database (project download). How can I delete a news item when selecting, and still have a Dialog appear asking if I want to delete the news from the external databa...
asked by 11.03.2014 / 19:40
1
answer

An entity that is inherited persists

I have a Person entity that is inherited from another Administrator entity. In the database I already have data in the Person entity and I want to associate a Person Administrator . How can I do this? I'm using hibernate , an...
asked by 02.04.2014 / 20:00
1
answer

Paypal IPN for canceling recurring payment

I obtained the following code from PayPal's git hub. I am making recurring payments and would like to receive notification on the system when canceling. This could block the provision of my services if the user cancels. I have the servlet code,...
asked by 29.09.2014 / 16:53
1
answer

Problems with data modeling with Persistence.xml

I created a college application to create automatic tables by Hibernate with JPA but it gave some error in some tables, which were these; Catalog OrderDAO ProductDAO but is generating the following error, When I click on Catalo...
asked by 25.09.2014 / 01:13
1
answer

Counter of objects

I'm starting to study Java, and I was needing an object counter, that is, I need to paste a text, and in it it has to identify certain variables in that text, and from there to count the quantity of each variable, then add the variables and give...
asked by 27.09.2014 / 04:44
1
answer

How to map a http request parameter to an enum in java?

I am making an ajax request like this: $.ajax({ type : 'POST', url : apiURL + '/play', dataType : "json", data : { against : "ANYBODY" }, success : function(data, textStatus, jqXHR) { // ... }, e...
asked by 15.04.2014 / 22:00
2
answers

Put two attributes in a cell

Have some structure, List , LinkedList , etc., that allows me to put two attributes in the cell? For example, an integer and a string in each cell.     
asked by 12.04.2014 / 18:53
1
answer

FileUnput PrimeFaces does not update the attribute;

I have a repeat structure: <ui:repeat var="item" /> Inside it I print some fields. One of them is <p:fileUpload/> So far so good. The problem is when it's time to do the action, when I click the save button it assigns...
asked by 31.07.2014 / 19:20
1
answer

___ ___ erkimt problems StrictMode.ThreadPolicy ______ qstntxt ___

Hello, I have the link below

link

handing me a string %code% % type

%pre%

So, in %code% , handle it with% %code% below:

%pre%

This %code% % works normally. However, you need to put the code snippet below;

%pre%

Otherwise, the connection to the internet is NOT established.

However, I've added the INTERNET access permission on the %code% .

%pre%

But no use.

If I remove this block of code

%pre%

The connection to %code% does not.

The problem is that if I work that way, as often as the ones I need to access the %code% % is the same number of times you have to make use of this code snippet.

Is not there a general configuration file for this in %code% %?

Following the %code% % JsonClass

%pre%     
______ azszpr352394 ___

What happens is that your %code% tries to access the network (a blocking operation) in the main Android thread, which is not allowed.

You can read more about this , but to summarize: A The main Android thread is responsible for updating the views.

Doing blocking tasks such as accessing the network or the database in this thread causes the view to crash, giving that impression of lag in the application.

The above link also gives you an alternative to solve this problem: do this type of tasks within AsyncTasks .

I particularly prefer to delegate all this work to libraries like Retrofit .

Doing what you want with this lib is very trivial:

After adding dependencies , define the contract on an interface:

%pre%

Starts the service instance:

%pre%

And to consume the service in a non-blocking way, just call:

%pre%

Now, within the callback %code% you already have the webservice response parseada and ready to use.

    
___

Hello, I have the link below link handing me a string json % type {   "clientes":[      {        "idClientesT":"1",        "tipo":"s",        "nome":"Carlos"},      {        "idClientesT":"2",        "tipo":"s",        "nome":"Rogéri...
asked by 20.12.2018 / 14:43