Error: eglSurfaceAttrib not implemented

≯℡__Kan透↙ 提交于 2019-12-06 04:18:24

From your error logs:

android.content.ActivityNotFoundException: Unable to find explicit activity class {com.lifematters/com.lifematters.LineGraph}; have you declared this activity in your AndroidManifest.xml?

Try this

 public void openProgress() {
        //create new textview
         LineGraph line = new LineGraph();
        Intent lineIntent = line.getIntent(this);
        startActivity(lineIntent);
        }

OR

public void openProgress() {

   lineGraphHandler();
    }

    public void lineGraphHandler ()
    {
    LineGraph line = new LineGraph();
    Intent lineIntent = line.getIntent(this);
    startActivity(lineIntent);
    }

add this code for your main activity

  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Button b2;
    b2=(Button)findViewById(R.id.button2);
    b2.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {

            Intent i = new Intent(getApplicationContext(), MyLine.class);
            startActivity(i);
        }
    });

i have make my class as MyLine so add this to MyLine Class

  package com.isuru.mychater;

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


import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.widget.RelativeLayout;

public class MyLine extends Activity{



@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
     setContentView(R.layout.line);
     //getIntent(this);
     MyLine  line = new MyLine();
     GraphicalView gview = line.getView(this);
     RelativeLayout layout =(RelativeLayout)findViewById(R.id.chart);
     layout.addView(gview);
}

public GraphicalView getView(Context context)
{

    int[] x = {1, 2, 3, 4, 5, 6, 7}; //x values
    int[] y = {3, 2, 3, 4, 2, 1, 3}; //y values

    //need to create series as graph does not support arrays
    TimeSeries series = new TimeSeries("Line1");
        for( int i = 0; i < x.length; i++)
        {
            series.add(x[i], y[i]);
        }

    //allows more than 1 line to be added to linegraph  
    XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();

    dataset.addSeries(series);

    //customize lines
    XYMultipleSeriesRenderer mRenderer = new XYMultipleSeriesRenderer();
    XYSeriesRenderer renderer = new XYSeriesRenderer();
    mRenderer.addSeriesRenderer(renderer);

   return  ChartFactory.getLineChartView(context, dataset, mRenderer);



       }

}

cord for my line.xml file

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

<RelativeLayout
    android:id="@+id/chart"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true" >
</RelativeLayout>

also don't for get to update the manifest file as

<activity
        android:name="com.isuru.mychater.MyLine"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MYLINE" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity android:name="org.achartengine.GraphicalActivity"/>

enter link description here

look this link for basic

enter link description here

hope this cord is help for you.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!