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

  • Home
  • SEARCH
  • 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 6682893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:45:30+00:00 2026-05-26T04:45:30+00:00

I am trying to create a dynamic chart for my random generator that keeps

  • 0

I am trying to create a dynamic chart for my random generator that keeps pumping values. For the graph I am using AChartEngine. I am clear about my approach in the sense of using the Async Task mechanism to do the update thorough the background thread for dynamic chart. But I am not able to get the basic XY chart using the AChartEngine libraries to work. The application crashes every time. Here is my code for the basic XY chart.

package com.example.graph2;

import org.achartengine.ChartFactory;
import org.achartengine.GraphicalView;
import org.achartengine.model.XYMultipleSeriesDataset;
import org.achartengine.model.XYSeries;
import org.achartengine.renderer.XYMultipleSeriesRenderer;
import org.achartengine.renderer.XYSeriesRenderer;

import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;

public class Graph2Activity extends Activity {
  private XYMultipleSeriesDataset RNG_Dataset = new XYMultipleSeriesDataset();
  private XYMultipleSeriesRenderer RNG_Renderer = new XYMultipleSeriesRenderer();
  public XYSeries RNG_CurrentSeries;
  private GraphicalView RNG_ChartView;

  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);


    RNG_Renderer.setAxisTitleTextSize(16);
    RNG_Renderer.setChartTitleTextSize(20);
    RNG_Renderer.setLabelsTextSize(15);
    RNG_Renderer.setLegendTextSize(15);
    RNG_Renderer.setMargins(new int[] {20, 30, 15, 0});
    RNG_Renderer.setAxesColor(Color.YELLOW);

    String seriesTitle = "RNG";
    XYSeries series = new XYSeries(seriesTitle);

    RNG_Dataset.addSeries(series);
    RNG_CurrentSeries = series;

    XYSeriesRenderer renderer = new XYSeriesRenderer();
    renderer.setColor(Color.RED);
    RNG_Renderer.addSeriesRenderer(renderer); 
    setContentView(R.id.RNGchart);
  }

  protected void onResume() {
    if (RNG_ChartView == null) {
      LinearLayout layout = (LinearLayout) findViewById(R.id.RNGchart);
      RNG_ChartView = ChartFactory.getLineChartView(this, RNG_Dataset, RNG_Renderer);

      layout.addView(RNG_ChartView, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
//      boolean enabled = HRDataset.getSeriesCount() > 0;
//      setSeriesEnabled(enabled);
    } else {
      RNG_ChartView.repaint();
    }
  } 
}

Here is the xml I have used:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:id="@+id/RNGchart" android:orientation="horizontal"
   android:layout_width="fill_parent" android:layout_height="300px" 
   android:layout_weight="1" />          

Can someone please tell me where I am going wrong?
Here is the exception log:

10-10 17:20:52.761: ERROR/AndroidRuntime(335): FATAL EXCEPTION: main
10-10 17:20:52.761: ERROR/AndroidRuntime(335): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.graph2/com.example.graph2.Graph2Activity}: android.content.res.Resources$NotFoundException: Resource ID #0x7f050000 type #0x12 is not valid
10-10 17:20:52.761: ERROR/AndroidRuntime(335):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
10-10 17:20:52.761: ERROR/AndroidRuntime(335):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
10-10 17:20:52.761: ERROR/AndroidRuntime(335):     at android.app.ActivityThread.access$1500(ActivityThread.java:117)
10-10 17:20:52.761: ERROR/AndroidRuntime(335):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
10-10 17:20:52.761: ERROR/AndroidRuntime(335):     at android.os.Handler.dispatchMessage(Handler.java:99)
10-10 17:20:52.761: ERROR/AndroidRuntime(335):     at android.os.Looper.loop(Looper.java:123)
10-10 17:20:52.761: ERROR/AndroidRuntime(335):     at android.app.ActivityThread.main(ActivityThread.java:3683)
10-10 17:20:52.761: ERROR/AndroidRuntime(335):     at java.lang.reflect.Method.invokeNative(Native Method)
10-10 17:20:52.761: ERROR/AndroidRuntime(335):     at java.lang.reflect.Method.invoke(Method.java:507)
10-10 17:20:52.761: ERROR/AndroidRuntime(335):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
10-10 17:20:52.761: ERROR/AndroidRuntime(335):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
10-10 17:20:52.761: ERROR/AndroidRuntime(335):     at dalvik.system.NativeStart.main(Native Method)
10-10 17:20:52.761: ERROR/AndroidRuntime(335): Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f050000 type #0x12 is not valid
10-10 17:20:52.761: ERROR/AndroidRuntime(335):     at android.content.res.Resources.loadXmlResourceParser(Resources.java:1874)
10-10 17:20:52.761: ERROR/AndroidRuntime(335):     at android.content.res.Resources.getLayout(Resources.java:731)
10-10 17:20:52.761: ERROR/AndroidRuntime(335):     at android.view.LayoutInflater.inflate(LayoutInflater.java:318)
10-10 17:20:52.761: ERROR/AndroidRuntime(335):     at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
10-10 17:20:52.761: ERROR/AndroidRuntime(335):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
10-10 17:20:52.761: ERROR/AndroidRuntime(335):     at android.app.Activity.setContentView(Activity.java:1657)
10-10 17:20:52.761: ERROR/AndroidRuntime(335):     at com.example.graph2.Graph2Activity.onCreate(Graph2Activity.java:44)
10-10 17:20:52.761: ERROR/AndroidRuntime(335):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
10-10 17:20:52.761: ERROR/AndroidRuntime(335):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
10-10 17:20:52.761: ERROR/AndroidRuntime(335):     ... 11 more


Here is the manifest file:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.example.graph2"
   android:versionCode="1"
   android:versionName="1.0">
 <uses-sdk android:minSdkVersion="10" />

   <application android:icon="@drawable/icon" android:label="@string/app_name">
      <activity android:name=".Graph2Activity"
              android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
  <activity android:name="org.achartengine.chartdemo.demo.chart.XYChartBuilder" />
     <activity android:name="org.achartengine.GraphicalActivity" />
    <activity android:name=".GeneratedChartDemo" />
    </application>
  </manifest>
  • 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-05-26T04:45:31+00:00Added an answer on May 26, 2026 at 4:45 am

    You can checkout my complete Demo from here

    Try this,

    <activity android:name="com.example.graph2.Graph2Activity"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    

    And make sure your Graph2Activity Activity is inside the com.example.graph2 package.

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

Sidebar

Related Questions

I'm trying to create a dynamic QSlider that accepts a QVector of integer values
I'm trying to create a dynamic popup window that is able to be re-sized.
I am trying to create a dynamic hyperlink that depends on a value passed
I'm trying to create a dynamic grid using ExtJS. The grid is built and
What I am trying to accomplish: Create a dynamic bubble that expands on height
I am trying to create a new contact using Dynamic Entity. The sample i
I am trying to create dynamic excel sheet, with the help of php using
I am trying to create dynamic predicate so that it can be used against
I'm trying to create a dynamic tag cloud using jquery, I want it to
I am trying to create a dynamic UI using UpdatePanel of AJAX toolkit. Let

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.