sure...

package draw.tab;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;

public class TestUIActivity extends Activity implements
OnClickListener {

        /**  Called when the activity is first created. */

        @Override
    public void onCreate(Bundle savedInstanceState)
        {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);//frame

        Button sSquare=(Button)this.findViewById(R.id.getSquare);
        sSquare.setOnClickListener(this);
        Button sCircle=(Button)this.findViewById(R.id.getCircle);
        sCircle.setOnClickListener(this);
        }

        public void onClick(View v)
        {
                switch(v.getId())
                {
                case R.id.getSquare:
                        ImageView imageView = (ImageView) 
findViewById(R.id.getSquare);
                        imageView.setImageResource(R.drawable.square);
                        break;

                case R.id.getCircle:
                        ImageView i=(ImageView)findViewById(R.id.getCircle);
                        i.setImageResource(R.drawable.circle);
                        break;
                }
        }
        {
                try{
                    throw new Exception();
                }
                catch(Exception e)
                {
                        Log.e("DEBUGTAG","error occured",e);
                        Log.i("UserInterface","UILogCat",e);
                }
        }
}


main.xml


<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
    android:orientation="horizontal"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    >

    <Button
    android:id="@+id/getSquare"
    android:layout_width="160dp"
    android:layout_height="wrap_content"
    android:text="SQUARE"/>

    <Button
    android:id="@+id/getCircle"
    android:layout_width="160dp"
    android:layout_height="wrap_content"
    android:text="CIRCLE"/>

</LinearLayout>

The above is my whole coding and I have .png images in the drawable
folder.

Thank you

On Aug 8, 2:25 pm, Kumar Bibek <[email protected]> wrote:
> Can you also post some code? Looks like the problem is in your UserInterface
> class at line 214.
>
> *Thanks and Regards,
> Kumar Bibek*
> *http://techdroid.kbeanie.comhttp://www.kbeanie.com*
>
> On Mon, Aug 8, 2011 at 2:53 PM, Divya <[email protected]> wrote:
> > LogCat errors are
>
> > 08-08 14:53:04.101: ERROR/DEBUGTAG(214): error occured
> > 08-08 14:53:04.101: ERROR/DEBUGTAG(214): java.lang.Exception
> > 08-08 14:53:04.101: ERROR/DEBUGTAG(214):     at
> > draw.tab.TestUIActivity.<init>(TestUIActivity.java:44)
> > 08-08 14:53:04.101: ERROR/DEBUGTAG(214):     at
> > java.lang.Class.newInstanceImpl(Native Method)
> > 08-08 14:53:04.101: ERROR/DEBUGTAG(214):     at
> > java.lang.Class.newInstance(Class.java:1479)
> > 08-08 14:53:04.101: ERROR/DEBUGTAG(214):     at
> > android.app.Instrumentation.newActivity(Instrumentation.java:1021)
> > 08-08 14:53:04.101: ERROR/DEBUGTAG(214):     at
> > android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
> > 2409)
> > 08-08 14:53:04.101: ERROR/DEBUGTAG(214):     at
> > android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
> > 2512)
> > 08-08 14:53:04.101: ERROR/DEBUGTAG(214):     at
> > android.app.ActivityThread.access$2200(ActivityThread.java:119)
> > 08-08 14:53:04.101: ERROR/DEBUGTAG(214):     at
> > android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
> > 08-08 14:53:04.101: ERROR/DEBUGTAG(214):     at
> > android.os.Handler.dispatchMessage(Handler.java:99)
> > 08-08 14:53:04.101: ERROR/DEBUGTAG(214):     at
> > android.os.Looper.loop(Looper.java:123)
> > 08-08 14:53:04.101: ERROR/DEBUGTAG(214):     at
> > android.app.ActivityThread.main(ActivityThread.java:4363)
> > 08-08 14:53:04.101: ERROR/DEBUGTAG(214):     at
> > java.lang.reflect.Method.invokeNative(Native Method)
> > 08-08 14:53:04.101: ERROR/DEBUGTAG(214):     at
> > java.lang.reflect.Method.invoke(Method.java:521)
> > 08-08 14:53:04.101: ERROR/DEBUGTAG(214):     at
> > com.android.internal.os.ZygoteInit
> > $MethodAndArgsCaller.run(ZygoteInit.java:860)
> > 08-08 14:53:04.101: ERROR/DEBUGTAG(214):     at
> > com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
> > 08-08 14:53:04.101: ERROR/DEBUGTAG(214):     at
> > dalvik.system.NativeStart.main(Native Method)
>
> > Logcat Information
>
> > 08-08 14:53:04.191: INFO/UserInterface(214): UILogCat
> > 08-08 14:53:04.191: INFO/UserInterface(214): java.lang.Exception
> > 08-08 14:53:04.191: INFO/UserInterface(214):     at
> > draw.tab.TestUIActivity.<init>(TestUIActivity.java:44)
> > 08-08 14:53:04.191: INFO/UserInterface(214):     at
> > java.lang.Class.newInstanceImpl(Native Method)
> > 08-08 14:53:04.191: INFO/UserInterface(214):     at
> > java.lang.Class.newInstance(Class.java:1479)
> > 08-08 14:53:04.191: INFO/UserInterface(214):     at
> > android.app.Instrumentation.newActivity(Instrumentation.java:1021)
> > 08-08 14:53:04.191: INFO/UserInterface(214):     at
> > android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
> > 2409)
> > 08-08 14:53:04.191: INFO/UserInterface(214):     at
> > android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
> > 2512)
> > 08-08 14:53:04.191: INFO/UserInterface(214):     at
> > android.app.ActivityThread.access$2200(ActivityThread.java:119)
> > 08-08 14:53:04.191: INFO/UserInterface(214):     at
> > android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
> > 08-08 14:53:04.191: INFO/UserInterface(214):     at
> > android.os.Handler.dispatchMessage(Handler.java:99)
> > 08-08 14:53:04.191: INFO/UserInterface(214):     at
> > android.os.Looper.loop(Looper.java:123)
> > 08-08 14:53:04.191: INFO/UserInterface(214):     at
> > android.app.ActivityThread.main(ActivityThread.java:4363)
> > 08-08 14:53:04.191: INFO/UserInterface(214):     at
> > java.lang.reflect.Method.invokeNative(Native Method)
> > 08-08 14:53:04.191: INFO/UserInterface(214):     at
> > java.lang.reflect.Method.invoke(Method.java:521)
> > 08-08 14:53:04.191: INFO/UserInterface(214):     at
> > com.android.internal.os.ZygoteInit
> > $MethodAndArgsCaller.run(ZygoteInit.java:860)
> > 08-08 14:53:04.191: INFO/UserInterface(214):     at
> > com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
> > 08-08 14:53:04.191: INFO/UserInterface(214):     at
> > dalvik.system.NativeStart.main(Native Method)
>
> > 08-08 14:56:20.301: INFO/Process(214): Sending signal. PID: 214 SIG: 9
> > 08-08 14:56:20.351: INFO/ActivityManager(51): Process draw.tab (pid
> > 214) has died.
> > 08-08 14:56:20.370: INFO/WindowManager(51): WIN DEATH: Window{44d7dde8
> > draw.tab/draw.tab.TestUIActivity paused=false}
> > 08-08 14:56:20.391: INFO/UsageStats(51): Unexpected resume of
> > com.android.launcher while already resumed in draw.tab
> > 08-08 14:56:20.541: ERROR/gralloc(51): [unregister] handle 0x468598
> > still locked (state=40000001)
> > 08-08 14:56:20.580: WARN/InputManagerService(51): Got RemoteException
> > sending setActive(false) notification to pid 214 uid 10030
> > 08-08 14:56:20.790: INFO/ActivityManager(51): Displayed activity
> > com.android.launcher/.Launcher: 220866 ms (total 220866 ms)
> > 08-08 14:56:26.550: DEBUG/AndroidRuntime(230): >>>>>>>>>>>>>>
> > AndroidRuntime START <<<<<<<<<<<<<<
> > 08-08 14:56:26.550: DEBUG/AndroidRuntime(230): CheckJNI is ON
> > 08-08 14:56:26.800: DEBUG/AndroidRuntime(230): --- registering native
> > functions ---
> > 08-08 14:56:27.252: DEBUG/ddm-heap(230): Got feature list request
> > 08-08 14:56:27.701: DEBUG/AndroidRuntime(230): Shutting down VM
> > 08-08 14:56:27.701: DEBUG/dalvikvm(230): DestroyJavaVM waiting for non-
> > daemon threads to exit
> > 08-08 14:56:27.701: DEBUG/dalvikvm(230): DestroyJavaVM shutting VM
> > down
> > 08-08 14:56:27.701: DEBUG/dalvikvm(230): HeapWorker thread shutting
> > down
> > 08-08 14:56:27.711: DEBUG/dalvikvm(230): HeapWorker thread has shut
> > down
> > 08-08 14:56:27.711: DEBUG/jdwp(230): JDWP shutting down net...
> > 08-08 14:56:27.711: INFO/dalvikvm(230): Debugger has detached; object
> > registry had 1 entries
> > 08-08 14:56:27.720: DEBUG/dalvikvm(230): VM cleaning up
> > 08-08 14:56:27.741: ERROR/AndroidRuntime(230): ERROR: thread attach
> > failed
> > 08-08 14:56:27.741: DEBUG/dalvikvm(230): LinearAlloc 0x0 used 629532
> > of 5242880 (12%)
> > 08-08 14:56:28.271: DEBUG/AndroidRuntime(238): >>>>>>>>>>>>>>
> > AndroidRuntime START <<<<<<<<<<<<<<
> > 08-08 14:56:28.281: DEBUG/AndroidRuntime(238): CheckJNI is ON
> > 08-08 14:56:28.541: DEBUG/AndroidRuntime(238): --- registering native
> > functions ---
> > 08-08 14:56:28.970: DEBUG/ddm-heap(238): Got feature list request
> > 08-08 14:56:29.441: INFO/ActivityManager(51): Starting activity:
> > Intent { act=android.intent.action.MAIN
> > cat=[android.intent.category.LAUNCHER] flg=0x10000000
> > cmp=draw.tab/.TestUIActivity }
> > 08-08 14:56:29.501: DEBUG/AndroidRuntime(238): Shutting down VM
> > 08-08 14:56:29.510: DEBUG/dalvikvm(238): DestroyJavaVM waiting for non-
> > daemon threads to exit
> > 08-08 14:56:29.521: ERROR/AndroidRuntime(238): ERROR: thread attach
> > failed
> > 08-08 14:56:29.521: DEBUG/dalvikvm(238): DestroyJavaVM shutting VM
> > down
> > 08-08 14:56:29.531: DEBUG/dalvikvm(238): HeapWorker thread shutting
> > down
> > 08-08 14:56:29.531: DEBUG/dalvikvm(238): HeapWorker thread has shut
> > down
> > 08-08 14:56:29.562: DEBUG/jdwp(238): JDWP shutting down net...
> > 08-08 14:56:29.562: INFO/dalvikvm(238): Debugger has detached; object
> > registry had 1 entries
> > 08-08 14:56:29.581: DEBUG/dalvikvm(238): VM cleaning up
> > 08-08 14:56:29.600: DEBUG/dalvikvm(238): LinearAlloc 0x0 used 639500
> > of 5242880 (12%)
> > 08-08 14:56:29.661: INFO/ActivityManager(51): Start proc draw.tab for
> > activity draw.tab/.TestUIActivity: pid=245 uid=10030 gids={}
> > 08-08 14:56:29.842: DEBUG/ddm-heap(245): Got feature list request
> > 08-08 14:56:29.970: INFO/ARMAssembler(51): generated
> > scanline__00000177:03515104_00000001_00000000 [ 73 ipp] (95 ins) at
> > [0x52cd48:0x52cec4] in 774926 ns
> > 08-08 14:56:30.100: INFO/ARMAssembler(51): generated
> > scanline__00000077:03545404_00000004_00000000 [ 47 ipp] (67 ins) at
> > [0x52cec8:0x52cfd4] in 543272 ns
> > 08-08 14:56:30.541: DEBUG/dalvikvm(51): GREF has increased to 301
> > 08-08 14:56:30.670: INFO/ActivityManager(51): Displayed activity
> > draw.tab/.TestUIActivity: 1178 ms (total 1178 ms)
> > 08-08 14:56:35.850: DEBUG/dalvikvm(106): GC freed 1351 objects / 67632
> > bytes in 104ms
>
> > Please help me to solve the above.
>
> > Thank you,
> > Divya
>
> > On Aug 8, 12:42 pm, Kumar Bibek <[email protected]> wrote:
> > > You cannot Debug into the Android classes with a normal setup. Post some
> > > error logs from your Logcat.
>
> > > *Thanks and Regards,
> > > Kumar Bibek*
> > > *http://techdroid.kbeanie.comhttp://www.kbeanie.com*
>
> > > On Mon, Aug 8, 2011 at 1:09 PM, Divya <[email protected]> wrote:
> > > > hi
>
> > > > I did what you said. But now too am receiving the same 'force close'
> > > > error,
> > > > the same errors that I mentioned above. The android API are included
> > > > in the
> > > > SDK download and the source code is also on the eclipse build path.
>
> > > > I received 'Source Not Found' error while debugging. There is no
> > > > source
> > > > attachment  for an android jar file in java build path. So it asked to
> > > > attach source
> > > > for that jar file. Though I attached source, it is not saved. Again it
> > > > shows 'source
> > > > attachment (None)'.
>
> > > > Please help me to get it solved.
>
> > > > On Aug 8, 10:33 am, Ratheesh Valamchuzhy <[email protected]> wrote:
> > > > > hi
>
> > > > > I didn't get your points correctly ...  i hope you install android
> > > > correctly
> > > > > and made the setup ,
> > > > > do the following
>
> > > > > Create a new android project and copy the code
> > > > > make the xml file corresponding to the resources
> > > > > and try to run
>
> > > > > check  the following
>
> > > > > The sources of the Android API are  included in the SDK download
>
> > > > > Check your eclipse build path if the folder, that contains you source
> > > > code
> > > > > is really on the defined build path.
> > > > > thanks
> > > > > Ratheesh
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > > > Groups "Android Developers" group.
> > > > To post to this group, send
>
> ...
>
> read more »

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to