Android Chronotmeter onChronometerTick stackoverflowerror? - android

I am writting a code in Android to develop a Chronometer app. But i am facing some of the error while i am trying to reset the Chronometer on certain time.
MyCode:
mChronometer.setBase(SystemClock.elapsedRealtime() - 86396000);
mChronometer.start();
mChronometer.setOnChronometerTickListener(new Chronometer.OnChronometerTickListener()
{
#Override
public void onChronometerTick(Chronometer chronometer)
{
long myElapsedMillis = SystemClock.elapsedRealtime() - chronometer.getBase();
if(myElapsedMillis>=86400000)
{
chronometer.stop();
chronometer.setBase(0);
chronometer.start();
}
}
} );
Error:
08-18 02:30:16.793: E/AndroidRuntime(23075): FATAL EXCEPTION: main
08-18 02:30:16.793: E/AndroidRuntime(23075): java.lang.StackOverflowError
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.graphics.Paint.getTextRunAdvances(Paint.java:1845)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.graphics.Paint.getTextRunAdvances(Paint.java:1818)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.text.TextLine.handleText(TextLine.java:755)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.text.TextLine.handleRun(TextLine.java:907)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.text.TextLine.measureRun(TextLine.java:414)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.text.TextLine.measure(TextLine.java:293)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.text.TextLine.metrics(TextLine.java:267)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.text.BoringLayout.isBoring(BoringLayout.java:308)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.TextView.makeSingleLayout(TextView.java:6025)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.TextView.makeNewLayout(TextView.java:5917)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.TextView.checkForRelayout(TextView.java:6501)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.TextView.setText(TextView.java:3729)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.TextView.setText(TextView.java:3587)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.TextView.setText(TextView.java:3562)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.updateText(Chronometer.java:250)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.updateRunning(Chronometer.java:257)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.start(Chronometer.java:188)
08-18 02:30:16.793: E/AndroidRuntime(23075): at com.example.androidchronometer.MainActivity$1.onChronometerTick(MainActivity.java:46)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.dispatchChronometerTick(Chronometer.java:279)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.updateRunning(Chronometer.java:258)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.start(Chronometer.java:188)
08-18 02:30:16.793: E/AndroidRuntime(23075): at com.example.androidchronometer.MainActivity$1.onChronometerTick(MainActivity.java:46)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.dispatchChronometerTick(Chronometer.java:279)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.updateRunning(Chronometer.java:258)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.start(Chronometer.java:188)
08-18 02:30:16.793: E/AndroidRuntime(23075): at com.example.androidchronometer.MainActivity$1.onChronometerTick(MainActivity.java:46)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.dispatchChronometerTick(Chronometer.java:279)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.updateRunning(Chronometer.java:258)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.start(Chronometer.java:188)
08-18 02:30:16.793: E/AndroidRuntime(23075): at com.example.androidchronometer.MainActivity$1.onChronometerTick(MainActivity.java:46)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.dispatchChronometerTick(Chronometer.java:279)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.updateRunning(Chronometer.java:258)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.start(Chronometer.java:188)
08-18 02:30:16.793: E/AndroidRuntime(23075): at com.example.androidchronometer.MainActivity$1.onChronometerTick(MainActivity.java:46)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.dispatchChronometerTick(Chronometer.java:279)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.updateRunning(Chronometer.java:258)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.start(Chronometer.java:188)
08-18 02:30:16.793: E/AndroidRuntime(23075): at com.example.androidchronometer.MainActivity$1.onChronometerTick(MainActivity.java:46)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.dispatchChronometerTick(Chronometer.java:279)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.updateRunning(Chronometer.java:258)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.start(Chronometer.java:188)
08-18 02:30:16.793: E/AndroidRuntime(23075): at com.example.androidchronometer.MainActivity$1.onChronometerTick(MainActivity.java:46)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.dispatchChronometerTick(Chronometer.java:279)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.updateRunning(Chronometer.java:258)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.start(Chronometer.java:188)
08-18 02:30:16.793: E/AndroidRuntime(23075): at com.example.androidchronometer.MainActivity$1.onChronometerTick(MainActivity.java:46)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.dispatchChronometerTick(Chronometer.java:279)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.updateRunning(Chronometer.java:258)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.start(Chronometer.java:188)
08-18 02:30:16.793: E/AndroidRuntime(23075): at com.example.androidchronometer.MainActivity$1.onChronometerTick(MainActivity.java:46)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.dispatchChronometerTick(Chronometer.java:279)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.updateRunning(Chronometer.java:258)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.start(Chronometer.java:188)
08-18 02:30:16.793: E/AndroidRuntime(23075): at com.example.androidchronometer.MainActivity$1.onChronometerTick(MainActivity.java:46)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.dispatchChronometerTick(Chronometer.java:279)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.updateRunning(Chronometer.java:258)
08-18 02:30:16.793: E/AndroidRuntime(23075): at android.widget.Chronometer.start(Chronometer.java:188)
08-18 02:30:16.793: E/AndroidRuntime(23075): at com.example.androidchronometer.MainActivity$1.onChronometerTick
I am facing the StackOverFlowError , while i am trying reset the chronometer on certain time.
Please let me know , how can i get rid of this error , please suggest me what could be the possible solution for this problem.

Set the base to SystemClock.elapsedRealtime() instead of 0:
public void onChronometerTick(Chronometer chronometer)
{
// ...
chronometer.setBase(SystemClock.elapsedRealtime());
chronometer.start();
// ...
}

Related

New to android, can't switch between intents [duplicate]

This question already has answers here:
Activity Declaration in AndroidManifest.xml
(6 answers)
Closed 8 years ago.
I have a button, and when it is clicked I'd like to load a new view.
I am using this main activity class
public class MainActivity extends ActionBarActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void buttonPressed(View v){
Intent i = new Intent(this, SwitchedActivity.class);
startActivity(i);
}
}
And then I'd like to load this other activity
public class SwitchedActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_two);
}
}
So what should happen, is I click the button in activity_main.xml, and then it loads the layout from activity_two.xml.
The problem is, when I click the button, the app just crashes.
I get this logcat stack trace:
08-18 11:36:09.078: E/AndroidRuntime(1232): FATAL EXCEPTION: main
08-18 11:36:09.078: E/AndroidRuntime(1232): Process: com.johncorser.myapp, PID: 1232
08-18 11:36:09.078: E/AndroidRuntime(1232): java.lang.IllegalStateException: Could not execute method of the activity
08-18 11:36:09.078: E/AndroidRuntime(1232): at android.view.View$1.onClick(View.java:3823)
08-18 11:36:09.078: E/AndroidRuntime(1232): at android.view.View.performClick(View.java:4438)
08-18 11:36:09.078: E/AndroidRuntime(1232): at android.view.View$PerformClick.run(View.java:18422)
08-18 11:36:09.078: E/AndroidRuntime(1232): at android.os.Handler.handleCallback(Handler.java:733)
08-18 11:36:09.078: E/AndroidRuntime(1232): at android.os.Handler.dispatchMessage(Handler.java:95)
08-18 11:36:09.078: E/AndroidRuntime(1232): at android.os.Looper.loop(Looper.java:136)
08-18 11:36:09.078: E/AndroidRuntime(1232): at android.app.ActivityThread.main(ActivityThread.java:5017)
08-18 11:36:09.078: E/AndroidRuntime(1232): at java.lang.reflect.Method.invokeNative(Native Method)
08-18 11:36:09.078: E/AndroidRuntime(1232): at java.lang.reflect.Method.invoke(Method.java:515)
08-18 11:36:09.078: E/AndroidRuntime(1232): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
08-18 11:36:09.078: E/AndroidRuntime(1232): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
08-18 11:36:09.078: E/AndroidRuntime(1232): at dalvik.system.NativeStart.main(Native Method)
08-18 11:36:09.078: E/AndroidRuntime(1232): Caused by: java.lang.reflect.InvocationTargetException
08-18 11:36:09.078: E/AndroidRuntime(1232): at java.lang.reflect.Method.invokeNative(Native Method)
08-18 11:36:09.078: E/AndroidRuntime(1232): at java.lang.reflect.Method.invoke(Method.java:515)
08-18 11:36:09.078: E/AndroidRuntime(1232): at android.view.View$1.onClick(View.java:3818)
08-18 11:36:09.078: E/AndroidRuntime(1232): ... 11 more
08-18 11:36:09.078: E/AndroidRuntime(1232): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.johncorser.myapp/com.johncorser.myapp.SwitchedActivity}; have you declared this activity in your AndroidManifest.xml?
08-18 11:36:09.078: E/AndroidRuntime(1232): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1628)
08-18 11:36:09.078: E/AndroidRuntime(1232): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1424)
08-18 11:36:09.078: E/AndroidRuntime(1232): at android.app.Activity.startActivityForResult(Activity.java:3424)
08-18 11:36:09.078: E/AndroidRuntime(1232): at android.app.Activity.startActivityForResult(Activity.java:3385)
08-18 11:36:09.078: E/AndroidRuntime(1232): at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:839)
08-18 11:36:09.078: E/AndroidRuntime(1232): at android.app.Activity.startActivity(Activity.java:3627)
08-18 11:36:09.078: E/AndroidRuntime(1232): at android.app.Activity.startActivity(Activity.java:3595)
08-18 11:36:09.078: E/AndroidRuntime(1232): at com.johncorser.myapp.MainActivity.buttonPressed(MainActivity.java:40)
08-18 11:36:09.078: E/AndroidRuntime(1232): ... 14 more
Fair warning, I'm probably doing something VERY stupid, I'm new.
The answer lies in your logcat:
08-18 11:36:09.078: E/AndroidRuntime(1232): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.johncorser.myapp/com.johncorser.myapp.SwitchedActivity}; have you declared this activity in your AndroidManifest.xml?
So add it to your manifest like so
<activity
android:name="SwitchedActivity"
android:label="Switched">
</activity>
Whenever you add a new activity, be sure to add it to your manifest.
I am pretty certain that you did not declare the second activity in your AndroidManifest.xml file.
You should have in your manifest:
<application ... >
<activity
android:name=".MainActivity"
... >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".SwitchedActivity"
... >
</activity>
...
</application>
Add the second activity to your manifest file. The log you posted clearly states the problem.
Add the following to your manifest:
<activity
android:name=".SwitchedActivity"/>
Please make sure you read the logcats next time or google the logcat message.

SSLHandshakeException: Certificate Exception using HttpURLConnetion with Android 4.2.2

I am struggling with a strange issue, while using HttpURLConnection for webservice api call in Android. I am getting below exception ONLY with Android version 4.2.2. It is working fine in Android 4.0.3, 4.3 and 4.4 and above.
I am using below code for service api call.
HttpURLConnection mConn = (HttpURLConnection)mUrl.openConnection();
mConn.addRequestProperty("Connection", "close");
mConn.setConnectTimeout(CONNECTION_TIMEOUT);
mConn.setReadTimeout(SOCKET_TIMEOUT);
mConn.setUseCaches(true);
mConn.setRequestMethod("POST");
String param = Utils.appendQueryParams(null,this.stringparams);
mConn.setDoInput(true);
mConn.setDoOutput(true);
mConn.setFixedLengthStreamingMode(param.getBytes().length);
mConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
mConn.setRequestProperty("Accept", "application/json");
mConn.connect();
PrintWriter out = new PrintWriter(mConn.getOutputStream());
out.print(param);
out.close();
Here is the Exception (ONLY in Android SDK version 4.2.2)
08-18 11:43:22.663 26427-26485/com.abc.xyz W/System.err﹕ javax.net.ssl.SSLHandshakeException: com.android.org.bouncycastle.jce.exception.ExtCertPathValidatorException: IssuerName(CN=Go Daddy Root Certificate Authority - G2, O="GoDaddy.com, Inc.", L=Scottsdale, ST=Arizona, C=US) does not match SubjectName(CN=Go Daddy Root Certificate Authority - G2, OU=https://certs.godaddy.com/repository/, O="GoDaddy.com, Inc.", L=Scottsdale, ST=Arizona, C=US) of signing certificate.
08-18 11:43:22.833 26427-26485/com.abc.xyz W/System.err﹕ at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:381)
08-18 11:43:22.833 26427-26485/com.abc.xyz W/System.err﹕ at libcore.net.http.HttpConnection.setupSecureSocket(HttpConnection.java:209)
08-18 11:43:22.833 26427-26485/com.abc.xyz W/System.err﹕ at libcore.net.http.HttpsURLConnectionImpl$HttpsEngine.makeSslConnection(HttpsURLConnectionImpl.java:478)
08-18 11:43:22.833 26427-26485/com.abc.xyz W/System.err﹕ at libcore.net.http.HttpsURLConnectionImpl$HttpsEngine.connect(HttpsURLConnectionImpl.java:433)
08-18 11:43:22.833 26427-26485/com.abc.xyz W/System.err﹕ at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:290)
08-18 11:43:22.833 26427-26485/com.abc.xyz W/System.err﹕ at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:240)
08-18 11:43:22.833 26427-26485/com.abc.xyz W/System.err﹕ at libcore.net.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:81)
08-18 11:43:22.833 26427-26485/com.abc.xyz W/System.err﹕ at libcore.net.http.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:165)
08-18 11:43:22.833 26427-26485/com.abc.xyz W/System.err﹕ at com.halomem.android.utils.ServiceCall.executeRequest(ServiceCall.java:86)
08-18 11:43:22.833 26427-26485/com.abc.xyz W/System.err﹕ at com.halomem.android.impl.Session$1.run(Session.java:161)
08-18 11:43:22.833 26427-26485/com.abc.xyz W/System.err﹕ Caused by: java.security.cert.CertificateException: com.android.org.bouncycastle.jce.exception.ExtCertPathValidatorException: IssuerName(CN=Go Daddy Root Certificate Authority - G2, O="GoDaddy.com, Inc.", L=Scottsdale, ST=Arizona, C=US) does not match SubjectName(CN=Go Daddy Root Certificate Authority - G2, OU=https://certs.godaddy.com/repository/, O="GoDaddy.com, Inc.", L=Scottsdale, ST=Arizona, C=US) of signing certificate.
08-18 11:43:22.833 26427-26485/com.abc.xyz W/System.err﹕ at org.apache.harmony.xnet.provider.jsse.TrustManagerImpl.checkTrusted(TrustManagerImpl.java:296)
08-18 11:43:22.833 26427-26485/com.abc.xyz W/System.err﹕ at org.apache.harmony.xnet.provider.jsse.TrustManagerImpl.checkServerTrusted(TrustManagerImpl.java:197)
08-18 11:43:22.833 26427-26485/com.abc.xyz W/System.err﹕ at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.verifyCertificateChain(OpenSSLSocketImpl.java:597)
08-18 11:43:22.833 26427-26485/com.abc.xyz W/System.err﹕ at org.apache.harmony.xnet.provider.jsse.NativeCrypto.SSL_do_handshake(Native Method)
08-18 11:43:22.833 26427-26485/com.abc.xyz W/System.err﹕ at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:378)
08-18 11:43:22.833 26427-26485/com.abc.xyz W/System.err﹕ ... 9 more
08-18 11:43:22.833 26427-26485/com.abc.xyz W/System.err﹕ Caused by: com.android.org.bouncycastle.jce.exception.ExtCertPathValidatorException: IssuerName(CN=Go Daddy Root Certificate Authority - G2, O="GoDaddy.com, Inc.", L=Scottsdale, ST=Arizona, C=US) does not match SubjectName(CN=Go Daddy Root Certificate Authority - G2, OU=https://certs.godaddy.com/repository/, O="GoDaddy.com, Inc.", L=Scottsdale, ST=Arizona, C=US) of signing certificate.
08-18 11:43:22.843 26427-26485/com.abc.xyz W/System.err﹕ at com.android.org.bouncycastle.jce.provider.RFC3280CertPathUtilities.processCertA(RFC3280CertPathUtilities.java:1525)
08-18 11:43:22.843 26427-26485/com.abc.xyz W/System.err﹕ at com.android.org.bouncycastle.jce.provider.PKIXCertPathValidatorSpi.engineValidate(PKIXCertPathValidatorSpi.java:305)
08-18 11:43:22.843 26427-26485/com.abc.xyz W/System.err﹕ at com.sec.android.security.pkix.SecCertPathValidatorSpi.engineValidate(SecCertPathValidatorSpi.java:99)
08-18 11:43:22.843 26427-26485/com.abc.xyz W/System.err﹕ at java.security.cert.CertPathValidator.validate(CertPathValidator.java:190)
08-18 11:43:22.843 26427-26485/com.abc.xyz W/System.err﹕ at org.apache.harmony.xnet.provider.jsse.TrustManagerImpl.checkTrusted(TrustManagerImpl.java:283)
08-18 11:43:22.843 26427-26485/com.abc.xyz W/System.err﹕ ... 13 more
Please suggest in this regard.
Thanks
Himanshu.
Important note
Check your device time is correct or not ?
Seems like authority of certificate is not trusted on your device. Checkout this post: Could not validate certificate signature?

Crash when trying to use DirectionalViewPager (by Jake Wharton)

I looked through all questions on stack overflow with similar problem, but haven't managed to find solution, that suites my case.
I need to implement following structure:
Fragment A is being replaced with fragment B. Fragment B contains ViewPager, that switches fragments C1 and C2. This works great if I use ViewPager from support library, but the problem is, that I need a ViewPager to use vertical swipe. For that purpose I'm using library by Jake Wharton from here https://stackoverflow.com/a/14268702/1220743.
Some code:
A is being replaced by B
Fragment fragment = new FragmentB();
String tag = this.getClass().getName();
FragmentManager fm = getFragmentManager();
fm.beginTransaction().replace(R.id.container, fragment).addToBackStack(tag).commit();
B initializes DirectionalViewPager
DirectionalViewPager viewPager = (DirectionalViewPager)v.findViewById(R.id.view_pager);
FragmentManager fm = getFragmentManager();
viewPager.setAdapter(new MyViewPagerAdapter(fm));
This gives me crash when A switches to B, with following crash stack:
08-18 16:47:02.320: E/AndroidRuntime(29610): FATAL EXCEPTION: main
08-18 16:47:02.320: E/AndroidRuntime(29610): java.lang.IllegalStateException: Recursive entry to executePendingTransactions
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1450)
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:478)
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.support.v4.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:163)
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.support.v4.view.DirectionalViewPager.populate(DirectionalViewPager.java:399)
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.support.v4.view.DirectionalViewPager.onAttachedToWindow(DirectionalViewPager.java:550)
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.view.View.dispatchAttachedToWindow(View.java:13029)
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2683)
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2690)
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2690)
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.view.ViewGroup.addViewInner(ViewGroup.java:3778)
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.view.ViewGroup.addView(ViewGroup.java:3610)
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.view.ViewGroup.addView(ViewGroup.java:3555)
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.view.ViewGroup.addView(ViewGroup.java:3531)
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:949)
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1115)
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1478)
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:446)
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.os.Handler.handleCallback(Handler.java:730)
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.os.Handler.dispatchMessage(Handler.java:92)
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.os.Looper.loop(Looper.java:176)
08-18 16:47:02.320: E/AndroidRuntime(29610): at android.app.ActivityThread.main(ActivityThread.java:5419)
08-18 16:47:02.320: E/AndroidRuntime(29610): at java.lang.reflect.Method.invokeNative(Native Method)
08-18 16:47:02.320: E/AndroidRuntime(29610): at java.lang.reflect.Method.invoke(Method.java:525)
08-18 16:47:02.320: E/AndroidRuntime(29610): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
08-18 16:47:02.320: E/AndroidRuntime(29610): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
08-18 16:47:02.320: E/AndroidRuntime(29610): at dalvik.system.NativeStart.main(Native Method)
Has anyone faced similar problems?
Did you ever find the solution to this? are the two fragments already in a fragment? if so use getChildFragmentManager() whats curious to me is that getFragmentManager makes it look like you are not using support v4 or it would be getSupportFragmentManager no? but by the log, it seems the error is happening when you use the support lib.

app crash when try to combine mp4 videos

I download the latest source code for mp4parser and use this to combine two mp4 files.
When I try to combine two mp4 videos app crashed.
when I run this line of code
MovieCreator.build("mnt/sdcard/CamVideo/0.mp4")
The app crashed with and crash log is
08-11 17:27:49.023: E/AndroidRuntime(24864): FATAL EXCEPTION: main
08-11 17:27:49.023: E/AndroidRuntime(24864): java.lang.ArrayIndexOutOfBoundsException: length=0; index=0
08-11 17:27:49.023: E/AndroidRuntime(24864): at com.googlecode.mp4parser.authoring.samples.DefaultMp4SampleList.<init>(DefaultMp4SampleList.java:52)
08-11 17:27:49.023: E/AndroidRuntime(24864): at com.coremedia.iso.boxes.mdat.SampleList.<init>(SampleList.java:33)
08-11 17:27:49.023: E/AndroidRuntime(24864): at com.googlecode.mp4parser.authoring.Mp4TrackImpl.<init>(Mp4TrackImpl.java:59)
08-11 17:27:49.023: E/AndroidRuntime(24864): at com.googlecode.mp4parser.authoring.container.mp4.MovieCreator.build(MovieCreator.java:58)
08-11 17:27:49.023: E/AndroidRuntime(24864): at com.googlecode.mp4parser.authoring.container.mp4.MovieCreator.build(MovieCreator.java:39)
08-11 17:27:49.023: E/AndroidRuntime(24864): at com.coderzheaven.pack.CustomCameraActivity.MergeVideos(CustomCameraActivity.java:200)
08-11 17:27:49.023: E/AndroidRuntime(24864): at com.coderzheaven.pack.CustomCameraActivity$1.onClick(CustomCameraActivity.java:108)
08-11 17:27:49.023: E/AndroidRuntime(24864): at android.view.View.performClick(View.java:4274)
08-11 17:27:49.023: E/AndroidRuntime(24864): at android.view.View$PerformClick.run(View.java:17357)
08-11 17:27:49.023: E/AndroidRuntime(24864): at android.os.Handler.handleCallback(Handler.java:615)
08-11 17:27:49.023: E/AndroidRuntime(24864): at android.os.Handler.dispatchMessage(Handler.java:92)
08-11 17:27:49.023: E/AndroidRuntime(24864): at android.os.Looper.loop(Looper.java:137)
08-11 17:27:49.023: E/AndroidRuntime(24864): at android.app.ActivityThread.main(ActivityThread.java:4949)
08-11 17:27:49.023: E/AndroidRuntime(24864): at java.lang.reflect.Method.invokeNative(Native Method)
08-11 17:27:49.023: E/AndroidRuntime(24864): at java.lang.reflect.Method.invoke(Method.java:511)
08-11 17:27:49.023: E/AndroidRuntime(24864): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1043)
08-11 17:27:49.023: E/AndroidRuntime(24864): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:810)
08-11 17:27:49.023: E/AndroidRuntime(24864): at dalvik.system.NativeStart.main(Native Method)
I am using the same properties files that is in sample code "isoparser-custom.properties" and "isoparser-default.properties"
I am expecting movie object should build properly. Can anyone tell me what I am doing wrong in this or can send me fully function code that merge two mp4 files.
EDITED:
I download this file "isoparser-1.0.2.jar" from maven project (http://repo1.maven.org/maven2/com/googlecode/mp4parser/isoparser/1.0.2/) and but app crashed with this crash report
08-18 17:32:20.571: E/AndroidRuntime(31446): FATAL EXCEPTION: main
08-18 17:32:20.571: E/AndroidRuntime(31446): java.lang.ExceptionInInitializerError
08-18 17:32:20.571: E/AndroidRuntime(31446): at java.lang.Class.classForName(Native Method)
08-18 17:32:20.571: E/AndroidRuntime(31446): at java.lang.Class.forName(Class.java:217)
08-18 17:32:20.571: E/AndroidRuntime(31446): at java.lang.Class.forName(Class.java:172)
08-18 17:32:20.571: E/AndroidRuntime(31446): at com.coremedia.iso.PropertyBoxParserImpl.createBox(PropertyBoxParserImpl.java:86)
08-18 17:32:20.571: E/AndroidRuntime(31446): at com.coremedia.iso.AbstractBoxParser.parseBox(AbstractBoxParser.java:102)
08-18 17:32:20.571: E/AndroidRuntime(31446): at com.googlecode.mp4parser.BasicContainer.next(BasicContainer.java:155)
08-18 17:32:20.571: E/AndroidRuntime(31446): at com.googlecode.mp4parser.BasicContainer.hasNext(BasicContainer.java:131)
08-18 17:32:20.571: E/AndroidRuntime(31446): at com.googlecode.mp4parser.util.LazyList$1.hasNext(LazyList.java:55)
08-18 17:32:20.571: E/AndroidRuntime(31446): at com.coremedia.iso.IsoFile.getMovieBox(IsoFile.java:109)
08-18 17:32:20.571: E/AndroidRuntime(31446): at com.googlecode.mp4parser.authoring.container.mp4.MovieCreator.build(MovieCreator.java:48)
08-18 17:32:20.571: E/AndroidRuntime(31446): at com.googlecode.mp4parser.authoring.container.mp4.MovieCreator.build(MovieCreator.java:35)
08-18 17:32:20.571: E/AndroidRuntime(31446): at com.coderzheaven.pack.CustomCameraActivity.MergeVideos(CustomCameraActivity.java:200)
08-18 17:32:20.571: E/AndroidRuntime(31446): at com.coderzheaven.pack.CustomCameraActivity$1.onClick(CustomCameraActivity.java:108)
08-18 17:32:20.571: E/AndroidRuntime(31446): at android.view.View.performClick(View.java:3517)
08-18 17:32:20.571: E/AndroidRuntime(31446): at android.view.View$PerformClick.run(View.java:14155)
08-18 17:32:20.571: E/AndroidRuntime(31446): at android.os.Handler.handleCallback(Handler.java:605)
08-18 17:32:20.571: E/AndroidRuntime(31446): at android.os.Handler.dispatchMessage(Handler.java:92)
08-18 17:32:20.571: E/AndroidRuntime(31446): at android.os.Looper.loop(Looper.java:137)
08-18 17:32:20.571: E/AndroidRuntime(31446): at android.app.ActivityThread.main(ActivityThread.java:4666)
08-18 17:32:20.571: E/AndroidRuntime(31446): at java.lang.reflect.Method.invokeNative(Native Method)
08-18 17:32:20.571: E/AndroidRuntime(31446): at java.lang.reflect.Method.invoke(Method.java:511)
08-18 17:32:20.571: E/AndroidRuntime(31446): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:809)
08-18 17:32:20.571: E/AndroidRuntime(31446): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:576)
08-18 17:32:20.571: E/AndroidRuntime(31446): at dalvik.system.NativeStart.main(Native Method)
08-18 17:32:20.571: E/AndroidRuntime(31446): Caused by: java.lang.NoClassDefFoundError: org.aspectj.runtime.reflect.Factory
08-18 17:32:20.571: E/AndroidRuntime(31446): at com.coremedia.iso.boxes.FileTypeBox.ajc$preClinit(FileTypeBox.java:1)
08-18 17:32:20.571: E/AndroidRuntime(31446): at com.coremedia.iso.boxes.FileTypeBox.<clinit>(FileTypeBox.java:1)
08-18 17:32:20.571: E/AndroidRuntime(31446): ... 24 more
you have not invoked the aspectJ compiler/compile time weaving when you were building the mp4parser on your own. Please either use a precompiled version - they are available on maven central - or make sure that you invoke the compile time weaving.
Newer version than on Maven Central are available in Sonatype OSS staging repositories. In the header of the repository tab please select "Nexus Managed Repositories" (instead of User Managed Repositories) and search for mp4parser.
If you do not use a dependency management tool such as maven or gradle please also make sure that you include the AspectJ runtime jar (at the moment version 1.8.0).
Grüße,
Sebastian

Service not Available - Geocoder Android [duplicate]

This question already has answers here:
Why is Android Geocoder throwing a "Service not Available" exception?
(6 answers)
Closed 9 years ago.
I have a little problem with the geocoder to get latitude and lontitude from an address :
This is my code:
for (Garage g : XMLGarage) {
List<Address> address;
address = coder.getFromLocationName(
g.getAddress(), 5);
if (address != null) {
Address location = address.get(0);
g.setLatitude(location.getLatitude());
g.setLongitude(location.getLongitude());
...
The error is :
08-18 14:28:56.026: WARN/System.err(359): java.io.IOException: Service not Available
08-18 14:28:56.026: WARN/System.err(359): at
android.location.Geocoder.getFromLocationName(Geocoder.java:178)
08-18 14:28:56.026: WARN/System.err(359): at
com.amt.android.garage.Garage.postData(Garage.java:269)
08-18 14:28:56.026: WARN/System.err(359): at
com.amt.android.garage.GarageForm$2.onClick(GarageForm.java:86)
08-18 14:28:56.026: WARN/System.err(359): at
android.view.View.performClick(View.java:2485)
08-18 14:28:56.026: WARN/System.err(359): at
android.view.View$PerformClick.run(View.java:9080)
08-18 14:28:56.036: WARN/System.err(359): at
android.os.Handler.handleCallback(Handler.java:587)
08-18 14:28:56.036: WARN/System.err(359): at
android.os.Handler.dispatchMessage(Handler.java:92)
08-18 14:28:56.036: WARN/System.err(359): at
android.os.Looper.loop(Looper.java:130)
08-18 14:28:56.036: WARN/System.err(359): at
android.app.ActivityThread.main(ActivityThread.java:3683)
08-18 14:28:56.036: WARN/System.err(359): at
java.lang.reflect.Method.invokeNative(Native Method)
08-18 14:28:56.036: WARN/System.err(359): at
java.lang.reflect.Method.invoke(Method.java:507)
08-18 14:28:56.036: WARN/System.err(359): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
08-18 14:28:56.046: WARN/System.err(359): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
08-18 14:28:56.046: WARN/System.err(359): at dalvik.system.NativeStart.main(Native
Method)
There is a problem recently with android devices and the geocoder not working:
http://code.google.com/p/android/issues/detail?id=38009
A reboot seems to fix the issue
You will get this error occasionally if the GeoCoding provider fails and is unable to geocode your location.
See these relevant posts:
Geocoder.getFromLocation throws Exception
Geocoder.getFromLocation throws IOException on Android emulator
If this is not the case, make sure you have the Internet permission in your Manifest:
<uses-permission android:name="android.permission.INTERNET" />
Try updating Location first. Like below
locationManager.requestLocationUpdates(bestProvider, 20000, 1, this);
refer to here.

Categories

Resources