Peepaal

Continuous Community Learning

I am facing this error..your application XXX has stopped unexpectedly.please try again...My application was working all fine but suddenly I started getting this error..I read online about the adb logcat..but I could not make out where the error is...

 

Secondly..I was trying to add a button but when i click it the code does not get executed...

Have i gone wrong while coding because it does show any errors...

 

AsyncHttp.java(my project name)

Button buttonSend = (Button)findViewById(R.id.send);
        buttonSend.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                // Perform action on click
                //text.setText("in click listener");
                    Handler handler = new Handler() {};
                                new HttpConnection(handler)
                                .get("http://10.0.0.2:8090/UriExample/rest/hello/abc");
           
            }
        });


main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <Button
 android:id="@+id/send"
 android:layout_width="fill_parent"
 android:layout_height="wrap_content"
 android:text="Send"
 />
   
    <ImageView android:id="@+id/icon" android:layout_width="wrap_content"
        android:layout_height="wrap_content"></ImageView>
    <ScrollView android:layout_width="fill_parent"
        android:layout_height="fill_parent">
        <TextView android:id="@+id/text" android:layout_width="wrap_content"
            android:layout_height="wrap_content" android:textColor="#FFFFFF" />
    <TextView android:id="@+id/text1" android:layout_width="wrap_content"
            android:layout_height="wrap_content" android:textColor="#FFFFFF" />
   
    </ScrollView>
   
   
</LinearLayout>

 

 

It may be a very silly question but help will be appreciated....I have attached the screenshot of the first error...

 

Thanking You,

Nazneen

Tags: Android

Views: 76

Attachments:

Reply to This

Replies to This Discussion

Hi Nazneen,

Could you please send me the logcat's snapshot too?

Maybe there's some permission that needs to be added.

 

Thanks and Regards,

Nikhil

it requires Internet permission when you want to connect to any network part.
Thought that would be the prob :)

Shrenik Vikam said:
it requires Internet permission when you want to connect to any network part.

in the sense..?? in androidManifest.xml??

Yeh you need to give in AndroidMenfest.XML
Also the way you have used handler in above code is not correct, please refer to documentation.

Sir,

The permission I have added in AndroidManifest.xml...I had written it...But the error went..and I have no idea how..I just started the program all over again and the error went...But as you said the handler is wrong...I had tried this code before referring the documentation...bt it did not work so went ahead tryn this change..original code was..

Handler handler = new Handler();       
                    new HttpConnection(handler).get("http://10.0.0.2:8090/UriExample/rest/hello/abc");

Is this wrong too???

sry to bother yall..but im getting stuck with these small errors...

I will suggest to go through following link first 

http://developer.android.com/reference/android/os/Handler.html

http://saigeethamn.blogspot.com/2010/04/threads-and-handlers-androi...

 

Is that your first android program ?

yes it is...thank u will go thr d links...The thing is i have to write to a file on the server on the click of the button...i will go thr  the links..Thank You!!
im extremely sry..completely missed the message part...Thank you for ur help!!
The second link is not working!!

Reply to Discussion

RSS

© 2012   Created by Kaushik.

Badges  |  Report an Issue  |  Terms of Service