Quantcast
Channel: Ignite Realtime : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 10742

Asmack block user Null pointer

$
0
0

Hi guys,

I'm trying to develop messenger using asmack that have feature block / blacklist user

 

but i'm getting trouble using it.

 

My code :

public void blockUser(String userName)

    {

        String listName = "newList";

        List<PrivacyItem> privacyItems = new Vector<PrivacyItem>();

        PrivacyItem item=new PrivacyItem(PrivacyItem.Type.jid.toString(), false, 1);

        item.setValue(getJIDofUserID(userName));

        privacyItems.add(item);

 

 

        PrivacyListManager privacyManager = PrivacyListManager.getInstanceFor(mConnection);

 

 

        try

        {

            privacyManager.createPrivacyList(listName,privacyItems);

        }

        catch(Exception e)

        {

            Log.e("ERROR: "," "+e.toString());

            e.printStackTrace();

        }

    }

 

I'm getting Null at  PrivacyListManager privacyManager = PrivacyListManager.getInstanceFor(mConnection);

eventhough my mconnection not null..

the impact is it will enter exception and give NULL pointer message.

 

any suggestion?

Thx


Viewing all articles
Browse latest Browse all 10742

Latest Images

Trending Articles



Latest Images