Forum     

Go Back   Digit Technology Discussion Forum > Software > Programming
Register FAQ Calendar Mark Forums Read

Programming The destination for developers - C, C++, Java, Python and the lot


Reply
 
LinkBack Thread Tools Display Modes
Old 22-08-2011, 08:49 PM   #1 (permalink)
Wise Old Owl
 
speedyguy's Avatar
 
Join Date: Aug 2004
Location: Bangalore/Jamshedpur
Posts: 1,173
Default Android : Call Inner class function. Not working


I need to call an inner class method from outer class. The following code i have written which shows no error but on runtime it throws android error box asking me to force close. I need inner class as i want to extend a class for its method. Is there anyway? Where am i going wrong

Thanks



public class ListtestActivity extends Activity {
/** Called when the activity is first created. */

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
new sub1().called();
}

public static class sub1 extends ListActivity
{
public void called()
{
final String[] COUNTRIES = new String[] {"arya","suhail","gogu"};
/*
int i = 0;
File fileList = new File("/sdcard");
if (fileList != null){
File[] filenames = fileList.listFiles();
for (File tmpf : filenames){
String fname = tmpf.getName();
COUNTRIES[i++]=fname;
}
} */

setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, COUNTRIES));

ListView lv = getListView();
lv.setTextFilterEnabled(true);

lv.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
// When clicked, show a toast with the TextView text
Toast.makeText(getApplicationContext(), ((TextView) view).getText(),
Toast.LENGTH_SHORT).show();
}
});
}
}

}
__________________
No Pain...No Gain
speedyguy is offline   Reply With Quote
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


 
Latest Threads
- by Charan
- by Sarath
- by clmlbx

Advertisement




All times are GMT +5.5. The time now is 12:33 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2