I keep getting a error when I execute the send Credentials voidExcute URL get, Error when executing urlgetandroid:onclick method doesn't workButton Onclick works with api 25 but fails with api 18 - Android Studiojava.lang.IllegalStateException Not sure it is it with the data type?Android - using DigestUtils.sha1Hex() and crashedMy application is closing,when i click the buttonApp is crashing when clicking buttonWhen i run my android code the my code gives this error…“java.lang.IllegalStateException: Could not execute method for android:onClick”android button causing crashApp crashing in the part of Grid layout declaration
Theorems that impeded progress
Why can't we play rap on piano?
How do I deal with an unproductive colleague in a small company?
Are astronomers waiting to see something in an image from a gravitational lens that they've already seen in an adjacent image?
Languages that we cannot (dis)prove to be Context-Free
Does an object always see its latest internal state irrespective of thread?
Why doesn't H₄O²⁺ exist?
dbcc cleantable batch size explanation
How old can references or sources in a thesis be?
I'm flying to France today and my passport expires in less than 2 months
Important Resources for Dark Age Civilizations?
Today is the Center
LWC SFDX source push error TypeError: LWC1009: decl.moveTo is not a function
Approximately how much travel time was saved by the opening of the Suez Canal in 1869?
Can a Cauchy sequence converge for one metric while not converging for another?
What are these boxed doors outside store fronts in New York?
Why does Kotter return in Welcome Back Kotter?
How much of data wrangling is a data scientist's job?
Replacing matching entries in one column of a file by another column from a different file
How to format long polynomial?
Java Casting: Java 11 throws LambdaConversionException while 1.8 does not
Why is consensus so controversial in Britain?
RSA: Danger of using p to create q
Convert two switches to a dual stack, and add outlet - possible here?
I keep getting a error when I execute the send Credentials void
Excute URL get, Error when executing urlgetandroid:onclick method doesn't workButton Onclick works with api 25 but fails with api 18 - Android Studiojava.lang.IllegalStateException Not sure it is it with the data type?Android - using DigestUtils.sha1Hex() and crashedMy application is closing,when i click the buttonApp is crashing when clicking buttonWhen i run my android code the my code gives this error…“java.lang.IllegalStateException: Could not execute method for android:onClick”android button causing crashApp crashing in the part of Grid layout declaration
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
When I run my code i get a error when the SendCredentials
void is executed.
The error is:-
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.messager, PID: 16131
java.lang.IllegalStateException: Could not execute method for android:onClick
at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:390)
at android.view.View.performClick(View.java:6614)
at android.view.View.performClickInternal(View.java:6591)
at android.view.View.access$3100(View.java:786)
at android.view.View$PerformClick.run(View.java:25948)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:201)
at android.app.ActivityThread.main(ActivityThread.java:6806)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:385)
at android.view.View.performClick(View.java:6614)
at android.view.View.performClickInternal(View.java:6591)
at android.view.View.access$3100(View.java:786)
at android.view.View$PerformClick.run(View.java:25948)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:201)
at android.app.ActivityThread.main(ActivityThread.java:6806)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.io.DataInputStream.readLine()'
on a null object reference
at com.example.messager.MainActivity.SendCredentials(MainActivity.java:69)
at com.example.messager.MainActivity.SendMessage(MainActivity.java:26)
at java.lang.reflect.Method.invoke(Native Method)
at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:385)
at android.view.View.performClick(View.java:6614)
at android.view.View.performClickInternal(View.java:6591)
at android.view.View.access$3100(View.java:786)
at android.view.View$PerformClick.run(View.java:25948)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:201)
at android.app.ActivityThread.main(ActivityThread.java:6806)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
My Code is
package com.example.messager;
import android.support.design.widget.TextInputLayout;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import java.net.*;
import java.io.*;
public class MainActivity extends AppCompatActivity
EditText stopPort;
@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
public void SendMessage(View view)throws IOException
EditText emailText = (EditText) findViewById(R.id.Email);
String Username = emailText.getText().toString();
EditText passwordText = (EditText) findViewById(R.id.Password);
String Password = passwordText.getText().toString();
System.out.println("Your username is " + Username + "Your Password is " + Password);
SendCredentials();
public void SendCredentials()throws IOException
System.out.println("Work");
Socket socket = new Socket("192.168.0.114", 4321);
System.out.println("Work");
DataOutputStream dOut = new DataOutputStream(socket.getOutputStream());
dOut.writeByte(1);
dOut.writeUTF("This is a test");
dOut.flush();
System.out.println("Work");
public void Check()
`
android
add a comment |
When I run my code i get a error when the SendCredentials
void is executed.
The error is:-
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.messager, PID: 16131
java.lang.IllegalStateException: Could not execute method for android:onClick
at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:390)
at android.view.View.performClick(View.java:6614)
at android.view.View.performClickInternal(View.java:6591)
at android.view.View.access$3100(View.java:786)
at android.view.View$PerformClick.run(View.java:25948)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:201)
at android.app.ActivityThread.main(ActivityThread.java:6806)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:385)
at android.view.View.performClick(View.java:6614)
at android.view.View.performClickInternal(View.java:6591)
at android.view.View.access$3100(View.java:786)
at android.view.View$PerformClick.run(View.java:25948)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:201)
at android.app.ActivityThread.main(ActivityThread.java:6806)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.io.DataInputStream.readLine()'
on a null object reference
at com.example.messager.MainActivity.SendCredentials(MainActivity.java:69)
at com.example.messager.MainActivity.SendMessage(MainActivity.java:26)
at java.lang.reflect.Method.invoke(Native Method)
at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:385)
at android.view.View.performClick(View.java:6614)
at android.view.View.performClickInternal(View.java:6591)
at android.view.View.access$3100(View.java:786)
at android.view.View$PerformClick.run(View.java:25948)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:201)
at android.app.ActivityThread.main(ActivityThread.java:6806)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
My Code is
package com.example.messager;
import android.support.design.widget.TextInputLayout;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import java.net.*;
import java.io.*;
public class MainActivity extends AppCompatActivity
EditText stopPort;
@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
public void SendMessage(View view)throws IOException
EditText emailText = (EditText) findViewById(R.id.Email);
String Username = emailText.getText().toString();
EditText passwordText = (EditText) findViewById(R.id.Password);
String Password = passwordText.getText().toString();
System.out.println("Your username is " + Username + "Your Password is " + Password);
SendCredentials();
public void SendCredentials()throws IOException
System.out.println("Work");
Socket socket = new Socket("192.168.0.114", 4321);
System.out.println("Work");
DataOutputStream dOut = new DataOutputStream(socket.getOutputStream());
dOut.writeByte(1);
dOut.writeUTF("This is a test");
dOut.flush();
System.out.println("Work");
public void Check()
`
android
Where is your line 69? You missed many things.
– Geno Chen
Mar 11 at 16:39
I believe many of your work have been removed from this question, after the thirdprintln("Work")
. Please add them all. Besides, it is better to useandroid.util.Log
instead ofSystem.out.println
.
– Geno Chen
Mar 11 at 16:47
add a comment |
When I run my code i get a error when the SendCredentials
void is executed.
The error is:-
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.messager, PID: 16131
java.lang.IllegalStateException: Could not execute method for android:onClick
at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:390)
at android.view.View.performClick(View.java:6614)
at android.view.View.performClickInternal(View.java:6591)
at android.view.View.access$3100(View.java:786)
at android.view.View$PerformClick.run(View.java:25948)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:201)
at android.app.ActivityThread.main(ActivityThread.java:6806)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:385)
at android.view.View.performClick(View.java:6614)
at android.view.View.performClickInternal(View.java:6591)
at android.view.View.access$3100(View.java:786)
at android.view.View$PerformClick.run(View.java:25948)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:201)
at android.app.ActivityThread.main(ActivityThread.java:6806)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.io.DataInputStream.readLine()'
on a null object reference
at com.example.messager.MainActivity.SendCredentials(MainActivity.java:69)
at com.example.messager.MainActivity.SendMessage(MainActivity.java:26)
at java.lang.reflect.Method.invoke(Native Method)
at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:385)
at android.view.View.performClick(View.java:6614)
at android.view.View.performClickInternal(View.java:6591)
at android.view.View.access$3100(View.java:786)
at android.view.View$PerformClick.run(View.java:25948)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:201)
at android.app.ActivityThread.main(ActivityThread.java:6806)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
My Code is
package com.example.messager;
import android.support.design.widget.TextInputLayout;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import java.net.*;
import java.io.*;
public class MainActivity extends AppCompatActivity
EditText stopPort;
@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
public void SendMessage(View view)throws IOException
EditText emailText = (EditText) findViewById(R.id.Email);
String Username = emailText.getText().toString();
EditText passwordText = (EditText) findViewById(R.id.Password);
String Password = passwordText.getText().toString();
System.out.println("Your username is " + Username + "Your Password is " + Password);
SendCredentials();
public void SendCredentials()throws IOException
System.out.println("Work");
Socket socket = new Socket("192.168.0.114", 4321);
System.out.println("Work");
DataOutputStream dOut = new DataOutputStream(socket.getOutputStream());
dOut.writeByte(1);
dOut.writeUTF("This is a test");
dOut.flush();
System.out.println("Work");
public void Check()
`
android
When I run my code i get a error when the SendCredentials
void is executed.
The error is:-
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.messager, PID: 16131
java.lang.IllegalStateException: Could not execute method for android:onClick
at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:390)
at android.view.View.performClick(View.java:6614)
at android.view.View.performClickInternal(View.java:6591)
at android.view.View.access$3100(View.java:786)
at android.view.View$PerformClick.run(View.java:25948)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:201)
at android.app.ActivityThread.main(ActivityThread.java:6806)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:385)
at android.view.View.performClick(View.java:6614)
at android.view.View.performClickInternal(View.java:6591)
at android.view.View.access$3100(View.java:786)
at android.view.View$PerformClick.run(View.java:25948)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:201)
at android.app.ActivityThread.main(ActivityThread.java:6806)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.io.DataInputStream.readLine()'
on a null object reference
at com.example.messager.MainActivity.SendCredentials(MainActivity.java:69)
at com.example.messager.MainActivity.SendMessage(MainActivity.java:26)
at java.lang.reflect.Method.invoke(Native Method)
at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:385)
at android.view.View.performClick(View.java:6614)
at android.view.View.performClickInternal(View.java:6591)
at android.view.View.access$3100(View.java:786)
at android.view.View$PerformClick.run(View.java:25948)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:201)
at android.app.ActivityThread.main(ActivityThread.java:6806)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
My Code is
package com.example.messager;
import android.support.design.widget.TextInputLayout;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import java.net.*;
import java.io.*;
public class MainActivity extends AppCompatActivity
EditText stopPort;
@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
public void SendMessage(View view)throws IOException
EditText emailText = (EditText) findViewById(R.id.Email);
String Username = emailText.getText().toString();
EditText passwordText = (EditText) findViewById(R.id.Password);
String Password = passwordText.getText().toString();
System.out.println("Your username is " + Username + "Your Password is " + Password);
SendCredentials();
public void SendCredentials()throws IOException
System.out.println("Work");
Socket socket = new Socket("192.168.0.114", 4321);
System.out.println("Work");
DataOutputStream dOut = new DataOutputStream(socket.getOutputStream());
dOut.writeByte(1);
dOut.writeUTF("This is a test");
dOut.flush();
System.out.println("Work");
public void Check()
`
android
android
edited Mar 8 at 10:43
Zoe
13.2k85386
13.2k85386
asked Mar 8 at 1:57
ZXX3NZXX3N
31
31
Where is your line 69? You missed many things.
– Geno Chen
Mar 11 at 16:39
I believe many of your work have been removed from this question, after the thirdprintln("Work")
. Please add them all. Besides, it is better to useandroid.util.Log
instead ofSystem.out.println
.
– Geno Chen
Mar 11 at 16:47
add a comment |
Where is your line 69? You missed many things.
– Geno Chen
Mar 11 at 16:39
I believe many of your work have been removed from this question, after the thirdprintln("Work")
. Please add them all. Besides, it is better to useandroid.util.Log
instead ofSystem.out.println
.
– Geno Chen
Mar 11 at 16:47
Where is your line 69? You missed many things.
– Geno Chen
Mar 11 at 16:39
Where is your line 69? You missed many things.
– Geno Chen
Mar 11 at 16:39
I believe many of your work have been removed from this question, after the third
println("Work")
. Please add them all. Besides, it is better to use android.util.Log
instead of System.out.println
.– Geno Chen
Mar 11 at 16:47
I believe many of your work have been removed from this question, after the third
println("Work")
. Please add them all. Besides, it is better to use android.util.Log
instead of System.out.println
.– Geno Chen
Mar 11 at 16:47
add a comment |
3 Answers
3
active
oldest
votes
Looking to above code and exception trace 2 things can be wrong.
check your code for
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.io.DataInputStream.readLine()' on a null object reference atIn xml layout file, have you declared "check" method on android:onClick
i.e. android:onClick="check", if yes then your check method should look like this
public void Check(View view)
Can you share you xml layout file as well.
Neither of these helped but i put my xml code in the post above
– ZXX3N
Mar 9 at 17:26
I have rewrite your code now its works fine. Please create socket connection separate thread, i.e. another then main thread. Please see my another answer as below....
– Sundeep Sharma
Mar 11 at 16:23
add a comment |
yea my xml code is '
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:id="@+id/Welcome"
android:layout_width="198dp"
android:layout_height="52dp"
android:layout_marginStart="104dp"
android:layout_marginTop="68dp"
android:text="Welcome"
android:textAlignment="center"
android:textAllCaps="false"
android:textColor="@color/colorPrimaryDark"
android:textSize="36sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<android.support.design.widget.TextInputLayout
android:id="@+id/passwordWrapper"
android:layout_width="387dp"
android:layout_height="56dp"
android:layout_marginStart="8dp"
android:layout_marginTop="444dp"
android:hint="Password"
app:hintEnabled="true"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<EditText
android:id="@+id/Password"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint="Password"
android:inputType="textPassword"
android:textSize="18sp"
tools:text="" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/emailWrapper"
android:layout_width="397dp"
android:layout_height="56dp"
android:layout_marginStart="8dp"
android:layout_marginTop="368dp"
android:hint="Email"
app:hintEnabled="true"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<EditText
android:id="@+id/Email"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint="Email"
android:inputType="textWebEmailAddress"
android:textAlignment="textStart"
android:textSize="18sp"
tools:text=""/>
</android.support.design.widget.TextInputLayout>
<Button
android:id="@+id/LoginButton"
android:layout_width="348dp"
android:layout_height="45dp"
android:layout_marginStart="28dp"
android:layout_marginTop="520dp"
android:text="LOGIN"
android:onClick="SendMessage"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
'
add a comment |
public void SendMessage(View view) throws IOException
EditText emailText = (EditText) findViewById(R.id.Email);
String Username = emailText.getText().toString();
EditText passwordText = (EditText) findViewById(R.id.Password);
String Password = passwordText.getText().toString();
System.out.println("Your username is " + Username + "Your Password is " + Password);
SendCredentials();
public void SendCredentials() throws IOException
new MyAsyncTask().execute();
public void Check()
private class MyAsyncTask extends AsyncTask<Void, Void, Void>
Activity activity;
IOException ioException;
MyAsyncTask()
super();
@Override
protected Void doInBackground(Void... voids)
StringBuilder sb = new StringBuilder();
try
System.out.println("Work");
Socket socket = new Socket("192.168.0.114", 4321);
System.out.println("Work");
DataOutputStream dOut = new DataOutputStream(socket.getOutputStream());
dOut.writeByte(1);
dOut.writeUTF("This is a test");
dOut.flush();
System.out.println("Work");
socket.close();
catch (IOException e)
this.ioException = e;
Downvoted: absolutely not the fix of the question.
– Geno Chen
Mar 11 at 16:41
See the last "Caused by" of the stacktrace, the call toreadLine()
for aDataInputStream
insideSendCredentials
lies in line 69 ofMainActivity.java
immediately generate NPE, but that call was missing in the code provided by OP, then OP must be missing the core code, which using other method won't reproduce or solve the issue.
– Geno Chen
Mar 11 at 17:00
Don't aggress with downvoted. :et add the completed code, please run this project, I am able to run application with abobe code with any NPE.
– Sundeep Sharma
Mar 11 at 18:56
The hint of downvote is "This answer is not useful.", and it suits. The logcat and the code given by OP shows the code isn't complete, so writing any non-NPE code won't solve that question at all (so this is "not useful").
– Geno Chen
Mar 12 at 2:23
Accepted Geno, you are right
– Sundeep Sharma
Mar 12 at 22:31
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55055666%2fi-keep-getting-a-error-when-i-execute-the-send-credentials-void%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Looking to above code and exception trace 2 things can be wrong.
check your code for
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.io.DataInputStream.readLine()' on a null object reference atIn xml layout file, have you declared "check" method on android:onClick
i.e. android:onClick="check", if yes then your check method should look like this
public void Check(View view)
Can you share you xml layout file as well.
Neither of these helped but i put my xml code in the post above
– ZXX3N
Mar 9 at 17:26
I have rewrite your code now its works fine. Please create socket connection separate thread, i.e. another then main thread. Please see my another answer as below....
– Sundeep Sharma
Mar 11 at 16:23
add a comment |
Looking to above code and exception trace 2 things can be wrong.
check your code for
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.io.DataInputStream.readLine()' on a null object reference atIn xml layout file, have you declared "check" method on android:onClick
i.e. android:onClick="check", if yes then your check method should look like this
public void Check(View view)
Can you share you xml layout file as well.
Neither of these helped but i put my xml code in the post above
– ZXX3N
Mar 9 at 17:26
I have rewrite your code now its works fine. Please create socket connection separate thread, i.e. another then main thread. Please see my another answer as below....
– Sundeep Sharma
Mar 11 at 16:23
add a comment |
Looking to above code and exception trace 2 things can be wrong.
check your code for
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.io.DataInputStream.readLine()' on a null object reference atIn xml layout file, have you declared "check" method on android:onClick
i.e. android:onClick="check", if yes then your check method should look like this
public void Check(View view)
Can you share you xml layout file as well.
Looking to above code and exception trace 2 things can be wrong.
check your code for
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.io.DataInputStream.readLine()' on a null object reference atIn xml layout file, have you declared "check" method on android:onClick
i.e. android:onClick="check", if yes then your check method should look like this
public void Check(View view)
Can you share you xml layout file as well.
answered Mar 8 at 4:56
Sundeep SharmaSundeep Sharma
324
324
Neither of these helped but i put my xml code in the post above
– ZXX3N
Mar 9 at 17:26
I have rewrite your code now its works fine. Please create socket connection separate thread, i.e. another then main thread. Please see my another answer as below....
– Sundeep Sharma
Mar 11 at 16:23
add a comment |
Neither of these helped but i put my xml code in the post above
– ZXX3N
Mar 9 at 17:26
I have rewrite your code now its works fine. Please create socket connection separate thread, i.e. another then main thread. Please see my another answer as below....
– Sundeep Sharma
Mar 11 at 16:23
Neither of these helped but i put my xml code in the post above
– ZXX3N
Mar 9 at 17:26
Neither of these helped but i put my xml code in the post above
– ZXX3N
Mar 9 at 17:26
I have rewrite your code now its works fine. Please create socket connection separate thread, i.e. another then main thread. Please see my another answer as below....
– Sundeep Sharma
Mar 11 at 16:23
I have rewrite your code now its works fine. Please create socket connection separate thread, i.e. another then main thread. Please see my another answer as below....
– Sundeep Sharma
Mar 11 at 16:23
add a comment |
yea my xml code is '
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:id="@+id/Welcome"
android:layout_width="198dp"
android:layout_height="52dp"
android:layout_marginStart="104dp"
android:layout_marginTop="68dp"
android:text="Welcome"
android:textAlignment="center"
android:textAllCaps="false"
android:textColor="@color/colorPrimaryDark"
android:textSize="36sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<android.support.design.widget.TextInputLayout
android:id="@+id/passwordWrapper"
android:layout_width="387dp"
android:layout_height="56dp"
android:layout_marginStart="8dp"
android:layout_marginTop="444dp"
android:hint="Password"
app:hintEnabled="true"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<EditText
android:id="@+id/Password"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint="Password"
android:inputType="textPassword"
android:textSize="18sp"
tools:text="" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/emailWrapper"
android:layout_width="397dp"
android:layout_height="56dp"
android:layout_marginStart="8dp"
android:layout_marginTop="368dp"
android:hint="Email"
app:hintEnabled="true"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<EditText
android:id="@+id/Email"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint="Email"
android:inputType="textWebEmailAddress"
android:textAlignment="textStart"
android:textSize="18sp"
tools:text=""/>
</android.support.design.widget.TextInputLayout>
<Button
android:id="@+id/LoginButton"
android:layout_width="348dp"
android:layout_height="45dp"
android:layout_marginStart="28dp"
android:layout_marginTop="520dp"
android:text="LOGIN"
android:onClick="SendMessage"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
'
add a comment |
yea my xml code is '
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:id="@+id/Welcome"
android:layout_width="198dp"
android:layout_height="52dp"
android:layout_marginStart="104dp"
android:layout_marginTop="68dp"
android:text="Welcome"
android:textAlignment="center"
android:textAllCaps="false"
android:textColor="@color/colorPrimaryDark"
android:textSize="36sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<android.support.design.widget.TextInputLayout
android:id="@+id/passwordWrapper"
android:layout_width="387dp"
android:layout_height="56dp"
android:layout_marginStart="8dp"
android:layout_marginTop="444dp"
android:hint="Password"
app:hintEnabled="true"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<EditText
android:id="@+id/Password"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint="Password"
android:inputType="textPassword"
android:textSize="18sp"
tools:text="" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/emailWrapper"
android:layout_width="397dp"
android:layout_height="56dp"
android:layout_marginStart="8dp"
android:layout_marginTop="368dp"
android:hint="Email"
app:hintEnabled="true"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<EditText
android:id="@+id/Email"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint="Email"
android:inputType="textWebEmailAddress"
android:textAlignment="textStart"
android:textSize="18sp"
tools:text=""/>
</android.support.design.widget.TextInputLayout>
<Button
android:id="@+id/LoginButton"
android:layout_width="348dp"
android:layout_height="45dp"
android:layout_marginStart="28dp"
android:layout_marginTop="520dp"
android:text="LOGIN"
android:onClick="SendMessage"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
'
add a comment |
yea my xml code is '
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:id="@+id/Welcome"
android:layout_width="198dp"
android:layout_height="52dp"
android:layout_marginStart="104dp"
android:layout_marginTop="68dp"
android:text="Welcome"
android:textAlignment="center"
android:textAllCaps="false"
android:textColor="@color/colorPrimaryDark"
android:textSize="36sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<android.support.design.widget.TextInputLayout
android:id="@+id/passwordWrapper"
android:layout_width="387dp"
android:layout_height="56dp"
android:layout_marginStart="8dp"
android:layout_marginTop="444dp"
android:hint="Password"
app:hintEnabled="true"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<EditText
android:id="@+id/Password"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint="Password"
android:inputType="textPassword"
android:textSize="18sp"
tools:text="" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/emailWrapper"
android:layout_width="397dp"
android:layout_height="56dp"
android:layout_marginStart="8dp"
android:layout_marginTop="368dp"
android:hint="Email"
app:hintEnabled="true"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<EditText
android:id="@+id/Email"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint="Email"
android:inputType="textWebEmailAddress"
android:textAlignment="textStart"
android:textSize="18sp"
tools:text=""/>
</android.support.design.widget.TextInputLayout>
<Button
android:id="@+id/LoginButton"
android:layout_width="348dp"
android:layout_height="45dp"
android:layout_marginStart="28dp"
android:layout_marginTop="520dp"
android:text="LOGIN"
android:onClick="SendMessage"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
'
yea my xml code is '
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:id="@+id/Welcome"
android:layout_width="198dp"
android:layout_height="52dp"
android:layout_marginStart="104dp"
android:layout_marginTop="68dp"
android:text="Welcome"
android:textAlignment="center"
android:textAllCaps="false"
android:textColor="@color/colorPrimaryDark"
android:textSize="36sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<android.support.design.widget.TextInputLayout
android:id="@+id/passwordWrapper"
android:layout_width="387dp"
android:layout_height="56dp"
android:layout_marginStart="8dp"
android:layout_marginTop="444dp"
android:hint="Password"
app:hintEnabled="true"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<EditText
android:id="@+id/Password"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint="Password"
android:inputType="textPassword"
android:textSize="18sp"
tools:text="" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/emailWrapper"
android:layout_width="397dp"
android:layout_height="56dp"
android:layout_marginStart="8dp"
android:layout_marginTop="368dp"
android:hint="Email"
app:hintEnabled="true"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<EditText
android:id="@+id/Email"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint="Email"
android:inputType="textWebEmailAddress"
android:textAlignment="textStart"
android:textSize="18sp"
tools:text=""/>
</android.support.design.widget.TextInputLayout>
<Button
android:id="@+id/LoginButton"
android:layout_width="348dp"
android:layout_height="45dp"
android:layout_marginStart="28dp"
android:layout_marginTop="520dp"
android:text="LOGIN"
android:onClick="SendMessage"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
'
answered Mar 8 at 12:00
ZXX3NZXX3N
31
31
add a comment |
add a comment |
public void SendMessage(View view) throws IOException
EditText emailText = (EditText) findViewById(R.id.Email);
String Username = emailText.getText().toString();
EditText passwordText = (EditText) findViewById(R.id.Password);
String Password = passwordText.getText().toString();
System.out.println("Your username is " + Username + "Your Password is " + Password);
SendCredentials();
public void SendCredentials() throws IOException
new MyAsyncTask().execute();
public void Check()
private class MyAsyncTask extends AsyncTask<Void, Void, Void>
Activity activity;
IOException ioException;
MyAsyncTask()
super();
@Override
protected Void doInBackground(Void... voids)
StringBuilder sb = new StringBuilder();
try
System.out.println("Work");
Socket socket = new Socket("192.168.0.114", 4321);
System.out.println("Work");
DataOutputStream dOut = new DataOutputStream(socket.getOutputStream());
dOut.writeByte(1);
dOut.writeUTF("This is a test");
dOut.flush();
System.out.println("Work");
socket.close();
catch (IOException e)
this.ioException = e;
Downvoted: absolutely not the fix of the question.
– Geno Chen
Mar 11 at 16:41
See the last "Caused by" of the stacktrace, the call toreadLine()
for aDataInputStream
insideSendCredentials
lies in line 69 ofMainActivity.java
immediately generate NPE, but that call was missing in the code provided by OP, then OP must be missing the core code, which using other method won't reproduce or solve the issue.
– Geno Chen
Mar 11 at 17:00
Don't aggress with downvoted. :et add the completed code, please run this project, I am able to run application with abobe code with any NPE.
– Sundeep Sharma
Mar 11 at 18:56
The hint of downvote is "This answer is not useful.", and it suits. The logcat and the code given by OP shows the code isn't complete, so writing any non-NPE code won't solve that question at all (so this is "not useful").
– Geno Chen
Mar 12 at 2:23
Accepted Geno, you are right
– Sundeep Sharma
Mar 12 at 22:31
add a comment |
public void SendMessage(View view) throws IOException
EditText emailText = (EditText) findViewById(R.id.Email);
String Username = emailText.getText().toString();
EditText passwordText = (EditText) findViewById(R.id.Password);
String Password = passwordText.getText().toString();
System.out.println("Your username is " + Username + "Your Password is " + Password);
SendCredentials();
public void SendCredentials() throws IOException
new MyAsyncTask().execute();
public void Check()
private class MyAsyncTask extends AsyncTask<Void, Void, Void>
Activity activity;
IOException ioException;
MyAsyncTask()
super();
@Override
protected Void doInBackground(Void... voids)
StringBuilder sb = new StringBuilder();
try
System.out.println("Work");
Socket socket = new Socket("192.168.0.114", 4321);
System.out.println("Work");
DataOutputStream dOut = new DataOutputStream(socket.getOutputStream());
dOut.writeByte(1);
dOut.writeUTF("This is a test");
dOut.flush();
System.out.println("Work");
socket.close();
catch (IOException e)
this.ioException = e;
Downvoted: absolutely not the fix of the question.
– Geno Chen
Mar 11 at 16:41
See the last "Caused by" of the stacktrace, the call toreadLine()
for aDataInputStream
insideSendCredentials
lies in line 69 ofMainActivity.java
immediately generate NPE, but that call was missing in the code provided by OP, then OP must be missing the core code, which using other method won't reproduce or solve the issue.
– Geno Chen
Mar 11 at 17:00
Don't aggress with downvoted. :et add the completed code, please run this project, I am able to run application with abobe code with any NPE.
– Sundeep Sharma
Mar 11 at 18:56
The hint of downvote is "This answer is not useful.", and it suits. The logcat and the code given by OP shows the code isn't complete, so writing any non-NPE code won't solve that question at all (so this is "not useful").
– Geno Chen
Mar 12 at 2:23
Accepted Geno, you are right
– Sundeep Sharma
Mar 12 at 22:31
add a comment |
public void SendMessage(View view) throws IOException
EditText emailText = (EditText) findViewById(R.id.Email);
String Username = emailText.getText().toString();
EditText passwordText = (EditText) findViewById(R.id.Password);
String Password = passwordText.getText().toString();
System.out.println("Your username is " + Username + "Your Password is " + Password);
SendCredentials();
public void SendCredentials() throws IOException
new MyAsyncTask().execute();
public void Check()
private class MyAsyncTask extends AsyncTask<Void, Void, Void>
Activity activity;
IOException ioException;
MyAsyncTask()
super();
@Override
protected Void doInBackground(Void... voids)
StringBuilder sb = new StringBuilder();
try
System.out.println("Work");
Socket socket = new Socket("192.168.0.114", 4321);
System.out.println("Work");
DataOutputStream dOut = new DataOutputStream(socket.getOutputStream());
dOut.writeByte(1);
dOut.writeUTF("This is a test");
dOut.flush();
System.out.println("Work");
socket.close();
catch (IOException e)
this.ioException = e;
public void SendMessage(View view) throws IOException
EditText emailText = (EditText) findViewById(R.id.Email);
String Username = emailText.getText().toString();
EditText passwordText = (EditText) findViewById(R.id.Password);
String Password = passwordText.getText().toString();
System.out.println("Your username is " + Username + "Your Password is " + Password);
SendCredentials();
public void SendCredentials() throws IOException
new MyAsyncTask().execute();
public void Check()
private class MyAsyncTask extends AsyncTask<Void, Void, Void>
Activity activity;
IOException ioException;
MyAsyncTask()
super();
@Override
protected Void doInBackground(Void... voids)
StringBuilder sb = new StringBuilder();
try
System.out.println("Work");
Socket socket = new Socket("192.168.0.114", 4321);
System.out.println("Work");
DataOutputStream dOut = new DataOutputStream(socket.getOutputStream());
dOut.writeByte(1);
dOut.writeUTF("This is a test");
dOut.flush();
System.out.println("Work");
socket.close();
catch (IOException e)
this.ioException = e;
answered Mar 11 at 16:32
Sundeep SharmaSundeep Sharma
324
324
Downvoted: absolutely not the fix of the question.
– Geno Chen
Mar 11 at 16:41
See the last "Caused by" of the stacktrace, the call toreadLine()
for aDataInputStream
insideSendCredentials
lies in line 69 ofMainActivity.java
immediately generate NPE, but that call was missing in the code provided by OP, then OP must be missing the core code, which using other method won't reproduce or solve the issue.
– Geno Chen
Mar 11 at 17:00
Don't aggress with downvoted. :et add the completed code, please run this project, I am able to run application with abobe code with any NPE.
– Sundeep Sharma
Mar 11 at 18:56
The hint of downvote is "This answer is not useful.", and it suits. The logcat and the code given by OP shows the code isn't complete, so writing any non-NPE code won't solve that question at all (so this is "not useful").
– Geno Chen
Mar 12 at 2:23
Accepted Geno, you are right
– Sundeep Sharma
Mar 12 at 22:31
add a comment |
Downvoted: absolutely not the fix of the question.
– Geno Chen
Mar 11 at 16:41
See the last "Caused by" of the stacktrace, the call toreadLine()
for aDataInputStream
insideSendCredentials
lies in line 69 ofMainActivity.java
immediately generate NPE, but that call was missing in the code provided by OP, then OP must be missing the core code, which using other method won't reproduce or solve the issue.
– Geno Chen
Mar 11 at 17:00
Don't aggress with downvoted. :et add the completed code, please run this project, I am able to run application with abobe code with any NPE.
– Sundeep Sharma
Mar 11 at 18:56
The hint of downvote is "This answer is not useful.", and it suits. The logcat and the code given by OP shows the code isn't complete, so writing any non-NPE code won't solve that question at all (so this is "not useful").
– Geno Chen
Mar 12 at 2:23
Accepted Geno, you are right
– Sundeep Sharma
Mar 12 at 22:31
Downvoted: absolutely not the fix of the question.
– Geno Chen
Mar 11 at 16:41
Downvoted: absolutely not the fix of the question.
– Geno Chen
Mar 11 at 16:41
See the last "Caused by" of the stacktrace, the call to
readLine()
for a DataInputStream
inside SendCredentials
lies in line 69 of MainActivity.java
immediately generate NPE, but that call was missing in the code provided by OP, then OP must be missing the core code, which using other method won't reproduce or solve the issue.– Geno Chen
Mar 11 at 17:00
See the last "Caused by" of the stacktrace, the call to
readLine()
for a DataInputStream
inside SendCredentials
lies in line 69 of MainActivity.java
immediately generate NPE, but that call was missing in the code provided by OP, then OP must be missing the core code, which using other method won't reproduce or solve the issue.– Geno Chen
Mar 11 at 17:00
Don't aggress with downvoted. :et add the completed code, please run this project, I am able to run application with abobe code with any NPE.
– Sundeep Sharma
Mar 11 at 18:56
Don't aggress with downvoted. :et add the completed code, please run this project, I am able to run application with abobe code with any NPE.
– Sundeep Sharma
Mar 11 at 18:56
The hint of downvote is "This answer is not useful.", and it suits. The logcat and the code given by OP shows the code isn't complete, so writing any non-NPE code won't solve that question at all (so this is "not useful").
– Geno Chen
Mar 12 at 2:23
The hint of downvote is "This answer is not useful.", and it suits. The logcat and the code given by OP shows the code isn't complete, so writing any non-NPE code won't solve that question at all (so this is "not useful").
– Geno Chen
Mar 12 at 2:23
Accepted Geno, you are right
– Sundeep Sharma
Mar 12 at 22:31
Accepted Geno, you are right
– Sundeep Sharma
Mar 12 at 22:31
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55055666%2fi-keep-getting-a-error-when-i-execute-the-send-credentials-void%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Where is your line 69? You missed many things.
– Geno Chen
Mar 11 at 16:39
I believe many of your work have been removed from this question, after the third
println("Work")
. Please add them all. Besides, it is better to useandroid.util.Log
instead ofSystem.out.println
.– Geno Chen
Mar 11 at 16:47