HttpClient VerifyError android - android

I am using **HttpClient 4.4.1*. When I create a CloseableHttpClient object, its thrown verifyError. How can I fix it?
Here is the line which thrown error:
CloseableHttpClient client = HttpClients.createDefault();
Error message:
05-06 18:22:10.911: E/AndroidRuntime(9641): FATAL EXCEPTION: AsyncTask #1
05-06 18:22:10.911: E/AndroidRuntime(9641): java.lang.RuntimeException: An error occured while executing doInBackground()
05-06 18:22:10.911: E/AndroidRuntime(9641): at android.os.AsyncTask$3.done(AsyncTask.java:299)
05-06 18:22:10.911: E/AndroidRuntime(9641): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
05-06 18:22:10.911: E/AndroidRuntime(9641): at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
05-06 18:22:10.911: E/AndroidRuntime(9641): at java.util.concurrent.FutureTask.run(FutureTask.java:239)
05-06 18:22:10.911: E/AndroidRuntime(9641): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
05-06 18:22:10.911: E/AndroidRuntime(9641): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
05-06 18:22:10.911: E/AndroidRuntime(9641): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
05-06 18:22:10.911: E/AndroidRuntime(9641): at java.lang.Thread.run(Thread.java:841)
05-06 18:22:10.911: E/AndroidRuntime(9641): Caused by: java.lang.VerifyError: org/apache/http/conn/ssl/DefaultHostnameVerifier
05-06 18:22:10.911: E/AndroidRuntime(9641): at org.apache.http.impl.client.HttpClientBuilder.build(HttpClientBuilder.java:901)
05-06 18:22:10.911: E/AndroidRuntime(9641): at org.apache.http.impl.client.HttpClients.createDefault(HttpClients.java:58)
05-06 18:22:10.911: E/AndroidRuntime(9641): at com.srl.mbill.MeterLogin$LoginTask.doInBackground(MeterLogin.java:141)
05-06 18:22:10.911: E/AndroidRuntime(9641): at com.srl.mbill.MeterLogin$LoginTask.doInBackground(MeterLogin.java:1)

Related

Facebook Login example runtime exception

My facebook login application fails with the following runtime error:
07-31 12:47:10.195 1309-1316/com.android.quicksearchbox E/jdwp﹕ Failed writing handshake bytes: Broken pipe (-1 of 14)
07-31 12:47:11.004 1341-1358/com.example.apurva.myapplication E/ActivityThread﹕ Failed to find provider info for com.facebook.katana.provider.AttributionIdProvider
07-31 12:47:11.094 1341-1360/com.example.apurva.myapplication E/AndroidRuntime﹕ FATAL EXCEPTION: AsyncTask #2
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:278)
at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
at java.util.concurrent.FutureTask.run(FutureTask.java:137)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:208)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)
Caused by: java.lang.NullPointerException
at java.util.concurrent.ConcurrentHashMap.containsKey(ConcurrentHashMap.java:781)
at com.facebook.internal.Utility.queryAppSettings(Utility.java:802)
at com.facebook.login.widget.LoginButton$1.doInBackground(LoginButton.java:502)
at com.facebook.login.widget.LoginButton$1.doInBackground(LoginButton.java:499)
at android.os.AsyncTask$2.call(AsyncTask.java:264)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
            at java.util.concurrent.FutureTask.run(FutureTask.java:137)
            at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:208)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
            at java.lang.Thread.run(Thread.java:856)
A few pointers on what I have done till now:
1)Followed all the requirements in Facebook's Getting Started post.
2)Added the meta-data to the XML.
3)Added the key-hash to facebook
If you see any particular files that might be causing the problem and want to see it before answering, do let me know.

Unable to connect with local server via android device

installed XAMPP server, created database and successfully accessed it from chrome browser as well as from android emulator. However whenever i try to run application from my Samsung device, its refusing to connect my IP address.
My IP address is not registered in DNS.
I tried:
1) accessing from url- 127.0.0.1 and localhost
2) modified httpd.conf and httpd-xampp.conf file- changed to Require all granted permission
3) uninstalled my Antivirus
4) changed firewall and proxy setting
5) Created new Inbound Rule in firewall advance security
6) re typed INTERNET permission
7) wrote httpPost.setHeader("Accept", "application/json"); in code
Still Im getting following error:
W/IInputConnectionWrapper(22232): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper(22232): setComposingText on inactive InputConnection
W/IInputConnectionWrapper(22232): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper(22232): setComposingText on inactive InputConnection
D/request!(22232): starting
W/System.err(22232): org.apache.http.conn.HttpHostConnectException: Connection to
http://192.XXX.X.XXX refused
W/System.err(22232): at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:183)
W/System.err(22232): at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
W/System.err(22232): at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
W/System.err(22232): at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360)
W/System.err(22232): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
W/System.err(22232): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
W/System.err(22232): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
W/System.err(22232): at com.example.mysqltest.JSONParser.makeHttpRequest(JSONParser.java:111)
W/System.err(22232): at com.example.mysqltest.Login$AttemptLogin.doInBackground(Login.java:121)
W/System.err(22232): at com.example.mysqltest.Login$AttemptLogin.doInBackground(Login.java:1)
W/System.err(22232): at android.os.AsyncTask$2.call(AsyncTask.java:287)
W/System.err(22232): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
W/System.err(22232): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
W/System.err(22232): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
W/System.err(22232): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
W/System.err(22232): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
W/System.err(22232): at java.lang.Thread.run(Thread.java:856)
W/System.err(22232): Caused by: java.net.ConnectException: failed to connect to /192.168.0.114 (port 80): connect failed: ETIMEDOUT (Connection timed out)
W/System.err(22232): at libcore.io.IoBridge.connect(IoBridge.java:114)
W/System.err(22232): at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)
W/System.err(22232): at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:460)
W/System.err(22232): at java.net.Socket.connect(Socket.java:832)
W/System.err(22232): at `enter code here`org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:119)
W/System.err(22232): at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:144)
W/System.err(22232): ... 16 more
W/System.err(22232): Caused by: libcore.io.ErrnoException: connect failed: ETIMEDOUT (Connection timed out)
W/System.err(22232): at libcore.io.Posix.connect(Native Method)
W/System.err(22232): at libcore.io.BlockGuardOs.connect(BlockGuardOs.java:85)
W/System.err(22232): at libcore.io.IoBridge.connectErrno(IoBridge.java:127)
W/System.err(22232): at libcore.io.IoBridge.connect(IoBridge.java:112)
W/System.err(22232): ... 21 more
E/Buffer Error(22232): Error converting result java.lang.NullPointerException
E/JSON Parser(22232): Error parsing data org.json.JSONException: End of input at character 0 of
W/dalvikvm(22232): threadid=12: thread exiting with uncaught exception (group=0x41180438)
E/AndroidRuntime(22232): FATAL EXCEPTION: AsyncTask #1
E/AndroidRuntime(22232): java.lang.RuntimeException: An error occured while executing doInBackground()
E/AndroidRuntime(22232): at android.os.AsyncTask$3.done(AsyncTask.java:299)
E/AndroidRuntime(22232): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
E/AndroidRuntime(22232): at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
E/AndroidRuntime(22232): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
E/AndroidRuntime(22232): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
E/AndroidRuntime(22232): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
E/AndroidRuntime(22232): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
E/AndroidRuntime(22232): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
E/AndroidRuntime(22232): at java.lang.Thread.run(Thread.java:856)
E/AndroidRuntime(22232): Caused by: java.lang.NullPointerException
E/AndroidRuntime(22232): at com.example.mysqltest.Login$AttemptLogin.doInBackground(Login.java:125)
E/AndroidRuntime(22232): at com.example.mysqltest.Login$AttemptLogin.doInBackground(Login.java:1)
E/AndroidRuntime(22232): at android.os.AsyncTask$2.call(AsyncTask.java:287)
E/AndroidRuntime(22232): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
E/AndroidRuntime(22232): ... 5 more
I/Choreographer(22232): Skipped 1143 frames! The application may be doing too much work on its main thread.
E/WindowManager(22232): Activity com.example.mysqltest.Login has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView#41bea8a8 that was originally added here
E/WindowManager(22232): android.view.WindowLeaked: Activity com.example.mysqltest.Login has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView#41bea8a8 that was originally added here
E/WindowManager(22232): at android.view.ViewRootImpl.<init>(ViewRootImpl.java:419)
E/WindowManager(22232): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:322)
E/WindowManager(22232): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:234)
E/WindowManager(22232): at android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:153)
E/WindowManager(22232): at android.view.Window$LocalWindowManager.addView(Window.java:557)
E/WindowManager(22232): at android.app.Dialog.show(Dialog.java:277)
E/WindowManager(22232): at com.example.mysqltest.Login$AttemptLogin.onPreExecute(Login.java:103)
E/WindowManager(22232): at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:586)
E/WindowManager(22232): at android.os.AsyncTask.execute(AsyncTask.java:534)
E/WindowManager(22232): at com.example.mysqltest.Login.onClick(Login.java:77)
E/WindowManager(22232): at android.view.View.performClick(View.java:4191)
E/WindowManager(22232): at android.view.View$PerformClick.run(View.java:17229)
E/WindowManager(22232): at android.os.Handler.handleCallback(Handler.java:615)
E/WindowManager(22232): at android.os.Handler.dispatchMessage(Handler.java:92)
E/WindowManager(22232): at android.os.Looper.loop(Looper.java:137)
E/WindowManager(22232): at android.app.ActivityThread.main(ActivityThread.java:4960)
E/WindowManager(22232): at java.lang.reflect.Method.invokeNative(Native Method)
E/WindowManager(22232): at java.lang.reflect.Method.invoke(Method.java:511)
E/WindowManager(22232): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
E/WindowManager(22232): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
E/WindowManager(22232): at dalvik.system.NativeStart.main(Native Method)"
Please try to check your local IP address of your PC. Connect the phone to the same network (WIFI). Then use the following address/port to connect to your PC.
In Android:
URL: your_pc_local_ip
PORT: 80 (but I think it is not mandatory)
I use in this way and it is working properly for me.

Source Attachment does not contain the source for the file ThreadPoolExecutor.class

I am working on an android project which uses the webservice I have created. It was working fine few minutes earlier but suddenly it started to give below error.
the source attachment does not contain the source for the file threadpoolexecutor.class
Logcat error is :
07-10 11:30:22.844: E/AndroidRuntime(1707): FATAL EXCEPTION: AsyncTask #1
07-10 11:30:22.844: E/AndroidRuntime(1707): java.lang.RuntimeException: An error occured while executing doInBackground()
07-10 11:30:22.844: E/AndroidRuntime(1707): at android.os.AsyncTask$3.done(AsyncTask.java:299)
07-10 11:30:22.844: E/AndroidRuntime(1707): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
07-10 11:30:22.844: E/AndroidRuntime(1707): at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
07-10 11:30:22.844: E/AndroidRuntime(1707): at java.util.concurrent.FutureTask.run(FutureTask.java:239)
07-10 11:30:22.844: E/AndroidRuntime(1707): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
07-10 11:30:22.844: E/AndroidRuntime(1707): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
07-10 11:30:22.844: E/AndroidRuntime(1707): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
07-10 11:30:22.844: E/AndroidRuntime(1707): at java.lang.Thread.run(Thread.java:856)
07-10 11:30:22.844: E/AndroidRuntime(1707): Caused by: java.lang.NullPointerException
07-10 11:30:22.844: E/AndroidRuntime(1707): at com.example.backgroundTask.BackgroundTask.RegisterUser(BackgroundTask.java:125)
07-10 11:30:22.844: E/AndroidRuntime(1707): at com.example.backgroundTask.BackgroundTask.doInBackground(BackgroundTask.java:65)
07-10 11:30:22.844: E/AndroidRuntime(1707): at com.example.backgroundTask.BackgroundTask.doInBackground(BackgroundTask.java:1)
07-10 11:30:22.844: E/AndroidRuntime(1707): at android.os.AsyncTask$2.call(AsyncTask.java:287)
07-10 11:30:22.844: E/AndroidRuntime(1707): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
07-10 11:30:22.844: E/AndroidRuntime(1707): ... 4 more
07-10 11:30:23.174: W/Trace(1707): Unexpected value from nativeGetEnabledTags: 0
Please tell me what may cause this error or let me know if more information required.
Thanks & Regards..
Sourabh
I found it. I was checking the value and if everything if fine it will return null from the web service. and that null value I was trying to convert to string value and hence geting the above error.
Thanks CommonsWare.

Support v4 CursorLoader - Very strange error only on few devices

Only few users are having the following error, I really don't know where to look for this error as the sql database file is at right position, the sql manager open it and then don't find a table that is there !!
I noted that this happened just when using the CursorLoader of support V4 library, probably the error is inside that code ?
Any suggestion or answer will be helpfully.
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.support.v4.b.r.done(SourceFile:137)
at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
at java.util.concurrent.FutureTask.run(FutureTask.java:137)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)Caused by: android.database.sqlite.SQLiteException: no such table: records: , while compiling: SELECT _id, name, isbackground FROM records ORDER BY _id ASC
at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method)
at android.database.sqlite.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:68)
at android.database.sqlite.SQLiteProgram.compileSql(SQLiteProgram.java:143)
at android.database.sqlite.SQLiteProgram.compileAndbindAllArgs(SQLiteProgram.java:361)
at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:127)
at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:94)
at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:53)
at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:47)
at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1564)
at android.database.sqlite.SQLiteQueryBuilder.query(SQLiteQueryBuilder.java:354)
at android.database.sqlite.SQLiteQueryBuilder.query(SQLiteQueryBuilder.java:291)
at com.voicepro.db.RecordsContentProvider.query(SourceFile:289)
at android.content.ContentProvider$Transport.query(ContentProvider.java:178)
at android.content.ContentResolver.query(ContentResolver.java:311)
at android.support.v4.b.f.loadInBackground(SourceFile:49)
at android.support.v4.b.f.loadInBackground(SourceFile:35)
at android.support.v4.b.a.onLoadInBackground(SourceFile:240)
at android.support.v4.b.b.doInBackground(SourceFile:51)
at android.support.v4.b.b.doInBackground(SourceFile:40)
at android.support.v4.b.q.call(SourceFile:123)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305) android.database.sqlite.SQLiteException: no such table: records: , while compiling: SELECT _id, name, isbackground FROM records ORDER BY _id ASC
at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method)
at android.database.sqlite.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:68)
at android.database.sqlite.SQLiteProgram.compileSql(SQLiteProgram.java:143)
at android.database.sqlite.SQLiteProgram.compileAndbindAllArgs(SQLiteProgram.java:361)
at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:127)
at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:94)
at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:53)
at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:47)
at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1564)
at android.database.sqlite.SQLiteQueryBuilder.query(SQLiteQueryBuilder.java:354)
at android.database.sqlite.SQLiteQueryBuilder.query(SQLiteQueryBuilder.java:291)
at com.voicepro.db.RecordsContentProvider.query(SourceFile:289)
at android.content.ContentProvider$Transport.query(ContentProvider.java:178)
at android.content.ContentResolver.query(ContentResolver.java:311)
at android.support.v4.b.f.loadInBackground(SourceFile:49)
at android.support.v4.b.f.loadInBackground(SourceFile:35)
at android.support.v4.b.a.onLoadInBackground(SourceFile:240)
at android.support.v4.b.b.doInBackground(SourceFile:51)
at android.support.v4.b.b.doInBackground(SourceFile:40)
at android.support.v4.b.q.call(SourceFile:123)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
at java.util.concurrent.FutureTask.run(FutureTask.java:137)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)
Might be a corrupt or incomplete database. Check on what devices this happens, and possibly try to get a copy of the DB. Not directly related, but try not to obfuscate the support library, some code depend son class/method names.

Android: can't replace one fragment with another

I need to replace a Fragment in one Activity with another Fragment, below is the layer file of the Activity:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/home_layout_container">
<fragment android:name="com.foo.FragA"
android:id="#+id/home_list"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</FrameLayout>
so by default there is FragA, now I want to replace it with FragB in activity, I did:
public void onRegionClicked(Region region) {
RegionInfoFragment rif = RegionInfoFragment.newInstance(region);
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.replace(R.id.home_list, rif);
}
But I got exception:
>6:24:40.685: ERROR/AndroidRuntime(9194): Uncaught handler: thread main exiting due to uncaught exception
05-06 16:24:40.692: ERROR/AndroidRuntime(9194): java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
05-06 16:24:40.692: ERROR/AndroidRuntime(9194): at android.view.ViewGroup.addViewInner(ViewGroup.java:1857)
05-06 16:24:40.692: ERROR/AndroidRuntime(9194): at android.view.ViewGroup.addView(ViewGroup.java:1752)
05-06 16:24:40.692: ERROR/AndroidRuntime(9194): at android.view.ViewGroup.addView(ViewGroup.java:1709)
05-06 16:24:40.692: ERROR/AndroidRuntime(9194): at android.view.ViewGroup.addView(ViewGroup.java:1689)
05-06 16:24:40.692: ERROR/AndroidRuntime(9194): at android.support.v4.app.NoSaveStateFrameLayout.wrap(NoSaveStateFrameLayout.java:40)
05-06 16:24:40.692: ERROR/AndroidRuntime(9194): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:743)
05-06 16:24:40.692: ERROR/AndroidRuntime(9194): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:933)
05-06 16:24:40.692: ERROR/AndroidRuntime(9194): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:578)
05-06 16:24:40.692: ERROR/AndroidRuntime(9194): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1219)
05-06 16:24:40.692: ERROR/AndroidRuntime(9194): at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:380)
05-06 16:24:40.692: ERROR/AndroidRuntime(9194): at android.os.Handler.handleCallback(Handler.java:587)
05-06 16:24:40.692: ERROR/AndroidRuntime(9194): at android.os.Handler.dispatchMessage(Handler.java:92)
05-06 16:24:40.692: ERROR/AndroidRuntime(9194): at android.os.Looper.loop(Looper.java:123)
05-06 16:24:40.692: ERROR/AndroidRuntime(9194): at android.app.ActivityThread.main(ActivityThread.java:4363)
05-06 16:24:40.692: ERROR/AndroidRuntime(9194): at java.lang.reflect.Method.invokeNative(Native Method)
05-06 16:24:40.692: ERROR/AndroidRuntime(9194): at java.lang.reflect.Method.invoke(Method.java:521)
05-06 16:24:40.692: ERROR/AndroidRuntime(9194): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
05-06 16:24:40.692: ERROR/AndroidRuntime(9194): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
05-06 16:24:40.692: ERROR/AndroidRuntime(9194): at dalvik.system.NativeStart.main(Native Method)
What can I do?
Thanks!
You cannot replace a fragment defined statically in the layout file. You can only replace fragments that you added dynamically via a FragmentTransaction.
Try to commit() at the end of the ft, you need to commit() your changes to let it know.
getFragmentManger()
.beginTransaction
.replace(R.id.frame,Yourfragment.newInstance(),null)
.addtobackstack
.commit();
People always say I am one-liner, so here is one-liner solution for you

Categories

Resources