Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 21 of 21

Thread: Installed Android program which I created bombs out

  1. #1
    Junior Member
    Join Date
    Jul 2013
    Posts
    16
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Default Installed Android program which I created bombs out

    Hi.

    I'm taking a chance to post here, and I really hope someone would be able to assist me

    It is my first android app.

    I have created a very small android app. Basically it consists of a listview with two buttons:
    The listview shows our courses. Once clicked, it shows the contents of each course
    One button allows me to download a brochure
    the other button opens up a form where the user can enter his / her details in order for us to be able to contact him / her

    Nothing complicated.

    Now I have debugged this app over and over to ensure everything will work fine.
    On my AVD ( Samsung Galaxy SII ) everything works smoothly

    So, I exported the release build with its signed key, and made it available for download from my website - not the google play store, as I want to gradually release it onto different platforms depending on the amount of downloads I get.

    Right, so I download it and installed it on my phone ( Galaxy S II ) all 284 KB of it.
    When I attempt to run it, my phone says that the app has stopped working and I must Force Close it.

    What can it be?

    I know this question seems vague, but perhaps there is a step I have missed.

    Any guidance will be welcomed.

    --- Update ---

    OK, I managed to install this program onto a Samsung Galaxy S4. It works without any problems.

    So, I did some research on the internet and I was told that I should make my minSdkVersion and targetSdkVersion the same. I made them both 9 ( for Gingerbread ), and made the TargetApi :

    @TargetApi(Build.VERSION_CODES.GINGERBREAD)

    Still it doesn't work on my Samsung Galaxy S2

    There is hope, but I do not know how to make this app more compatible with earlier Samsung ( android ) versions

    Any advice?


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Installed Android program which I created bombs out

    What do you mean when you say it doesn't work? What Android version is that device running?
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. The Following User Says Thank You to KevinWorkman For This Useful Post:

    HanneSThEGreaT (July 3rd, 2013)

  4. #3
    Junior Member
    Join Date
    Jul 2013
    Posts
    16
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Default Re: Installed Android program which I created bombs out

    Thanks for taking the time to answer my question.

    As mentioned in my first post :

    "When I attempt to run it, my phone says that the app has stopped working and I must Force Close it."

    My device is running Gingerbread - Android version 2.3.4

    I did target Gingerbread in my code.

    This app works perfectly on Samsung Galaxy S 4

    So I'm thinking that my target platform is wrong? But I do not know how to fix it

  5. #4
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,676
    Thanks
    25
    Thanked 329 Times in 305 Posts

    Default Re: Installed Android program which I created bombs out

    Have you tried running it in debug mode on your device (while your device is connected to your computer)? At the very least, you would be able to read the logcat output if you did that.
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/

  6. The Following 2 Users Say Thank You to aussiemcgr For This Useful Post:

    HanneSThEGreaT (July 3rd, 2013), KevinWorkman (July 3rd, 2013)

  7. #5
    Junior Member
    Join Date
    Jul 2013
    Posts
    16
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Default Re: Installed Android program which I created bombs out

    Quote Originally Posted by aussiemcgr View Post
    Have you tried running it in debug mode on your device (while your device is connected to your computer)? At the very least, you would be able to read the logcat output if you did that.
    How do I do that ? Sorry, I'm stupid

    I'm making use of the Samsung Galaxy SII AVD, and that has reported no errors.

  8. #6
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,676
    Thanks
    25
    Thanked 329 Times in 305 Posts

    Default Re: Installed Android program which I created bombs out

    What IDE are you using?
    I'm not sure of other IDEs, but with Eclipse all you have to do is open the DDMS perspective (which should show a logcat output window, as well as other things) and do the following below.

    You have to first set up your phone for debugging. On your phone, go to Settings > Applications > Development and check the USB debugging box. I think it will give you a warning prompt, but you can ignore it. Then plug your phone in to your computer with your USB cable. If your logcat is working properly, you should see all the output your phone logs in the IDE, even stuff not related to your application.
    Now run the android application from your IDE. Before the application starts, it should prompt you to choose your device. The prompt will include your virtual devices, as well as your phone. Select your phone and the application will download onto your phone. After it is done downloading, the application will start on your phone.
    You may be able to skip that last part and simply run the version already on your phone. I think it might log any information from your application to the logcat, since it logs information from every app on your phone.
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/

  9. The Following User Says Thank You to aussiemcgr For This Useful Post:

    HanneSThEGreaT (July 3rd, 2013)

  10. #7
    Junior Member
    Join Date
    Jul 2013
    Posts
    16
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Default Re: Installed Android program which I created bombs out

    Hi. I apologise for not mentioning my IDE earlier. I.am indeed using Eclipse. I will try your suggestion tomorrow morning. I did not know I could do that! I could have saved you all and myself a lot of trouble .

    Thanks for all your kind help thus far

    Hannes

  11. #8
    Junior Member
    Join Date
    Jul 2013
    Posts
    16
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Default Re: Installed Android program which I created bombs out

    log.txtOK I give UP!

    After wasting a whole day finding the freking OEMs for my phone and installing it, and setting up my Devices to run on my phone, I just get a whole lot of jargon in LogCat

    I feel completely out of my league here, cannot remember when last I felt so darn stupid.

    For those interested this is what my LogCat gives me - on the attachment.

    None of which makes any sense.

    I exited Eclipse after half an hour of waiting for my program to finally grace me with its presence on my phone, but it never even started on my phone.

    I don't know if I should go home and drink, or go home and cry

  12. #9
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,676
    Thanks
    25
    Thanked 329 Times in 305 Posts

    Default Re: Installed Android program which I created bombs out

    Well it probably won't start on your phone if it didn't beforehand. But we aren't looking at the log to see what happens after your application starts, we are looking to see what happens as it attempts to start.

    Is your project's namespace com.ver.ncc? If so, there are a handful of exceptions thrown in the log for that package, especially at 11:58:01.395 in the log. If that is your project, what is on line 103 in your FullscreenActivityNCC class?
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/

  13. The Following User Says Thank You to aussiemcgr For This Useful Post:

    HanneSThEGreaT (July 4th, 2013)

  14. #10
    Junior Member
    Join Date
    Jul 2013
    Posts
    16
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Default Re: Installed Android program which I created bombs out

    thanks for all your help. Yes. my namespace is com.ver.ncc
    Well by the looks of it line 103 is:

    Setcontentview(r.layout.activity_fullscreen_activi ty_ncc);

    The asing is not right because i am at home and typing on my phone. if that's not the line it is defonitely somewhere in oncreate. i'll send the full method tomorrow.

    I know it should be something small. out of my experienc.net it usually is.

    Thanks once again and thanks for your patience

    hannes

  15. #11
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,676
    Thanks
    25
    Thanked 329 Times in 305 Posts

    Default Re: Installed Android program which I created bombs out

    It seems to be some sort of error loading in a resource. Perhaps even a missing import or something. I'm not entirely sure. For everyone else watching this thread, here is the exception in the log which shows the problem:

    07-04 11:58:01.395: E/AndroidRuntime(7708): FATAL EXCEPTION: main
    07-04 11:58:01.395: E/AndroidRuntime(7708): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ver.ncc/com.ver.ncc.FullscreenActivityNCC}: android.view.InflateException: Binary XML file line #38: Error inflating class android.widget.LinearLayout
    07-04 11:58:01.395: E/AndroidRuntime(7708): at android.app.ActivityThread.performLaunchActivity(A ctivityThread.java:1651)
    07-04 11:58:01.395: E/AndroidRuntime(7708): at android.app.ActivityThread.handleLaunchActivity(Ac tivityThread.java:1667)
    07-04 11:58:01.395: E/AndroidRuntime(7708): at android.app.ActivityThread.access$1500(ActivityThr ead.java:117)
    07-04 11:58:01.395: E/AndroidRuntime(7708): at android.app.ActivityThread$H.handleMessage(Activit yThread.java:935)
    07-04 11:58:01.395: E/AndroidRuntime(7708): at android.os.Handler.dispatchMessage(Handler.java:99 )
    07-04 11:58:01.395: E/AndroidRuntime(7708): at android.os.Looper.loop(Looper.java:130)
    07-04 11:58:01.395: E/AndroidRuntime(7708): at android.app.ActivityThread.main(ActivityThread.jav a:3691)
    07-04 11:58:01.395: E/AndroidRuntime(7708): at java.lang.reflect.Method.invokeNative(Native Method)
    07-04 11:58:01.395: E/AndroidRuntime(7708): at java.lang.reflect.Method.invoke(Method.java:507)
    07-04 11:58:01.395: E/AndroidRuntime(7708): at com.android.internal.os.ZygoteInit$MethodAndArgsCa ller.run(ZygoteInit.java:907)
    07-04 11:58:01.395: E/AndroidRuntime(7708): at com.android.internal.os.ZygoteInit.main(ZygoteInit .java:665)
    07-04 11:58:01.395: E/AndroidRuntime(7708): at dalvik.system.NativeStart.main(Native Method)
    07-04 11:58:01.395: E/AndroidRuntime(7708): Caused by: android.view.InflateException: Binary XML file line #38: Error inflating class android.widget.LinearLayout
    07-04 11:58:01.395: E/AndroidRuntime(7708): at android.view.LayoutInflater.createView(LayoutInfla ter.java:518)
    07-04 11:58:01.395: E/AndroidRuntime(7708): at com.android.internal.policy.impl.PhoneLayoutInflat er.onCreateView(PhoneLayoutInflater.java:56)
    07-04 11:58:01.395: E/AndroidRuntime(7708): at android.view.LayoutInflater.createViewFromTag(Layo utInflater.java:568)
    07-04 11:58:01.395: E/AndroidRuntime(7708): at android.view.LayoutInflater.rInflate(LayoutInflate r.java:623)
    07-04 11:58:01.395: E/AndroidRuntime(7708): at android.view.LayoutInflater.rInflate(LayoutInflate r.java:626)
    07-04 11:58:01.395: E/AndroidRuntime(7708): at android.view.LayoutInflater.inflate(LayoutInflater .java:408)
    07-04 11:58:01.395: E/AndroidRuntime(7708): at android.view.LayoutInflater.inflate(LayoutInflater .java:320)
    07-04 11:58:01.395: E/AndroidRuntime(7708): at android.view.LayoutInflater.inflate(LayoutInflater .java:276)
    07-04 11:58:01.395: E/AndroidRuntime(7708): at com.android.internal.policy.impl.PhoneWindow.setCo ntentView(PhoneWindow.java:215)
    07-04 11:58:01.395: E/AndroidRuntime(7708): at android.app.Activity.setContentView(Activity.java: 1663)
    07-04 11:58:01.395: E/AndroidRuntime(7708): at com.ver.ncc.FullscreenActivityNCC.onCreate(Fullscr eenActivityNCC.java:103)
    07-04 11:58:01.395: E/AndroidRuntime(7708): at android.app.Instrumentation.callActivityOnCreate(I nstrumentation.java:1047)
    07-04 11:58:01.395: E/AndroidRuntime(7708): at android.app.ActivityThread.performLaunchActivity(A ctivityThread.java:1615)
    07-04 11:58:01.395: E/AndroidRuntime(7708): ... 11 more
    07-04 11:58:01.395: E/AndroidRuntime(7708): Caused by: java.lang.reflect.InvocationTargetException
    07-04 11:58:01.395: E/AndroidRuntime(7708): at java.lang.reflect.Constructor.constructNative(Nati ve Method)
    07-04 11:58:01.395: E/AndroidRuntime(7708): at java.lang.reflect.Constructor.newInstance(Construc tor.java:415)
    07-04 11:58:01.395: E/AndroidRuntime(7708): at android.view.LayoutInflater.createView(LayoutInfla ter.java:505)
    07-04 11:58:01.395: E/AndroidRuntime(7708): ... 23 more
    07-04 11:58:01.395: E/AndroidRuntime(7708): Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x2/d=0x10102fd a=-1}
    07-04 11:58:01.395: E/AndroidRuntime(7708): at android.content.res.Resources.loadDrawable(Resourc es.java:1907)
    07-04 11:58:01.395: E/AndroidRuntime(7708): at android.content.res.TypedArray.getDrawable(TypedAr ray.java:653)
    07-04 11:58:01.395: E/AndroidRuntime(7708): at android.view.View.<init>(View.java:1961)
    07-04 11:58:01.395: E/AndroidRuntime(7708): at android.view.View.<init>(View.java:1909)
    07-04 11:58:01.395: E/AndroidRuntime(7708): at android.view.ViewGroup.<init>(ViewGroup.java:286)
    07-04 11:58:01.395: E/AndroidRuntime(7708): at android.widget.LinearLayout.<init>(LinearLayout.ja va:120)
    07-04 11:58:01.395: E/AndroidRuntime(7708): ... 26 more
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/

  16. The Following User Says Thank You to aussiemcgr For This Useful Post:

    HanneSThEGreaT (July 5th, 2013)

  17. #12
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: Installed Android program which I created bombs out

    Always include the full text of the error message with your code and question.

    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ver.ncc/com.ver.ncc.FullscreenActivityNCC}: android.view.InflateException: Binary XML file line #38: Error inflating class android.widget.LinearLayout
    What does the xml look like?

  18. The Following User Says Thank You to jps For This Useful Post:

    HanneSThEGreaT (July 5th, 2013)

  19. #13
    Junior Member
    Join Date
    Jul 2013
    Posts
    16
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Default Re: Installed Android program which I created bombs out

    Wow, thanks for all your efforts guys.

    I am attaching my project here - all the layouts and classes are in there, perhaps it could help identifying the error.

    I just have warnings in my project, as far as I know. the compiler didn't pinpoint an exact error

    hannes
    Attached Files Attached Files

  20. #14
    Junior Member
    Join Date
    Jul 2013
    Posts
    16
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Default Re: Installed Android program which I created bombs out

    Do you think it is wise to redo my design completely, in order to hopefully eradicate the error?

  21. #15
    Junior Member
    Join Date
    Jul 2013
    Posts
    16
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Default Re: Installed Android program which I created bombs out

    Through Lint, I managed to fix some errors. Still no light I did replace my earlier attachment with the most current one. I really do not know what else to do, except for giving up - which I don't want to.

    Can any one please have a look and see if you could spot the error? I'm not asking to be spoonfed, but I am really getting nowhere

    Hannes

  22. #16
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,676
    Thanks
    25
    Thanked 329 Times in 305 Posts

    Default Re: Installed Android program which I created bombs out

    Most people are not going to go digging through your project files (just the reality of help forums). Are you able to just tell us what is on the line it is complaining about?
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/

  23. The Following User Says Thank You to aussiemcgr For This Useful Post:

    HanneSThEGreaT (July 10th, 2013)

  24. #17
    Junior Member
    Join Date
    Jul 2013
    Posts
    16
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Default Re: Installed Android program which I created bombs out

    Thanks again for your help, I understand. Just got frustrated.

    Seems I'm getting somewhere..... I think

    An error I get is android.widget.LinearLayout cannot be cast to android.widget.ListView

    I am making use of a listview on my main file. This is the main file's content :

    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/fullscreen_content_controls"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#FFFFFF"
        tools:context=".FullscreenActivityNCC" >
     
        <!--
             The primary full-screen view. This can be replaced with whatever view
             is needed to present your content, e.g. VideoView, SurfaceView,
             TextureView, etc.
     
        -->
     
     
        <!--
             This FrameLayout insets its children based on system windows using
             android:fitsSystemWindows.
     
        -->
     
        <Button
            android:id="@+id/Contact"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom|left"
            android:text="@string/Contact"
            android:textColor="#000000" />
     
        <Button
            android:id="@+id/Download"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom|right"
            android:text="@string/Download"
            android:textColor="#000000" />
     
        <FrameLayout
            android:id="@+id/fullscreen_content"
            android:layout_width="match_parent"
            android:layout_height="407dp" >
     
            <TextView
                android:id="@+id/textView1"
                android:layout_width="wrap_content"
                android:layout_height="52dp"
                android:layout_gravity="top"
                android:gravity="center_vertical|center_horizontal"
                android:text="@string/WelcomeBrowse"
                android:textColor="#000000" />
     
            <TextView
                android:id="@+id/textView2"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="bottom"
                android:gravity="center_vertical|center_horizontal"
                android:text="@string/ContactNCC"
                android:textAlignment="center"
                android:textColor="#FF0000" />
     
            <ImageView
                android:id="@+id/Image2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:contentDescription="@string/downloadprogress"
                 />
     
            <include
                android:id="@+id/list_view"
                android:layout_width="280dp"
                android:layout_height="296dp"
                android:layout_gravity="center_vertical|center_horizontal"
                layout="@layout/literacy" />
     
        </FrameLayout>
     
    </FrameLayout>

    This is the content of the Literacy.xml file :

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical" >
     
        <TextView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:gravity="center_vertical|center_horizontal"
            android:text="NCC Vereeniging Courses"
            android:textColor="#bb0000"
            android:textSize="16sp" />
     
        <ListView
            android:id="@+id/srListView"
            android:layout_width="fill_parent"
            android:layout_height="0dip"
            android:layout_weight="0.24" />
     
     
     
    </LinearLayout>

    And this is the content of the list_item.xml file :

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#FFFFFF"
        android:orientation="vertical" >
     
        <!-- Single ListItem -->
     
        <!-- Product Name -->
        <TextView android:id="@+id/product_name"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:padding="10dip"
            android:textSize="16sp"
            android:textStyle="bold"
            android:textColor="#000000"/>   
     
    </LinearLayout>

    Finally, this is the content of the lit_custom_row_view.xml file :

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical"
        android:paddingBottom="10dip"
        android:paddingLeft="10dip"
        android:paddingTop="10dip" >
     
        <TextView
            android:id="@+id/name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="#C20000"
            android:textSize="14sp"
            android:textStyle="bold" />
     
        <TextView
            android:id="@+id/description"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
     
        <TextView
            android:id="@+id/price"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
     
    </LinearLayout>

    Where I get the abovementioned error is presumably on this code segment in my FullscreenActivityNCC.java file :

           // Listview Data
            String products[] = {"Computer Literacy", "Office Assistant", "Pastel", "Technical", "Graphic Design",
                                    "IT", "Web Design", "Programming", "Business Administration"};
     
     
          final  View lv = (View)findViewById(R.id.list_view);
     
           // lv = (ListView) findViewById(R.id.list_view);
     
            TextView tv1 = (TextView)((ViewGroup) lv).getChildAt(0);
            tv1.setTextColor(Color.BLACK);
            TextView tv2 = (TextView)((ViewGroup) lv).getChildAt(1);
            tv2.setTextColor(Color.BLACK);
            TextView tv3 = (TextView)((ViewGroup) lv).getChildAt(2);
            tv3.setTextColor(Color.BLACK);
            TextView tv4 = (TextView)((ViewGroup) lv).getChildAt(3);
            tv4.setTextColor(Color.BLACK);
            TextView tv5 = (TextView)((ViewGroup) lv).getChildAt(4);
            tv5.setTextColor(Color.BLACK);
            TextView tv6 = (TextView)((ViewGroup) lv).getChildAt(5);
            tv6.setTextColor(Color.BLACK);
            TextView tv7 = (TextView)((ViewGroup) lv).getChildAt(6);
            tv7.setTextColor(Color.BLACK);
            TextView tv8 = (TextView)((ViewGroup) lv).getChildAt(7);
            tv8.setTextColor(Color.BLACK);
            TextView tv9 = (TextView)((ViewGroup) lv).getChildAt(8);
            tv9.setTextColor(Color.BLACK);
     
            // Adding items to listview
            adapter = new ArrayAdapter<String>(this, R.layout.list_item, R.id.product_name, products);
            ((ListView) lv).setAdapter(adapter);       
     
            ((AbsListView) lv).setSelector(R.drawable.listitem_background);
     
            ((AdapterView<ListAdapter>) lv).setOnItemClickListener(new AdapterView.OnItemClickListener() {
     
                @SuppressLint("NewApi")
    			@Override
                public void onItemClick(AdapterView<?> parent, final View view,
                    int position, long id) {
                  final String item = (String) parent.getItemAtPosition(position);
                  lv.animate().setDuration(2000).alpha(0);
     
     
     
                  if (item == "Computer Literacy") {
     
                	  Intent intent = new Intent(FullscreenActivityNCC.this,Literacy.class);
     
        			//start the second Activity
        			startActivity(intent);           	             	  
     
                  }
     
                  else if (item == "Office Assistant") {
                	 Intent intent = new Intent(FullscreenActivityNCC.this,OfficeAssistant.class);
     
        			startActivity(intent); 
                  }
     
                  else if (item == "Pastel") {
                	 Intent intent = new Intent(FullscreenActivityNCC.this,Pastel.class);
     
        			startActivity(intent); 
                  }
     
                  else if (item == "Technical") {
                	 Intent intent = new Intent(FullscreenActivityNCC.this,Technical.class);
     
        			startActivity(intent); 
                  }
     
                  else if (item == "Graphic Design") {
                	 Intent intent = new Intent(FullscreenActivityNCC.this,GraphicDesign.class);
     
        			startActivity(intent); 
                  }
     
                  else if (item == "IT") {
                	 Intent intent = new Intent(FullscreenActivityNCC.this,IT.class);
     
        			startActivity(intent); 
                  }              
     
                  else if (item == "Web Design") {
                	 Intent intent = new Intent(FullscreenActivityNCC.this,WebDesign.class);
     
        			startActivity(intent); 
                  }
     
                  else if (item == "Programming") {
                	 Intent intent = new Intent(FullscreenActivityNCC.this,Programming.class);
     
        			startActivity(intent); 
                  }
     
                  else if (item == "Business Administration") {
                	 Intent intent = new Intent(FullscreenActivityNCC.this,BusinessAdmin.class);
     
        			startActivity(intent); 
                  }            
     
     
                }
     
              });

    I have casted the listview to ViewGroup now, but still the program just bombs out.

    Any thoughts?

    --- Update ---

    OK, based on the above code I get the error : android.widget.ListView cannot be cats to android.widget.TextView

  25. #18
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,676
    Thanks
    25
    Thanked 329 Times in 305 Posts

    Default Re: Installed Android program which I created bombs out

    You cannot cast ListView into a TextView. I believe it is complaining when it is attempting to cast the ListView object from your Literacy.xml.
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/

  26. The Following User Says Thank You to aussiemcgr For This Useful Post:

    HanneSThEGreaT (July 10th, 2013)

  27. #19
    Junior Member
    Join Date
    Jul 2013
    Posts
    16
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Default Re: Installed Android program which I created bombs out

    Thanks. Is there any other way to make a listview without any other "sub content"?

  28. #20
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,676
    Thanks
    25
    Thanked 329 Times in 305 Posts

    Default Re: Installed Android program which I created bombs out

    I'm not familiar enough with the Android platform to help you with that one. Perhaps someone else has some advice.
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/

  29. The Following User Says Thank You to aussiemcgr For This Useful Post:

    HanneSThEGreaT (July 12th, 2013)

  30. #21
    Junior Member
    Join Date
    Jul 2013
    Posts
    16
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Default Re: Installed Android program which I created bombs out

    Hi!

    I managed to get it working! with all your help, thanks!

    I was casting my listview's items incorrectly, and fiddled with it, until it worked. Yay!

    Hannes

Similar Threads

  1. GWT SDK not installed
    By Carhartt in forum Java IDEs
    Replies: 1
    Last Post: April 24th, 2012, 04:16 PM
  2. xml view for android program
    By ikkyu in forum Java IDEs
    Replies: 0
    Last Post: November 28th, 2011, 10:27 PM
  3. Replies: 1
    Last Post: November 21st, 2011, 01:11 AM
  4. jdk is not installed properly error..
    By bczm8703 in forum Java SE APIs
    Replies: 6
    Last Post: June 1st, 2011, 06:33 AM
  5. Using 1.5 jre/webstart on a computer with 1.6 installed
    By qman32 in forum What's Wrong With My Code?
    Replies: 0
    Last Post: January 27th, 2011, 12:29 PM

Tags for this Thread