Android App getting crashed when toggling between USB modes - android

I am developing an Android application which involves displaying of Google Maps using fragments.
Here are the steps to reproduce the crash:
Start the application
Open the activity using fragments
Connect Data cable
Switch USB mode to Mass storage
Resume the application
Application gets crashed
the Log for the crash is as follows:
04-27 18:45:10.289: E/AndroidRuntime(19982): FATAL EXCEPTION: main
04-27 18:45:10.289: E/AndroidRuntime(19982): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.octanetech.cortes/com.octanetech.cortes.MapActivity}: java.lang.NullPointerException
04-27 18:45:10.289: E/AndroidRuntime(19982): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
04-27 18:45:10.289: E/AndroidRuntime(19982): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
04-27 18:45:10.289: E/AndroidRuntime(19982): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
04-27 18:45:10.289: E/AndroidRuntime(19982): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-27 18:45:10.289: E/AndroidRuntime(19982): at android.os.Handler.dispatchMessage(Handler.java:99)
04-27 18:45:10.289: E/AndroidRuntime(19982): at android.os.Looper.loop(Looper.java:123)
04-27 18:45:10.289: E/AndroidRuntime(19982): at android.app.ActivityThread.main(ActivityThread.java:4627)
04-27 18:45:10.289: E/AndroidRuntime(19982): at java.lang.reflect.Method.invokeNative(Native Method)
04-27 18:45:10.289: E/AndroidRuntime(19982): at java.lang.reflect.Method.invoke(Method.java:521)
04-27 18:45:10.289: E/AndroidRuntime(19982): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:871)
04-27 18:45:10.289: E/AndroidRuntime(19982): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)
04-27 18:45:10.289: E/AndroidRuntime(19982): at dalvik.system.NativeStart.main(Native Method)
04-27 18:45:10.289: E/AndroidRuntime(19982): Caused by: java.lang.NullPointerException
04-27 18:45:10.289: E/AndroidRuntime(19982): at com.octanetech.cortes.MapActivity.displayPlaces(MapActivity.java:644)
04-27 18:45:10.289: E/AndroidRuntime(19982): at com.octanetech.cortes.MapActivity.onCreate(MapActivity.java:158)
04-27 18:45:10.289: E/AndroidRuntime(19982): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-27 18:45:10.289: E/AndroidRuntime(19982): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
04-27 18:45:10.289: E/AndroidRuntime(19982): ... 11 more
04-27 18:45:10.309: W/ActivityManager(2466): Force finishing activity com.octanetech.cortes/.MapActivity
I am using Samsung Galaxy S device.
I am using static variables as global variables. I switched to this as well, but nothing helped. The entire class in which global variables are stored is getting killed. The interesting thing to note is that when I am following the same steps in the activities where there are no fragments, then my application is not getting crashed.

Try saving your fragment state.
This can be done using "onSaveInstance" of the fragment
Also you can try setRetainInstance(true) for fragments.
When you toggle between USB modes, sometimes the Activity is recreated and hence the fragment.

Related

Problems with EditText in android? Cannot perform any actions on it without crashing

I'm very new to android programming, and somewhat inexperienced with Java itself. I'm having a problem, as described by the title. I'm trying to change some text in the Main Activity within the program but whatever i do, the app crashes on startup, and a NullPointerException is thrown. Here is the XML code for the EditText field, in fragment_main.xml:
<EditText
android:inputType="text"
android:id="#+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:labelFor="#+id/editText1"
android:hint="#string/hinty"
android:text="#string/hello_world" />
And here is the code in MainActivity.java, in the onCreate() method, after the other stuff in there:
EditText text = (EditText) findViewById(R.id.editText1);
text.getText();
Finally, here is the error log:
04-27 13:23:29.563: E/AndroidRuntime(23317): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2306)
04-27 13:23:29.563: E/AndroidRuntime(23317): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2358)
04-27 13:23:29.563: E/AndroidRuntime(23317): at android.app.ActivityThread.access$600(ActivityThread.java:156)
04-27 13:23:29.563: E/AndroidRuntime(23317): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1340)
04-27 13:23:29.563: E/AndroidRuntime(23317): at android.os.Handler.dispatchMessage(Handler.java:99)
04-27 13:23:29.563: E/AndroidRuntime(23317): at android.os.Looper.loop(Looper.java:153)
04-27 13:23:29.563: E/AndroidRuntime(23317): at android.app.ActivityThread.main(ActivityThread.java:5299)
04-27 13:23:29.563: E/AndroidRuntime(23317): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
04-27 13:23:29.563: E/AndroidRuntime(23317): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
04-27 13:23:29.563: E/AndroidRuntime(23317): at android.app.Activity.performCreate(Activity.java:5122)
04-27 13:23:29.563: E/AndroidRuntime(23317): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1081)
04-27 13:23:29.563: E/AndroidRuntime(23317): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2270)
I'm running Jelly Bean 4.2.2 on the device I'm testing this on. So, can anyone help?
Add line in your onCreate method:
setContentView(R.layout.fragment_main);
like this:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fragment_main);
EditText text = (EditText) findViewById(R.id.editText1);
text.getText();
}
I get NullPointerAssignment commenting the "SetContentView" line, so I guess this is your problem.

Error in changeng portrait to landscape [duplicate]

I am completely lost with this one. My app works perfectly on API 2.1 on my handset and through the emulator.
I have just run it through a 2.2 emulator and I am getting a crash and this error:
04-27 20:29:41.293: ERROR/AndroidRuntime(341): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ebp/com.ebp.ebpMainMenu}: android.view.InflateException: Binary XML file line #2: Error inflating class android.widget.LinearLayout
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.app.ActivityThread.access$2200(ActivityThread.java:119)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.os.Handler.dispatchMessage(Handler.java:99)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.os.Looper.loop(Looper.java:123)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.app.ActivityThread.main(ActivityThread.java:4363)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at java.lang.reflect.Method.invokeNative(Native Method)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at java.lang.reflect.Method.invoke(Method.java:521)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at dalvik.system.NativeStart.main(Native Method)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class android.widget.LinearLayout
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.view.LayoutInflater.createView(LayoutInflater.java:513)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.view.LayoutInflater.inflate(LayoutInflater.java:385)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.app.Activity.setContentView(Activity.java:1622)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at com.ebp.ebpMainMenu.onCreate(ebpMainMenu.java:58)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): ... 11 more
04-27 20:29:41.293: ERROR/AndroidRuntime(341): Caused by: java.lang.reflect.InvocationTargetException
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.widget.LinearLayout.<init>(LinearLayout.java:92)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at java.lang.reflect.Constructor.constructNative(Native Method)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.view.LayoutInflater.createView(LayoutInflater.java:500)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): ... 21 more
04-27 20:29:41.293: ERROR/AndroidRuntime(341): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.graphics.Bitmap.nativeCreate(Native Method)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.graphics.Bitmap.createBitmap(Bitmap.java:468)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.graphics.Bitmap.createBitmap(Bitmap.java:435)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:340)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:488)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:462)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:323)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.content.res.Resources.loadDrawable(Resources.java:1705)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.content.res.TypedArray.getDrawable(TypedArray.java:548)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.view.View.<init>(View.java:1850)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.view.View.<init>(View.java:1799)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.view.ViewGroup.<init>(ViewGroup.java:284)
In the main.xml file, here is line #2
<LinearLayout
android:id="#+id/linearLayout3"
android:background="#drawable/mainbackground"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical">
and here is main line 58:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget may be the real culprit here. Try using smaller image to see if it is a memory-related issue.
Check out these links for examples of similar issues: java.lang.OutOfMemoryError: bitmap size exceeds VM budget - android - how many images?
OutOfMemory exception when loading bitmap from external storage

Activity cannot be cast to android.support.v4.app.Fragment

I am trying to change my App which has a bunch of single Activities into a swipe tab app.
i want 3 activities in the swipe tabs. I used the google example wich eclipse created for me. I don't seem to get the correct way of doing that.
I have the following (relevant) code (the other stuff is in eclipse, it's too much to post here):
Main.class which is called at launch (the last inner class of it):
public static class DummySectionFragment extends Fragment {
public static final String ARG_SECTION_NUMBER = "section_number";
// public DummySectionFragment() {
// }
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.activity_fragment,
container, false);
return rootView;
}
}
activity_fragment.xml:
<fragment
android:id="#+id/main"
android:name="com.mikebdev.refuel.MainActivity"
class="com.mikebdev.refuel.MainActivity"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<fragment
android:id="#+id/stats"
android:name="com.mikebdev.refuel.Statistics"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2" />
<fragment
android:id="#+id/refuel"
android:name="com.mikebdev.refuel.ReFuel"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3" />
The Activities all extend FragmentActivity from android.support.v4.app.FragmentActivity
now when starting my app, i get the following error:
04-27 12:08:11.244: E/AndroidRuntime(28728): FATAL EXCEPTION: main
04-27 12:08:11.244: E/AndroidRuntime(28728): android.view.InflateException: Binary XML file line #8: Error inflating class fragment
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
04-27 12:08:11.244: E/AndroidRuntime(28728): at com.mikebdev.refuel.Main$DummySectionFragment.onCreateView(Main.java:184)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.support.v4.app.Fragment.performCreateView(Fragment.java:1460)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:911)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1088)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1444)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:461)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.support.v4.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:163)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.support.v4.view.ViewPager.populate(ViewPager.java:1011)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.support.v4.view.ViewPager.populate(ViewPager.java:880)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1374)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.view.View.measure(View.java:15518)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4825)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.view.View.measure(View.java:15518)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.widget.LinearLayout.measureVertical(LinearLayout.java:847)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.view.View.measure(View.java:15518)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4825)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
04-27 12:08:11.244: E/AndroidRuntime(28728): at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2176)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.view.View.measure(View.java:15518)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1874)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1089)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1265)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:989)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4351)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.view.Choreographer.doCallbacks(Choreographer.java:562)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.view.Choreographer.doFrame(Choreographer.java:532)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.os.Handler.handleCallback(Handler.java:725)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.os.Handler.dispatchMessage(Handler.java:92)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.os.Looper.loop(Looper.java:137)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.app.ActivityThread.main(ActivityThread.java:5041)
04-27 12:08:11.244: E/AndroidRuntime(28728): at java.lang.reflect.Method.invokeNative(Native Method)
04-27 12:08:11.244: E/AndroidRuntime(28728): at java.lang.reflect.Method.invoke(Method.java:511)
04-27 12:08:11.244: E/AndroidRuntime(28728): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
04-27 12:08:11.244: E/AndroidRuntime(28728): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
04-27 12:08:11.244: E/AndroidRuntime(28728): at dalvik.system.NativeStart.main(Native Method)
04-27 12:08:11.244: E/AndroidRuntime(28728): Caused by: java.lang.ClassCastException: com.mikebdev.refuel.MainActivity cannot be cast to android.support.v4.app.Fragment
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.support.v4.app.Fragment.instantiate(Fragment.java:394)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.support.v4.app.Fragment.instantiate(Fragment.java:369)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:272)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:676)
You can't have nested fragments embedded in a xml layout file. You'll have to add them at runtime.
Edit: There are countless tutorials on implementing swipeable tabs with fragments please look at them, many are self explanatory. The main points are:
create a layout file which will contain the tabs and the ViewPager
create the fragments that will be used as the tabs/pages in the ViewPager
create a FragmentPagerAdapter and assign it to the ViewPager
bind the tabs selection to the ViewPager pages.
You could use the ViewPager directly in the Activity or you could use a wrapper Fragment, the difference is that you'll need to pass getChildFragmentManager() to the FragmentPagerAdapter instead of getSupportFragmentManager().
After a while i was able to solve everything by adding a switch case statement here:
#Override
public Fragment getItem(int position) {
// getItem is called to instantiate the fragment for the given page.
// Return a DummySectionFragment (defined as a static inner class
// below) with the page number as its lone argument.
Fragment fragment;
switch (position) {
case 0:
fragment = new StatisticsFragment();
break;
case 1:
fragment = new MainActivityFragment();
break;
case 2:
fragment = new DbListViewFragment();
break;
default:
fragment = new DummySectionFragment();
break;
}
return fragment;
}
and I made a copy of my activities and converted those to fragments like explained on this video:
Converting An Activity To A Fragment
now everything seems to work.

Android - exception when trying to make intent go to class in a new directory

I have this intent in the manifest file:
<activity
android:name=".ProductStrategyActivity"
android:label="#string/product_strategy_header" />
I get an Exception when I try to do this:
Intent myIntent = new Intent(LearnActivity.this, ProductStrategyActivity.class);
LearnActivity.this.startActivity(myIntent);
and the class is in a package that is in my src/com/app_name/content/ directory.
Could the problem be that I need to specify that directory in the manifest file?
Sorry I made a mistake in the exception. Here is the stack trace:
04-27 02:07:23.221: E/AndroidRuntime(1234): FATAL EXCEPTION: main
04-27 02:07:23.221: E/AndroidRuntime(1234): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.problemio/com.problemio.content.ProductStrategyActivity}; have you declared this activity in your AndroidManifest.xml?
04-27 02:07:23.221: E/AndroidRuntime(1234): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1508)
04-27 02:07:23.221: E/AndroidRuntime(1234): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1384)
04-27 02:07:23.221: E/AndroidRuntime(1234): at android.app.Activity.startActivityForResult(Activity.java:3190)
04-27 02:07:23.221: E/AndroidRuntime(1234): at android.app.Activity.startActivity(Activity.java:3297)
04-27 02:07:23.221: E/AndroidRuntime(1234): at com.problemio.LearnActivity$3.onClick(LearnActivity.java:113)
04-27 02:07:23.221: E/AndroidRuntime(1234): at android.view.View.performClick(View.java:3511)
04-27 02:07:23.221: E/AndroidRuntime(1234): at android.view.View$PerformClick.run(View.java:14105)
04-27 02:07:23.221: E/AndroidRuntime(1234): at android.os.Handler.handleCallback(Handler.java:605)
04-27 02:07:23.221: E/AndroidRuntime(1234): at android.os.Handler.dispatchMessage(Handler.java:92)
04-27 02:07:23.221: E/AndroidRuntime(1234): at android.os.Looper.loop(Looper.java:137)
04-27 02:07:23.221: E/AndroidRuntime(1234): at android.app.ActivityThread.main(ActivityThread.java:4424)
04-27 02:07:23.221: E/AndroidRuntime(1234): at java.lang.reflect.Method.invokeNative(Native Method)
04-27 02:07:23.221: E/AndroidRuntime(1234): at java.lang.reflect.Method.invoke(Method.java:511)
04-27 02:07:23.221: E/AndroidRuntime(1234): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
04-27 02:07:23.221: E/AndroidRuntime(1234): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
04-27 02:07:23.221: E/AndroidRuntime(1234): at dalvik.system.NativeStart.main(Native Method)
That line LearnActivity.java:113 is where I tell the current intent to go to the new one.
Thanks!
.ProductStrategyActivity
replace the above word in your manifeast file with below
.content.directory.ProductStrategyActivity
The android:name in the Manifest entry can either be the absolute package name or a relative namespace relative to the namespace of the application.
But if there is a problem with the Manifest entry, you wont get an NPE. Something else must be wrong.

FBReaderJ crashes with java.lang.UnsatisfiedLinkError: Library LineBreak not found

I have downloaded FBReaderJ project from gitHub and struggling to make it run on my emulator.I get the folloing error in my logcat:
04-27 16:40:36.750: WARN/dalvikvm(200): Exception Ljava/lang/UnsatisfiedLinkError; thrown during Lorg/vimgadgets/linebreak/LineBreaker;.
04-27 16:40:36.750: WARN/dalvikvm(200): threadid=19: thread exiting with uncaught exception (group=0x4001b188)
04-27 16:40:36.801: WARN/System.err(200): java.lang.ExceptionInInitializerError
04-27 16:40:36.801: WARN/System.err(200): at org.geometerplus.zlibrary.text.view.ZLTextParagraphCursor.fill(ZLTextParagraphCursor.java:195)
04-27 16:40:36.801: WARN/System.err(200): at org.geometerplus.zlibrary.text.view.ZLTextParagraphCursor.(ZLTextParagraphCursor.java:178)
04-27 16:40:36.809: WARN/System.err(200): at org.geometerplus.zlibrary.text.view.ZLTextParagraphCursor.cursor(ZLTextParagraphCursor.java:184)
04-27 16:40:36.809: WARN/System.err(200): at org.geometerplus.zlibrary.text.view.ZLTextView.setModel(ZLTextView.java:74)
04-27 16:40:36.809: WARN/System.err(200): at org.geometerplus.fbreader.fbreader.FBView.setModel(FBView.java:47)
04-27 16:40:36.809: WARN/System.err(200): at org.geometerplus.fbreader.fbreader.FBReaderApp.openBookInternal(FBReaderApp.java:231)
04-27 16:40:36.809: WARN/System.err(200): at org.geometerplus.fbreader.fbreader.FBReaderApp$1.run(FBReaderApp.java:145)
04-27 16:40:36.809: WARN/System.err(200): at org.geometerplus.android.util.UIUtil$2.run(UIUtil.java:78)
04-27 16:40:36.809: WARN/System.err(200): at java.lang.Thread.run(Thread.java:1096)
04-27 16:40:36.809: WARN/System.err(200): Caused by: java.lang.UnsatisfiedLinkError: Library LineBreak not found
04-27 16:40:36.809: WARN/System.err(200): at java.lang.Runtime.loadLibrary(Runtime.java:489)
04-27 16:40:36.809: WARN/System.err(200): at java.lang.System.loadLibrary(System.java:557)
04-27 16:40:36.809: WARN/System.err(200): at org.vimgadgets.linebreak.LineBreaker.(LineBreaker.java:5)
I have installed and successfully compiled the NDK.
Please help!!!!
it shows that u are not having JNI folder in your project & u may not have the native library file("example.so") of it. (.so) is the extension of library file. to build this .so file u must need android NDK & a software called "cygwin" which helps to build the native file from JNI folder

Categories

Resources