Skip to content Skip to sidebar Skip to footer

From One Activity Create Multiple Intents Which Point To Different Activities Gives A Nullpointer Exception

Can I do sth like that? public void onClick(View v) { switch (v.getId()){ case R.id.btn: edit11=edit1.getText().toString(); edit22=edit2.g

Solution 1:

You cannot start your HttpClient in the main UI thread. You must create another Thread/Runnable in which to run your httpClient. In addition to your NullPointerException (once you solve that), you are going to receive a android.os.NetworkOnMainThreadException.

Move the httpClient into a Runnable to fix part of your problem.

In order to fix the NullPointerException, we need to see the LogCat showing the file and line number in which it occurs. You must post the line of code at that line number, because we cannot see line numbers in the question.

Solution 2:

Ok, the problem was that I had the code_value string before the oncreate.Moved it and its ojk now.

Post a Comment for "From One Activity Create Multiple Intents Which Point To Different Activities Gives A Nullpointer Exception"