I am getting an "Error inflating class fragment". Is it due to an error in my xml file? I have a feeling it may have something to do with the namespaces I'm using, but I'm not sure...
Here's the logcat:
12-30 11:02:41.525: I/dalvikvm(8714): Could not find method
com.example.gameexpensetracker.Chart_screen_activity.getFragmentManager, referenced from method com.example.gameexpensetracker.Chart_screen_activity.pieGraphData
12-30 11:02:41.525: W/dalvikvm(8714): VFY: unable to resolve virtual method 5181: Lcom/example/gameexpensetracker/Chart_screen_activity;.getFragmentManager ()Landroid/app/FragmentManager;
12-30 11:02:41.535: D/dalvikvm(8714): VFY: replacing opcode 0x6e at 0x0204
12-30 11:02:41.535: D/dalvikvm(8714): VFY: dead code 0x0207-02c9 in Lcom/example/gameexpensetracker/Chart_screen_activity;.pieGraphData ()V
12-30 11:02:41.555: D/AndroidRuntime(8714): Shutting down VM
12-30 11:02:41.555: W/dalvikvm(8714): threadid=1: thread exiting with uncaught exception (group=0x40015560)
12-30 11:02:41.565: E/AndroidRuntime(8714): FATAL EXCEPTION: main
12-30 11:02:41.565: E/AndroidRuntime(8714): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.gameexpensetracker/com.example.gameexpensetracker.Chart_screen_activity}: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
12-30 11:02:41.565: E/AndroidRuntime(8714): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
12-30 11:02:41.565: E/AndroidRuntime(8714): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
12-30 11:02:41.565: E/AndroidRuntime(8714): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
12-30 11:02:41.565: E/AndroidRuntime(8714): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
12-30 11:02:41.565: E/AndroidRuntime(8714): at android.os.Handler.dispatchMessage(Handler.java:99)
12-30 11:02:41.565: E/AndroidRuntime(8714): at android.os.Looper.loop(Looper.java:123)
12-30 11:02:41.565: E/AndroidRuntime(8714): at android.app.ActivityThread.main(ActivityThread.java:3683)
12-30 11:02:41.565: E/AndroidRuntime(8714): at java.lang.reflect.Method.invokeNative(Native Method)
12-30 11:02:41.565: E/AndroidRuntime(8714): at java.lang.reflect.Method.invoke(Method.java:507)
12-30 11:02:41.565: E/AndroidRuntime(8714): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
12-30 11:02:41.565: E/AndroidRuntime(8714): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
12-30 11:02:41.565: E/AndroidRuntime(8714): at dalvik.system.NativeStart.main(Native Method)
12-30 11:02:41.565: E/AndroidRuntime(8714): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
12-30 11:02:41.565: E/AndroidRuntime(8714): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:581)
12-30 11:02:41.565: E/AndroidRuntime(8714): at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
12-30 11:02:41.565: E/AndroidRuntime(8714): at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
12-30 11:02:41.565: E/AndroidRuntime(8714): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
12-30 11:02:41.565: E/AndroidRuntime(8714): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
12-30 11:02:41.565: E/AndroidRuntime(8714): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
12-30 11:02:41.565: E/AndroidRuntime(8714): at android.app.Activity.setContentView(Activity.java:1657)
12-30 11:02:41.565: E/AndroidRuntime(8714): at com.example.gameexpensetracker.Chart_screen_activity.onCreate(Chart_screen_activity.java:27)
12-30 11:02:41.565: E/AndroidRuntime(8714): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
12-30 11:02:41.565: E/AndroidRuntime(8714): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
12-30 11:02:41.565: E/AndroidRuntime(8714): ... 11 more
12-30 11:02:41.565: E/AndroidRuntime(8714): Caused by: java.lang.ClassNotFoundException: android.view.fragment in loader dalvik.system.PathClassLoader[/data/app/com.example.gameexpensetracker-2.apk]
12-30 11:02:41.565: E/AndroidRuntime(8714): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
12-30 11:02:41.565: E/AndroidRuntime(8714): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
12-30 11:02:41.565: E/AndroidRuntime(8714): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
12-30 11:02:41.565: E/AndroidRuntime(8714): at android.view.LayoutInflater.createView(LayoutInflater.java:471)
12-30 11:02:41.565: E/AndroidRuntime(8714): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:549)
12-30 11:02:41.565: E/AndroidRuntime(8714): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
12-30 11:02:41.565: E/AndroidRuntime(8714): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
12-30 11:02:41.565: E/AndroidRuntime(8714): ... 20 more
And here's the XML file:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Chartscreenactivity" >
<fragment
class="com.shinobicontrols.charts.ChartFragment"
android:id="#+id/chart"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
Here's the relevant code from the activity:
ChartFragment chartFragment =
(ChartFragment) getFragmentManager().findFragmentById(R.id.chart);
// Get the a reference to the ShinobiChart from the ChartFragment
ShinobiChart shinobiChart = chartFragment.getShinobiChart();
shinobiChart.setLicenseKey("UXbN8mQk0U/byjLMjAxNDAxMjJpbmZvQHNoaW5vYmljb250cm9scy5jb20=1rmCjO7D5wQQxbCcpm28bXkLR" +
"/7MtHh+IrFH93SspNfyW8J5Kf6xZfQ7dUJGFNDwdYkZGUaabHs3vezwOc9t+eJjMmVLkhRkVnnN47JIl3ir/cDGz36Ru2bC7SexLSZhkj0" +
"bXL69ISkSVMvyJZsbGm7gpby0=BQxSUisl3BaWf/7myRmmlIjRnMU2cA7q+/03ZX9wdj30RzapYANf51ee3Pi8m2rVW6aD7t6Hi4Qy5vv9xpa" +
"QYXF5T7XzsafhzS3hbBokp36BoJZg8IrceBj742nQajYyV7trx5GIw9jy/V6r0bvctKYwTim7Kzq+YPWGMtqtQoU=PFJTQUtleVZhbHVlPjxNb" +
"2R1bHVzPnh6YlRrc2dYWWJvQUh5VGR6dkNzQXUrUVAxQnM5b2VrZUxxZVdacnRFbUx3OHZlWStBK3pteXg4NGpJbFkzT2hGdlNYbHZDSjlKVGZQ" +
"TTF4S2ZweWZBVXBGeXgxRnVBMThOcDNETUxXR1JJbTJ6WXA3a1YyMEdYZGU3RnJyTHZjdGhIbW1BZ21PTTdwMFBsNWlSKzNVMDg5M1N4b2hCZlJ5RHd" +
"EeE9vdDNlMD08L01vZHVsdXM+PEV4cG9uZW50PkFRQUI8L0V4cG9uZW50PjwvUlNBS2V5VmFsdWU+");
SimpleDataAdapter<String, Double> dataAdapter = new SimpleDataAdapter<String, Double>();
dataAdapter.add(new DataPoint<String, Double>("Action", actionTotalDB));
dataAdapter.add(new DataPoint<String, Double>("Adventure", adventureTotalDB));
dataAdapter.add(new DataPoint<String, Double>("MMO", MMOTotalDB));
dataAdapter.add(new DataPoint<String, Double>("Puzzle", puzzleTotalDB));
dataAdapter.add(new DataPoint<String, Double>("Racing", racingTotalDB));
dataAdapter.add(new DataPoint<String, Double>("RPG", rpgTotalDB));
dataAdapter.add(new DataPoint<String, Double>("Sim", simulationTotalDB));
dataAdapter.add(new DataPoint<String, Double>("Sports",sportsTotalDB));
dataAdapter.add(new DataPoint<String, Double>("Strategy", strategyTotalDB));
dataAdapter.add(new DataPoint<String, Double>("Other", otherTotalDB));
PieSeries series = new PieSeries();
series.setDataAdapter(dataAdapter);
shinobiChart.addSeries(series);
Although ShinobiCharts supports down to API Level 9 (Gingerbread), Fragments were only introduced in API Level 11. Therefore you need to use the support library.
From the getting started guide:
Tip: To support devices down to API 9: Android 2.3 (Gingerbread) you will need to use SupportChartFragment instead of ChartFragment (in both the XML and the Java source). Additionally, you will need to change the ShinobiQuickStartActivity to extend FragmentActivity instead of Activity and use the getSupportFragmentManager() method instead of getFragmentManager(). Your project will need to reference the Android Support Library to do this.
(via: http://www.shinobicontrols.com/android/shinobicharts/quickstartguide/draw-a-simple-chart/)
Related
I am new in Google Map and so many things aren't clear enough to me for that reason.So i expect some expert's direction on this regard.I read This Guide and did everything what it says.I use google map api v2 and get a map key.Then i make a sample project following that link and select target version android 2.2(while running the project).But a list of error occurs after running then example in eclipse android emulator.My logcat view shows:
01-31 00:51:59.226: W/dalvikvm(329): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
01-31 00:51:59.236: E/AndroidRuntime(329): FATAL EXCEPTION: main
01-31 00:51:59.236: E/AndroidRuntime(329): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.googleMapApp/com.googleMapApp.LocationProfileManagerActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
01-31 00:51:59.236: E/AndroidRuntime(329): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.os.Handler.dispatchMessage(Handler.java:99)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.os.Looper.loop(Looper.java:123)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.app.ActivityThread.main(ActivityThread.java:4627)
01-31 00:51:59.236: E/AndroidRuntime(329): at java.lang.reflect.Method.invokeNative(Native Method)
01-31 00:51:59.236: E/AndroidRuntime(329): at java.lang.reflect.Method.invoke(Method.java:521)
01-31 00:51:59.236: E/AndroidRuntime(329): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
01-31 00:51:59.236: E/AndroidRuntime(329): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
01-31 00:51:59.236: E/AndroidRuntime(329): at dalvik.system.NativeStart.main(Native Method)
01-31 00:51:59.236: E/AndroidRuntime(329): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
01-31 00:51:59.236: E/AndroidRuntime(329): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:576)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
01-31 00:51:59.236: E/AndroidRuntime(329): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.app.Activity.setContentView(Activity.java:1647)
01-31 00:51:59.236: E/AndroidRuntime(329): at com.googleMapApp.LocationProfileManagerActivity.onCreate(LocationProfileManagerActivity.java:14)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
01-31 00:51:59.236: E/AndroidRuntime(329): ... 11 more
01-31 00:51:59.236: E/AndroidRuntime(329): Caused by: java.lang.ClassNotFoundException: android.view.fragment in loader dalvik.system.PathClassLoader[/data/app/com.googleMapApp-1.apk]
01-31 00:51:59.236: E/AndroidRuntime(329): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
01-31 00:51:59.236: E/AndroidRuntime(329): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
01-31 00:51:59.236: E/AndroidRuntime(329): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.view.LayoutInflater.createView(LayoutInflater.java:466)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:544)
01-31 00:51:59.236: E/AndroidRuntime(329): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
My Manifest.xml is:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.googleMapApp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" />
<permission
android:name="com.googleMapApp.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.googleMapApp.permission.MAPS_RECEIVE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<!-- Require OpenGL ES version 2 -->
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name=".LocationProfileManagerActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="myMapKey"/>
</application>
</manifest>
My main.xml is:
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.MapFragment"/>
My activity.java is:
package com.googleMapApp;
import android.app.Activity;
import android.os.Bundle;
public class LocationProfileManagerActivity extends Activity {
/** Called when the activity is first created. */
//private GoogleMap map;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
}
}
Sorry for this lengthy description,but i want to show you exactly what i did.I think as a newcomer i did a lot of mistake on this way.so i expect someone will guide me that.
You are using features only available in later APIs, namely Fragment. If you want to compile to support 2.2, you need to include the Support Library in your project. You will also have to make the following changes to use support fragments instead of regular fragments --
In main.xml, change
class="com.google.android.gms.maps.MapFragment"/>
to
class="com.google.android.gms.maps.SupportMapFragment"/>
and in your activity.java, change
public class LocationProfileManagerActivity extends Activity {
to
public class LocationProfileManagerActivity extends FragmentActivity {
you need to make two changes
Since as you are sdk version is below 12, need to make following change
1)
main.xml
Replace
class="com.google.android.gms.maps.MapFragment"/>
with
class="com.google.android.gms.maps.SupportMapFragment"/>
2) activity.java
Need to extend FragmentActivity instead of Activity
If you want to test in emulator , then download the google_play_services_apk and install it in emulator.
Maps API v2 cannot be run in an emulator because of its dependency on Google Play Services, which is bundled in the Google Play Store .apk. It can be hacked together though, you can read about it here on the first Google result for "Google maps v2 emulator". Also you can still use V1 for a limited time, you can get started here.
I wrote a program for android which connects to internet.
I got the following error:
The application has stopped unexpectedly.Please try again..
What's the problem?
Log cat in Eclipse is as follows:
09-02 12:43:42.421: W/dalvikvm(12362): threadid=1: thread exiting with uncaught exception (group=0x40018578)
09-02 12:43:42.437: E/AndroidRuntime(12362): FATAL EXCEPTION: main
09-02 12:43:42.437: E/AndroidRuntime(12362): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.android.networkusage/com.example.networkusage.NetworkActivity}: java.lang.ClassNotFoundException: com.example.networkusage.NetworkActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.android.networkusage-1.apk]
09-02 12:43:42.437: E/AndroidRuntime(12362): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1573)
09-02 12:43:42.437: E/AndroidRuntime(12362): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
09-02 12:43:42.437: E/AndroidRuntime(12362): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
09-02 12:43:42.437: E/AndroidRuntime(12362): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
09-02 12:43:42.437: E/AndroidRuntime(12362): at android.os.Handler.dispatchMessage(Handler.java:99)
09-02 12:43:42.437: E/AndroidRuntime(12362): at android.os.Looper.loop(Looper.java:130)
09-02 12:43:42.437: E/AndroidRuntime(12362): at android.app.ActivityThread.main(ActivityThread.java:3687)
09-02 12:43:42.437: E/AndroidRuntime(12362): at java.lang.reflect.Method.invokeNative(Native Method)
09-02 12:43:42.437: E/AndroidRuntime(12362): at java.lang.reflect.Method.invoke(Method.java:507)
09-02 12:43:42.437: E/AndroidRuntime(12362): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
09-02 12:43:42.437: E/AndroidRuntime(12362): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
09-02 12:43:42.437: E/AndroidRuntime(12362): at dalvik.system.NativeStart.main(Native Method)
09-02 12:43:42.437: E/AndroidRuntime(12362): Caused by: java.lang.ClassNotFoundException: com.example.networkusage.NetworkActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.android.networkusage-1.apk]
09-02 12:43:42.437: E/AndroidRuntime(12362): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
09-02 12:43:42.437: E/AndroidRuntime(12362): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
09-02 12:43:42.437: E/AndroidRuntime(12362): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
09-02 12:43:42.437: E/AndroidRuntime(12362): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
09-02 12:43:42.437: E/AndroidRuntime(12362): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1565)
09-02 12:43:42.437: E/AndroidRuntime(12362): ... 11 more
Found that my package name is:
com.example.android.networkusage
and on the manifest is as:
android:name="com.example.networkusage.NetworkActivity"
so changed the manifest to:
android:name="com.example.android.networkusage.NetworkActivity"
Looks like your com.example.networkusage.NetworkActivity class is missing.
If it is declared in an external library, add that jar file to the "libs" folder and add it to the build path and then build your project again.
Don't forget to clean it too!
i have a created android project and within it i have created two package
--net.website.custom_listview
--main_activity_customview.java
--other files .....
--net.website.dashboard
--main_activity_dashboard.java
--other files .....
in my AndroidManifest.xml file
<activity
android:name="net.website.dashboard.main_activity_dashboard"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
so when i run the android app i am getting the following errors..
here is my logCat:
03-08 22:02:03.941: E/AndroidRuntime(691): FATAL EXCEPTION: main
03-08 22:02:03.941: E/AndroidRuntime(691): java.lang.RuntimeException: Unable to start activity ComponentInfo{net.website/net.website.dashboard.Main_Activity_Dashboard}: android.view.InflateException: Binary XML file line #1: Error inflating class net.website.dashboard
03-08 22:02:03.941: E/AndroidRuntime(691): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
03-08 22:02:03.941: E/AndroidRuntime(691): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
03-08 22:02:03.941: E/AndroidRuntime(691): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
03-08 22:02:03.941: E/AndroidRuntime(691): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
03-08 22:02:03.941: E/AndroidRuntime(691): at android.os.Handler.dispatchMessage(Handler.java:99)
03-08 22:02:03.941: E/AndroidRuntime(691): at android.os.Looper.loop(Looper.java:123)
03-08 22:02:03.941: E/AndroidRuntime(691): at android.app.ActivityThread.main(ActivityThread.java:3683)
03-08 22:02:03.941: E/AndroidRuntime(691): at java.lang.reflect.Method.invokeNative(Native Method)
03-08 22:02:03.941: E/AndroidRuntime(691): at java.lang.reflect.Method.invoke(Method.java:507)
03-08 22:02:03.941: E/AndroidRuntime(691): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
03-08 22:02:03.941: E/AndroidRuntime(691): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
03-08 22:02:03.941: E/AndroidRuntime(691): at dalvik.system.NativeStart.main(Native Method)
03-08 22:02:03.941: E/AndroidRuntime(691): Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class net.website.dashboard
03-08 22:02:03.941: E/AndroidRuntime(691): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:581)
03-08 22:02:03.941: E/AndroidRuntime(691): at android.view.LayoutInflater.parseInclude(LayoutInflater.java:684)
03-08 22:02:03.941: E/AndroidRuntime(691): at android.view.LayoutInflater.rInflate(LayoutInflater.java:619)
03-08 22:02:03.941: E/AndroidRuntime(691): at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
03-08 22:02:03.941: E/AndroidRuntime(691): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
03-08 22:02:03.941: E/AndroidRuntime(691): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
03-08 22:02:03.941: E/AndroidRuntime(691): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
03-08 22:02:03.941: E/AndroidRuntime(691): at android.app.Activity.setContentView(Activity.java:1657)
03-08 22:02:03.941: E/AndroidRuntime(691): at net.website.dashboard.Main_Activity_Dashboard.onCreate(Main_Activity_Dashboard.java:16)
03-08 22:02:03.941: E/AndroidRuntime(691): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-08 22:02:03.941: E/AndroidRuntime(691): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
03-08 22:02:03.941: E/AndroidRuntime(691): ... 11 more
03-08 22:02:03.941: E/AndroidRuntime(691): Caused by: java.lang.ClassNotFoundException: net.website.dashboard in loader dalvik.system.PathClassLoader[/data/app/net.website-2.apk]
03-08 22:02:03.941: E/AndroidRuntime(691): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
03-08 22:02:03.941: E/AndroidRuntime(691): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
03-08 22:02:03.941: E/AndroidRuntime(691): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
03-08 22:02:03.941: E/AndroidRuntime(691): at android.view.LayoutInflater.createView(LayoutInflater.java:471)
03-08 22:02:03.941: E/AndroidRuntime(691): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:570)
The problem is in your layout XML file. You're referencing the class "net.website.dashboard" but it doesn't exist.
You have to change the name for your packege and then after you have to check this.and also check your xml file
By default Bluetooth is not enabled in Android. But when I go to Setting > Wireless & network and I click on Bluetooth Settings I get the following error:
04-04 11:42:22.492:
WARN/dalvikvm(747): threadid=1: thread
exiting with uncaught exception
(group=0x40014760) FATAL EXCEPTION:
main android.view.InflateException:
Binary XML file line #29: Error
inflating class
java.lang.reflect.Constructor
at android.preference.GenericInflater.createItem(GenericInflater.java:397)
at android.preference.GenericInflater.createItemFromTag(GenericInflater.java:430)
at android.preference.GenericInflater.rInflate(GenericInflater.java:481)
at android.preference.GenericInflater.inflate(GenericInflater.java:326)
at android.preference.GenericInflater.inflate(GenericInflater.java:263)
at android.preference.
PreferenceManager.inflateFromResource(PreferenceManager.java:269)
at android.preference.PreferenceFragment.addPreferencesFromResource(PreferenceFragment.java:271)
at com.android.settings.bluetooth.BluetoothSettings.addPreferencesForActivity(BluetoothSettings.java:53)
at com.android.settings.bluetooth.DeviceListPreferenceFragment.onActivityCreated(DeviceListPreferenceFragment.java:93)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:749)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:921)
at android.app.BackStackRecord.run(BackStackRecord.java:578)
at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1221)
at android.app.FragmentManagerImpl$1.run(FragmentManager.java:375)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:126)
at android.app.ActivityThread.main(ActivityThread.java:3997)
at java.lang.reflect.Method.invokeNative(Native
Method)
at java.lang.reflect.Method.invoke(Method.java:491)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
at dalvik.system.NativeStart.main(Native
Method) Caused by:
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native
Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
at android.preference.GenericInflater.createItem(GenericInflater.java:383)
... 22 more Caused by: java.lang.NullPointerException
at com.android.settings.bluetooth.BluetoothNamePreference.setSummaryToName(BluetoothNamePreference.java:101)
at com.android.settings.bluetooth.BluetoothNamePreference.(BluetoothNamePreference.java:66)
... 25 more
What I'm missing?
Thanks.
You cant setup bluetooth on ANdroid AVD. Please check this link for emulator limitations:
http://developer.android.com/guide/developing/devices/emulator.html
I am getting the Run time exception in my application and I have tried a lot to sort it out but couldn't do it.
Here is the code where I am getting the error:
public class FirstDemo extends ListActivity
{
private ListView Lv02;
private String Lv_Arr02[]={ "darshan", "sunil", "viral", "jaimin", "aashish", "jaydev", "bhavesh"};
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.mylistview); ( Here I am getting the Exception )
Lv02=(ListView) findViewById(R.id.lstvw_mylist);
}
}
My Stack Trace is as under:
12-30 11:21:09.525: ERROR/AndroidRuntime(517): FATAL EXCEPTION: main
12-30 11:21:09.525: ERROR/AndroidRuntime(517): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.mytabhostdemo/com.android.mytabhostdemo.FirstDemo}: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at android.app.ActivityThread.startActivityNow(ActivityThread.java:2503)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:127)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:339)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:651)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at android.widget.TabHost.setCurrentTab(TabHost.java:323)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at android.widget.TabHost$2.onTabSelectionChanged(TabHost.java:129)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at android.widget.TabWidget$TabClickListener.onClick(TabWidget.java:453)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at android.view.View.performClick(View.java:2408)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at android.view.View$PerformClick.run(View.java:8816)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at android.os.Handler.handleCallback(Handler.java:587)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at android.os.Handler.dispatchMessage(Handler.java:92)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at android.os.Looper.loop(Looper.java:123)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at android.app.ActivityThread.main(ActivityThread.java:4627)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at java.lang.reflect.Method.invokeNative(Native Method)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at java.lang.reflect.Method.invoke(Method.java:521)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at dalvik.system.NativeStart.main(Native Method)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): Caused by: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at android.app.ListActivity.onContentChanged(ListActivity.java:245)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:201)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at android.app.Activity.setContentView(Activity.java:1647)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at com.android.mytabhostdemo.FirstDemo.onCreate(FirstDemo.java:17) (Here I think)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
12-30 11:21:09.525: ERROR/AndroidRuntime(517): ... 18 more
It would be great if anybody could help me.
Thanks,
david
In your XML file your top element must be a ListView since you derive from ListActivity.
example:
<ListView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#android:id/list">
</ListView>
When deriving from specific activities Android expects there to be a specific definition in your layout XML file with a predefined ID.
If you post your XML we can fix it for you.