If I provide Imageview, please tell me, what I have to do then. How
can I
represent the Image id in the activity code. Please tell me clearly.

On Aug 8, 2:40 pm, abhay chavan <[email protected]> wrote:
> Please provide Imageview In the xml Layout file
>
> On Mon, Aug 8, 2011 at 2:35 AM, Divya <[email protected]> wrote:
> > 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.
>
> > Thankyou
>
> > 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*OnMon, 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:
>
> ...
>
> 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