Android program to connect to Facebook: LoginActivity has leaked window -


here basic program, provided facebook - connect android app facebook: seem error:

activity com.facebook.loginactivity has leaked window com.android.internal.policy.impl.phonewindow@decorview@40512630 added here:

following things have been tried:

  • i've verified keyhash.
  • i've verified android.xml
  • i've looked more inputs on forum.

any suggestions ???

mainactivity:

package com.example.facebookconnectionapp;  import com.facebook.request; import com.facebook.response; import com.facebook.session; import com.facebook.sessionstate; import com.facebook.model.graphuser;  import android.os.bundle; import android.app.activity; import android.content.intent; import android.util.log; import android.view.menu; import android.widget.textview;  public class mainactivity extends activity {      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);          log.i("facebook activity", "before opening session");          session.openactivesession(this, true, new session.statuscallback() {              @override             public void call(session session, sessionstate state, exception exception) {                 // todo auto-generated method stub                  log.i("facebook activity", "checking if session open");                  if(session.isopened()){                      log.i("facebook activity", "session open");                     request.executemerequestasync(session, new request.graphusercallback() {                          @override                         public void oncompleted(graphuser user, response response) {                             // todo auto-generated method stub                              log.i("facebook activity", "inside graphcallback");                              textview textview = (textview) findviewbyid(r.id.textview1);                             textview.settext(user.getusername());                         }                     });                 } else {                      log.i("facebook activity", "session not open");                 }              }         });     }      @override     public boolean oncreateoptionsmenu(menu menu) {         // inflate menu; adds items action bar if present.         getmenuinflater().inflate(r.menu.main, menu);         return true;     }      @override     protected void onactivityresult(int requestcode, int resultcode, intent data) {         // todo auto-generated method stub         super.onactivityresult(requestcode, resultcode, data);          session.getactivesession().onactivityresult(this, requestcode, resultcode, data);     }  } 

androidmanifest.xml:

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android"     package="com.example.facebookconnectionapp"     android:versioncode="1"     android:versionname="1.0" >      <uses-sdk         android:minsdkversion="8"         android:targetsdkversion="17" />     <uses-permission android:name="android.permission.internet"/>      <application         android:allowbackup="true"         android:icon="@drawable/ic_launcher"         android:label="@string/app_name"         android:theme="@style/apptheme" >         <activity             android:name="com.example.facebookconnectionapp.mainactivity"             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.facebook.sdk.applicationid" android:value="@string/app_id"/>         <activity android:name="com.facebook.loginactivity"></activity>     </application>  </manifest> 

make sure connected internet. if aren't, error.


Comments