2

I'm trying to implement a chat app using stfalcon's ChatKit library. I've followed the docs in their repo, but there are things I'm not sure I'm getting right.

First, I created a new activity called DialogsListActivity, and copied the xml in the activity's xml file. From here I first copied the xml part to the activity's xml file.

Next comes the adapter setup. I copied the given code after the OnCreate method, including the last line (dialogsListView.setAdapter(dialogsListAdapter);) as the last line in OnCreate. The whole activity now looks like this:


    ListView dialogsListView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_dialogs_list);
        dialogsListView.setAdapter(dialogsListAdapter);
    }

    DialogsListAdapter dialogsListAdapter = new DialogsListAdapter<>(dialogs, new ImageLoader() {
        @Override
        public void loadImage(ImageView imageView, String url) {
            //If you using another library - write here your way to load image
            Picasso.with(DialogsListActivity.this).load(url).into(imageView);
        }
    });
}

Questions:

  • is this the right place to put the adapter in?
  • is it ok to put set the dialogsListView as an attribute and defining it inside OnCreate()?
  • the dialogs from new DialogsListAdapter gets a Cannot resolve symbol 'dialogs' message.
  • the new ImageLoader() from same place gets a Class 'Anonymous class derived from ImageLoader' must either be declared abstract or implement abstract method 'loadImage(ImageView, String, Object)' in 'ImageLoader'

What am I missing there?

For the IDialog and IUser implementation I created the classes DefaultDialog and Author, and copied the given code. As I expected, the 'symbols' returned by the methods 'cannot be defined'. Where should they be defined and how?

Next in the tutorial is the Data management section which I think would set those values.

I already downloaded the sample project and tried to look inside, but I cannot find the public class DefaultDialog that implements IDialog or anything similar. Plus, I got pretty lost trying to understand the library from that sample project.

Any help would be much appreciated.

Thanks in advance.

89f3a1c
  • 1,430
  • 1
  • 14
  • 24

0 Answers0