Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid interfacing
    primarykey
    data
    text
    <p>I always have this problem of <code>java.lang.IllegalStateException:Could not execute method of the activity</code>. I was planning to perform an android component event (ex. Button event - indicating the number of times this button was clicked). Here's the code snippet for this problem: </p> <pre><code>interface Selection { public void clicked(); } public class ParentClass extends FragmentActivity { // fTabs : FragmentTabHost // tabs : Map&lt;String, Selection&gt; private void initialize() { // fistFrag : FirstChildClass = new FirstChildClass() // secondFrag : SecondChildClass = new SecondChildClass() tabs.put("first", firstFrag); tabs.put("second", secondFrag); fTabs.add(fTab.newTabSpec("first").setTitle("First"), firstFrag.getClass(), null) fTabs.add(fTab.newTabSpec("second").setTitle("Second"), secondFrag.getClass(), null) } @Override public void onBackPressed() { tabs.get(fTabHost.getCurrentTabTag()).clicked(); } } public class FirstChildClass extends Fragment implements Selection { // data : TextView // hit : int = 0 @Override public void clicked() { data.setText(String.format("Hit Count: %d", ++hit)); } } public class SecondChildClass extends Fragment implements Selection { // data : TextView // hit : int = 0 @Override public void clicked() { data.setText(String.format("Hit Count: %d", ++hit)); } } </code></pre> <p>I've tried to assure of <code>clicked()</code> works view interfacing approach by invoking a message on <code>Logcat</code> and it worked but when I used <code>Button</code> the error above always prompts me. I've checked if <code>data</code> is null and it returned <code>true</code>. I am a little bit confused, I've tried to check nullity of <code>data</code> from the <code>Activity</code> methods is returns <code>false</code> but when I access any method override by an interface it always return <code>true</code>. Is there a way to solve this?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload