Log.i("iconTextElement", "clicked");
output in my LogCat Console but also - no error!
main xml:
Using xml Syntax Highlighting
- <?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"
- >
- <com.airwriting.android.tests.IconTextMenuView id="@+id/icontextmenu1"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- />
- </LinearLayout>
Parsed in 0.002 seconds, using GeSHi 1.0.8.4
my starter class text
Using java Syntax Highlighting
- package com.airwriting.android.tests;
- import android.app.Activity;
- import android.os.Bundle;
- import android.util.Log;
- import android.view.View;
- import android.view.View.OnClickListener;
- public class Test extends Activity {
- /** Called when the activity is first created. */
- @Override
- public void onCreate(Bundle icicle) {
- super.onCreate(icicle);
- setContentView(R.layout.main);
- IconTextMenuView iconTextMenuView = (IconTextMenuView) findViewById(R.id.icontextmenu1);
- iconTextMenuView.setOnClickListener(clickListener);
- }
- OnClickListener clickListener = new OnClickListener() {
- public void onClick(View v) {
- Log.i("iconTextElement", "clicked");
- }
- };
- }
Parsed in 0.033 seconds, using GeSHi 1.0.8.4
and now the iconTextMenuView
Using java Syntax Highlighting
- package com.airwriting.android.tests;
- import java.util.Map;
- import android.content.Context;
- import android.graphics.Typeface;
- import android.util.AttributeSet;
- import android.util.Log;
- import android.view.View;
- import android.widget.ImageView;
- import android.widget.LinearLayout;
- import android.widget.TextView;
- /**
- * adapted from plusminus by sommeralex <img src="http://www.anddev.org/images/smilies/wink.png" alt=";-)" title="Wink" />
- */
- public class IconTextMenuView extends LinearLayout implements android.view.View.OnClickListener {
- // ===========================================================
- // Fields
- // ===========================================================
- ;
- private ImageView menuIcon = null;
- private TextView menuText = null;
- // ===========================================================
- // Constructors
- // ===========================================================
- public IconTextMenuView(Context context) {
- super(context);
- }
- public IconTextMenuView(Context context, AttributeSet attrs,
- Map inflateParams) {
- super(context, attrs, inflateParams);
- Log.i("Wf", "icon created");
- this.setOnClickListener(this);
- /* Setup the ImageView that will show weather-icon. */
- this.menuIcon = new ImageView(context);
- this.menuIcon.setImageDrawable(getResources().getDrawable(
- R.drawable.dunno));
- /* Setup the textView that will show the temperature. */
- this.menuText = new TextView(context);
- this.menuText.setText("menuText");
- this.menuText.setTextSize(8);
- this.menuText.setTypeface(Typeface
- .create("Tahoma", Typeface.BOLD));
- /* Add child views to this object. */
- this.addView(this.menuIcon, new LinearLayout.LayoutParams(
- LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
- this.addView(this.menuText, new LinearLayout.LayoutParams(
- LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
- }
- public void onClick(View arg0) {
- // TODO Auto-generated method stub
- Log.i("InnerListenerOfofIconTextMenu", "clicked");
- }
- }
Parsed in 0.038 seconds, using GeSHi 1.0.8.4
nor the InnerListenerOfIconTextMenu "clicked" info comes when i click on it, nor the outer listener i set in the test activity (Log.i("iconTextElement", "clicked"); )


