Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9108267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T02:46:06+00:00 2026-06-17T02:46:06+00:00

I’m using Achartengine for Android, and i have layout composed by a ScrollView mother

  • 0

I’m using Achartengine for Android, and i have layout composed by a ScrollView mother within a LinearLayout. It contains a LinearLayout which is the Graph and some textview e edittext.

The problem is that if i insert the graph on the top of LinearLayout then the program run, but if i insert the graph on the bottom, after all the textview and edittext than the program crash.
Why?

This is my XML code:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:fillViewport="true" >

    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical" >

        <!-- android:layout_weight="1" -->

        <LinearLayout
            android:id="@+id/chart"
            android:layout_width="fill_parent"
            android:layout_height="200dp"
            android:layout_margin="2dp"
            android:orientation="horizontal" />

        <TextView
            android:id="@+id/txtX"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="X: 0"
            android:textSize="15sp" >
        </TextView>

        <TextView
            android:id="@+id/txtZ"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="39dp"
            android:text="Z: 0"
            android:textSize="15sp" />

        <TextView
            android:id="@+id/txtY"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="35dp"
            android:text="Y: 0"
            android:textSize="15sp" />

        <TextView
            android:id="@+id/txtM"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="35dp"
            android:text="M: 0"
            android:textSize="15sp" />

        <TextView
            android:id="@+id/txtM2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="35dp"
            android:text="M: 0"
            android:textSize="15sp" />

        <EditText
            android:id="@+id/et1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="39dp"
            android:ems="10"
            android:focusable="false"
            android:inputType="textMultiLine" >
        </EditText>
    </LinearLayout>

</ScrollView>

Thanks! 🙂

PS: This is LogCat when the application crashes:

12-31 13:56:26.839: I/ActivityManager(169): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.spettro1/.MainActivity } from pid 2688
12-31 13:56:26.849: I/Launcher(2252): onPause()
12-31 13:56:26.859: D/AndroidRuntime(2688): Shutting down VM
12-31 13:56:26.889: I/AndroidRuntime(2688): NOTE: attach of thread 'Binder Thread #3' failed
12-31 13:56:26.899: I/ActivityManager(169): Start proc com.spettro1 for activity com.spettro1/.MainActivity: pid=2697 uid=10125 gids={}
12-31 13:56:26.969: I/OrientationDebug(169): [pwm] in updateOrientationListenerLp()
12-31 13:56:26.969: V/OrientationDebug(169): in updateOrientationListenerLp(), Screen status=true, current orientation=-1, SensorEnabled=true
12-31 13:56:26.969: I/OrientationDebug(169): [pwm] needSensorRunningLp(), return true #4
12-31 13:56:26.979: I/Launcher(2252): onWindowFocusChanged(false)
12-31 13:56:26.989: D/Launcher(2252): setWallpaperDimension() called
12-31 13:56:26.989: D/Launcher(2252): USE_NON_SCROLLABLE_IMAGE_WALLPAPER is true
12-31 13:56:27.019: D/Launcher(2252): It's image wallpaper. suggestDesiredDimensions(-1,-1)
12-31 13:56:27.039: D/SensorManager(2697): ====>>>>>Num Sensor: 1
12-31 13:56:27.039: D/SensorManager(2697): ====>>>>>Num Sensor: 2
12-31 13:56:27.039: D/SensorManager(2697): ====>>>>>Num Sensor: 3
12-31 13:56:27.039: D/SensorManager(2697): ====>>>>>Num Sensor: 4
12-31 13:56:27.039: D/SensorManager(2697): ====>>>>>Num Sensor: 5
12-31 13:56:27.039: D/SensorManager(2697): ====>>>>>Num Sensor: 6
12-31 13:56:27.039: D/SensorManager(2697): ====>>>>>Num Sensor: 0
12-31 13:56:27.039: E/SensorManager(2697): registerListener :: handle = 1600940398  name= Linear Acceleration Sensor delay= 10000 Listener= com.spettro1.MainActivity@40519c70
12-31 13:56:27.049: E/SensorManager(2697): =======>>>Sensor Thread RUNNING <<<========
12-31 13:56:27.049: E/SensorHAL(169): +__poll_activate: handle=0 enabled=1
12-31 13:56:27.119: D/AndroidRuntime(2697): Shutting down VM
12-31 13:56:27.119: W/dalvikvm(2697): threadid=1: thread exiting with uncaught exception (group=0x40018578)
12-31 13:56:27.139: E/AndroidRuntime(2697): FATAL EXCEPTION: main
12-31 13:56:27.139: E/AndroidRuntime(2697): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.spettro1/com.spettro1.MainActivity}: java.lang.ClassCastException: android.widget.LinearLayout
12-31 13:56:27.139: E/AndroidRuntime(2697):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
12-31 13:56:27.139: E/AndroidRuntime(2697):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
12-31 13:56:27.139: E/AndroidRuntime(2697):     at android.app.ActivityThread.access$1500(ActivityThread.java:117)
12-31 13:56:27.139: E/AndroidRuntime(2697):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
12-31 13:56:27.139: E/AndroidRuntime(2697):     at android.os.Handler.dispatchMessage(Handler.java:99)
12-31 13:56:27.139: E/AndroidRuntime(2697):     at android.os.Looper.loop(Looper.java:130)
12-31 13:56:27.139: E/AndroidRuntime(2697):     at android.app.ActivityThread.main(ActivityThread.java:3687)
12-31 13:56:27.139: E/AndroidRuntime(2697):     at java.lang.reflect.Method.invokeNative(Native Method)
12-31 13:56:27.139: E/AndroidRuntime(2697):     at java.lang.reflect.Method.invoke(Method.java:507)
12-31 13:56:27.139: E/AndroidRuntime(2697):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
12-31 13:56:27.139: E/AndroidRuntime(2697):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
12-31 13:56:27.139: E/AndroidRuntime(2697):     at dalvik.system.NativeStart.main(Native Method)
12-31 13:56:27.139: E/AndroidRuntime(2697): Caused by: java.lang.ClassCastException: android.widget.LinearLayout
12-31 13:56:27.139: E/AndroidRuntime(2697):     at com.spettro1.MainActivity.initComponents(MainActivity.java:112)
12-31 13:56:27.139: E/AndroidRuntime(2697):     at com.spettro1.MainActivity.onCreate(MainActivity.java:94)
12-31 13:56:27.139: E/AndroidRuntime(2697):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
12-31 13:56:27.139: E/AndroidRuntime(2697):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
12-31 13:56:27.139: E/AndroidRuntime(2697):     ... 11 more
12-31 13:56:27.139: W/ActivityManager(169):   Force finishing activity com.spettro1/.MainActivity
12-31 13:56:27.149: E/(169): Dumpstate > /data/log/dumpstate_app_error
12-31 13:56:27.649: W/ActivityManager(169): Activity pause timeout for HistoryRecord{4082f818 com.spettro1/.MainActivity}

This is crashing-code around the 112 line, inside the initComponents():

        txtX = (TextView) findViewById(R.id.txtX);
        txtY = (TextView) findViewById(R.id.txtY);
        txtZ = (TextView) findViewById(R.id.txtZ);
        txtM = (TextView) findViewById(R.id.txtM);
        txtM2 = (TextView) findViewById(R.id.txtM2); 
112     ed1 = (EditText) findViewById(R.id.et1); 

        for(int i=0; i<camp.length; ++i)
            camp[i]=0;

NB: definition of textview and edittext are global (on the top of mainactivity) and private, infact they run when the graph is on the top.

Edit1: I tried to change the first LinearLayout in the XML to a TableLayout, then I verified that the problems is not the first LinearLayout but maybe the LinearLaoyut where I implements the graph:

LinearLayout layout = (LinearLayout) findViewById(R.id.chart);
mChartView = ChartFactory.getBarChartView(getBaseContext(), dataset, multiRenderer, BarChart.Type.DEFAULT);
layout.addView(mChartView);

This is called out of initComponents() where the compilers tag the error.
I tried to insert this declaration and instantiation before the textview declaration, the only thing that changed was that the logcat do not tag any specified error, just crash on ActivityThread.performLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 1651.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T02:46:08+00:00Added an answer on June 17, 2026 at 2:46 am

    I resolve my problem adding an ID to the LinearLayout parent:

    android:id="@+id/general"
    

    I don’t know why it works, so i feel bad because I’m worry if it will work in future.
    Maybe there was a conflict between the linearlayout.
    If someone understand the solution could write here.

    Thanks for help me! @mango

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I have an autohotkey script which looks up a word in a bilingual dictionary
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have an array which has BIG numbers and small numbers in it. I
I have a text area in my form which accepts all possible characters from
I have thousands of HTML files to process using Groovy/Java and I need to
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.