• Register
0 votes

Problem :

I have the below Activity class it contains the following:

public class TestFirstActivity extends Activity { 
public void onFirstCreate(Bundle savedFirstInstanceState) {

When I try to run this on my mobile device I get the below error:

SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length

I have tried above code with and without the TextView but the error still remains, I must be doing something fundamentally very wrong for such a basic layout to cause this error.

Does anyone have any clue on how I can get this to load without the above error?

6 5 3
7,540 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

To try to debug your error, first you should go to your android terminal / console and then execute below command:


After this if the output comes out as your app then certainly it is your app which is causing the error. Try to look for empty Strings that you have passed into the layout.

I had this exact same problem in the past and it was my fault as I was passing the empty String into my then layout. After changing my "" to " " above error went away.


Hope this will help you in resolving your issue.

9 7 4
38,600 points

Related questions

0 votes
1 answer 1.2K views
Problem : I am trying to learn Android programming also I am trying to develop a very basic weather app. My code works perfectly if I try to enter any valid city name. But I want to use the toast and it shows me the error and also to the ... .nextCleanInternal(JSONTokener.java:116) at org.json.JSONTokener.nextValue(JSONTokener.java:94) at org.json.JSONObject. How can I fix the above error?
asked Feb 14, 2020 mphil 2.3k points
0 votes
1 answer 3 views
Problem: I am trying to use setOnItemClickListener on the spinner, is it permissible? setonitemclicklistener cannot be used with a spinner.
asked Mar 24 ummesalma 24.5k points
0 votes
1 answer 3 views
Problem: I'll make a submission for a response to my question. I've looked on the internet but haven't found anything useful. Now I'm having trouble. Help is much appreciated.
asked Apr 3 salim1 34.8k points
0 votes
1 answer 6 views
Problem: Help! I am getting stucked with the following problem>error: attempt to use zero-length variable name.
asked Apr 3 ashik 11.2k points
0 votes
1 answer 22 views
Problem: I use this python shell to generate a string: >>>':'.join("{:x}\n".format(random.randint(0, 2**16 - 1)) for i in range(4)) When I run this shell in Python2.7.5, everything goes okay. But it occurs ValueError: zero length field name in format when Python version is 2.6.6. What should I run this shell fine when Python version is 2.6.6?
asked Feb 17 Mashhoodch 13k points
0 votes
1 answer 10 views
Problem: public boolean clearSelection() { int i = 0; if (!this.m_SelectedComps.isEmpty()) { i = 1; Iterator localIterator = this.m_SelectedComps.iterator(); while (localIterator.hasNext()) ((AnnotComponent) localIterator.next()).remove(); this.m_SelectedComps.clear(); } return i; } Please HELP! How to convert the integer to boolean?
asked Mar 5 neeraj 9.5k points
0 votes
2 answers 379 views
Problem : Currently I am working on my app for Android but I am getting following error while working with the SharedPreferences. I am very new to Android App Programming. I am trying to debug it from past 2 days but unable to find the solution ... " android:inputType="number" android:key="capitalownership" android:title="@string/capitalownership" /> Can somebody help me in resolving this error?
asked Feb 17, 2020 mphil 2.3k points
0 votes
1 answer 2 views
Problem: Now, doesnt it work this way: If I have a try and catch block in the method itself then I need not write method_name(int n) throws Exception?
asked 1 day ago ummesalma 24.5k points