java - error in google login fragment, W/IInputConnectionWrapper(20367): showStatusIcon on inactive InputConnection -
i have error when click google login button: w/iinputconnectionwrapper(20367): showstatusicon on inactive inputconnection don't know how have problem, read error due connection not closed earlier not understand what. please me
`*package com.amuse.facebooktutorial; public class googleloginfragment extends fragment implements onclicklistener, connectioncallbacks, onconnectionfailedlistener { private static final int rc_sign_in = 0; private static final int result_ok = 0; // logcat tag private static final string tag = "mainactivity"; // google client interact google api private googleapiclient mgoogleapiclient; private static final int req_sign_in_required = 55664; /** * flag indicating pendingintent in progress , prevents * starting further intents. */ private boolean mintentinprogress; private boolean msigninclicked; private connectionresult mconnectionresult; private signinbutton btnsignin; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); } @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { // todo auto-generated method stub view view = inflater.inflate(r.layout.google_login_layout, container, false); btnsignin = (signinbutton) view.findviewbyid(r.id.google_login_button); mgoogleapiclient = new googleapiclient.builder(getactivity()) .addconnectioncallbacks(this) .addonconnectionfailedlistener(this).addapi(plus.api) .addscope(plus.scope_plus_login).build(); btnsignin.setonclicklistener(this); try { if (plus.peopleapi.getcurrentperson(mgoogleapiclient) != null) { person currentperson = plus.peopleapi .getcurrentperson(mgoogleapiclient); string email = plus.accountapi.getaccountname(mgoogleapiclient); string id = currentperson.getid()+"$google"; string token = new retrievetokentask().execute(email).tostring(); ((mainactivity)getactivity()).googlelogin(id, token); } else { toast.maketext(getactivity(), "person information null", toast.length_long).show(); } } catch (exception e) { e.printstacktrace(); } return view; } public void onstart() { super.onstart(); mgoogleapiclient.connect(); } public void onstop() { super.onstop(); if (mgoogleapiclient.isconnected()) { mgoogleapiclient.disconnect(); } } /** * method resolve signin errors * */ private void resolvesigninerror() { if (mconnectionresult.hasresolution()) { try { mintentinprogress = true; mconnectionresult.startresolutionforresult(getactivity(), rc_sign_in); } catch (sendintentexception e) { mintentinprogress = false; mgoogleapiclient.connect(); } } } @override public void onconnectionfailed(connectionresult result) { if (!result.hasresolution()) { googleplayservicesutil.geterrordialog(result.geterrorcode(), getactivity(), 0).show(); return; } if (!mintentinprogress) { // store connectionresult later usage mconnectionresult = result; if (msigninclicked) { // user has clicked 'sign-in' attempt // resolve // errors until user signed in, or cancel. resolvesigninerror(); } } } @override public void onactivityresult(int requestcode, int responsecode, intent intent) { if (requestcode == rc_sign_in) { if (responsecode != result_ok) { msigninclicked = false; } mintentinprogress = false; if (!mgoogleapiclient.isconnecting()) { mgoogleapiclient.connect(); } } } @override public void onconnected(bundle bundle) { msigninclicked = false; toast.maketext(getactivity(), "user connected!", toast.length_long).show(); } @override public void onconnectionsuspended(int arg0) { mgoogleapiclient.connect(); } /** * button on click listener * */ @override public void onclick(view v) { switch (v.getid()) { case r.id.google_login_button: // signin button clicked signinwithgplus(); break; } } /** * sign-in google * */ private void signinwithgplus() { if (!mgoogleapiclient.isconnecting()) { msigninclicked = true; resolvesigninerror(); } } private class retrievetokentask extends asynctask<string, string, string> { @override protected string doinbackground(string... params) { string accountname = params[0]; string scopes = "oauth2:profile email"; string token = null; try { token = googleauthutil.gettoken(getactivity().getapplicationcontext(), accountname, scopes); log.e("token", token); } catch (ioexception e) { log.e(tag, e.getmessage()); } catch (userrecoverableauthexception e) { startactivityforresult(e.getintent(), req_sign_in_required); } catch (googleauthexception e) { log.e(tag, e.getmessage()); } return token; } } }* `
first need check androidmanifest.xml file. check activity owns googleloginfragment has been set nohistory="true" attribute.
second need check server connection closed on previous class or activity.
i hope help.
Comments
Post a Comment