mardi 23 février 2016

how to call one method from another class - android

i am calling from this method

  public void onClick(View v) {
  InboxActivity inboxActivity = new InboxActivity();
               inboxActivity.fromcheckpass(CheckPass.this);


        }
    });

and i am calling this method , and thanks alot in advance how can i call this mthod so it shouldnt be crashed the app

           public void fromcheckpass(Context mcontext) {
    Toast.makeText(mcontext, "WEL COME", Toast.LENGTH_LONG).show();
    Db = new MySQLiteHelper(this);
    String DbInsert = Utils.getPreferences("DbInsert", this);

    if (!DbInsert.equalsIgnoreCase("Inserted")) {
        SaveDataInDB();
    }

    MessageListView = (ListView) findViewById(R.id.lvInbox);
    ActionBar bar = getActionBar();
    bar.setBackgroundDrawable(new    ColorDrawable(Color.parseColor("#0154A4")));
    bar.setTitle(R.string.app_name);
    bar.setTitle(Html.fromHtml("<font color='#ffffff'>WeText </font>"));
    bar.setIcon(R.drawable.icon_top);

    Utils.getOverflowMenu(this);

    attachListeners();

    dataList = Utils.getLatestMessageOfAllContacts(InboxActivity.this);

    if (dataList.isEmpty()) {
        Toast.makeText(getApplicationContext(), "NO MESSAGES",
                Toast.LENGTH_LONG).show();
    } else {
        iAdapter = new Adapter(InboxActivity.this, dataList);
        MessageListView.setAdapter(iAdapter);
    }


}

when ever i called this method the app got crashed

Aucun commentaire:

Enregistrer un commentaire