Android Forums

Go Back   These FORUMS ARE DISABLED!! OUR NEW FORUMS ARE AT http://androidforum.com/ > Android Coders > Android Development, Answers, Tutorials, and Code Snippets
Connect with Facebook

Click Here To Register!
 
 
LinkBack Thread Tools Display Modes
Old 01-15-2010, 06:19 PM   #1
Junior Member
 
Join Date: Jan 2010
Posts: 0
Friends: 0
View jelly's Profile   View jelly's Photo Album   View jelly's Blog   View Social Groups
this is kinda a dumb question but for some reason I cant get my extend Layout class to work. If you have any idea what im doing wrong please lemme know.
__________________________________________________ _____________
<?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"
>
<EditText
android:id="@+id/editText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
></EditText>
<Button
android:id="@+id/clearButton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Clear"
></Button>
<TextView
android:id="@+id/textView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
</LinearLayout>
__________________________________________________ _______
package com.paad.reset2;

import android.app.Activity;
import android.os.Bundle;

public class reset2 extends Activity {
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
}

}
__________________________________________________ ______

package com.paad.reset2;


import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;

public class ClearableEditText extends LinearLayout {

EditText editText;
Button clearButton;
public ClearableEditText(Context context) {
super(context);

// Get a reference to the LayoutInflater Service
String infService = Context.LAYOUT_INFLATER_SERVICE;
LayoutInflater li = (LayoutInflater)getContext().getSystemService(infS ervice);

// Inflate the view from the layout resource
li.inflate(R.layout.main, this, true);

// Get references to the child controls
editText = (EditText)findViewById(R.id.editText);
clearButton = (Button)findViewById(R.id.clearButton);

// Hook up the functionality
hookupButton();
}

private void hookupButton() {
clearButton.setOnClickListener(new Button.OnClickListener() {

public void onClick(View v) {
editText.setText("");
}
});
}

}

thanks
jelly is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in Technorati
 

Thread Tools
Display Modes




Unlocked G1 Phones | Buy T-Mobile G1 | Google Phone

All times are GMT -6. The time now is 05:02 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.
Copyright (c) 2012 TalkAndroid.com. All rights reserved.