Hello all,
i’m trying to get a value of an user when i make the login.
I’ve create a new column in my phpmyadmin database (on the ofuser table). I’ve created the column “permission” because i need to set personalized permissions at the user.
So, when i try the following code, i get errors:
XMPPTCPConnectionConfiguration connectionConfig = XMPPTCPConnectionConfiguration.builder()
.setUsernameAndPassword(TxtUser.getText().toString(), TxtPass.getText().toString())
.setServiceName(DB_Conn.SERVICE_NAME)
.setHost(DB_Conn.HOST)
.setConnectTimeout(0)
.setSendPresence(false)
.setPort(DB_Conn.PORT)
.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled)
.build();
DB_Conn.setConnectionConfig(connectionConfig); XMPPTCPConnection connection = new XMPPTCPConnection(connectionConfig);
DB_Conn.setConnection(connection); try {
connection.connect().login();
int permesso;
AccountManager am = AccountManager.getInstance(connection);
permesso = Integer.parseInt(am.getAccountAttribute("permission")); } catch (XMPPException e) {
e.printStackTrace();
return "errore1";
} catch (SmackException e) {
e.printStackTrace();
return "errore2";
} catch (IOException e) {
e.printStackTrace();
return "errore3";
} return "done";
}
06-18 17:03:16.529 16166-17784/it.unicam.smartcast E/AndroidRuntime﹕ FATAL EXCEPTION: AsyncTask #3
Process: it.unicam.smartcast, PID: 16166
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:300)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.NumberFormatException: Invalid int: "null"
at java.lang.Integer.invalidInt(Integer.java:138)
at java.lang.Integer.parseInt(Integer.java:358)
at java.lang.Integer.parseInt(Integer.java:334)
at it.unicam.smartcast.Login$logInConnection.doInBackground(Login.java:94)
at it.unicam.smartcast.Login$logInConnection.doInBackground(Login.java:55)
at android.os.AsyncTask$2.call(AsyncTask.java:288)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
06-18 17:03:16.842 16166-16166/it.unicam.smartcast D/BubblePopupHelper﹕ isShowingBubblePopup : false
06-18 17:03:16.842 16166-16166/it.unicam.smartcast D/BubblePopupHelper﹕ isShowingBubblePopup : false
06-18 17:03:16.842 16166-16166/it.unicam.smartcast D/BubblePopupHelper﹕ isShowingBubblePopup : false
06-18 17:03:16.842 16166-16166/it.unicam.smartcast D/BubblePopupHelper﹕ isShowingBubblePopup : false
06-18 17:03:18.468 16166-16166/it.unicam.smartcast E/CliptrayUtils﹕ hideClipTrayIfNeeded() TextView is focused!! hideClipTray()
06-18 17:03:18.489 16166-16166/it.unicam.smartcast E/WindowManager﹕ android.view.WindowLeaked: Activity it.unicam.smartcast.Login has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{2adcfbd7 V.E..... R......D 0,0-1026,348} that was originally added here
at android.view.ViewRootImpl.<init>(ViewRootImpl.java:376)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:261)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
at android.app.Dialog.show(Dialog.java:306)
at it.unicam.smartcast.Login$logInConnection.onPreExecute(Login.java:63)
at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:587)
at android.os.AsyncTask.execute(AsyncTask.java:535)
at it.unicam.smartcast.Login.logIn(Login.java:51)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at android.view.View$1.onClick(View.java:4010)
at android.view.View.performClick(View.java:4764)
at android.view.View$PerformClick.run(View.java:19835)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5292)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:908)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:703)
Where i am wrong? Seems like i get a null value.
Of course, Login.java:94 is the line 20 of the code above. Thank You