Example usage for android.widget Toast show

List of usage examples for android.widget Toast show

Introduction

In this page you can find the example usage for android.widget Toast show.

Prototype

public void show() 

Source Link

Document

Show the view for the specified duration.

Usage

From source file:com.easy.facebook.android.facebook.FBLoginManager.java

public void displayToast(String message) {
    Toast t = Toast.makeText(activity, message, 0);
    t.show();
}

From source file:com.mobshep.ITLS3.InsufficientTLS3.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);

    setContentView(R.layout.layout);/* www  . j ava  2  s  .c o m*/
    referenceXML();

    if (isNetworkAvailable() == false) {
        Toast networkError = Toast.makeText(InsufficientTLS3.this, "No Network Connection Detected.",
                Toast.LENGTH_SHORT);
        networkError.show();
    }
}

From source file:edu.cwru.apo.Directory.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.directory);//from w ww  .  j  a  v  a 2  s.com
    userTable = (TableLayout) findViewById(R.id.userTable);
    phoneDB = new PhoneOpenHelper(this);
    database = phoneDB.getWritableDatabase();
    Cursor results = database.query("phoneDB", new String[] { "first", "last", "_id" }, null, null, null, null,
            "first");
    if (results.getCount() < 1) {
        API api = new API(this);
        if (!api.callMethod(Methods.phone, this, (String[]) null)) {
            Toast msg = Toast.makeText(this, "Error: Calling phone", Toast.LENGTH_LONG);
            msg.show();
        }
    } else
        loadTable();
}

From source file:edu.cwru.apo.Login.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.login);//from w  w  w  .  j  a  v  a  2s .com

    Bundle extras = getIntent().getExtras();
    if (extras.get("msg") != null) {
        Toast message = Toast.makeText(getApplicationContext(), extras.getString("msg"), Toast.LENGTH_SHORT);
        message.show();
    }
    // map the login button to the layout
    login_btn = (Button) findViewById(R.id.login);
    login_btn.setOnClickListener(this);
    // map the forgot password button to the layout
    forgot_btn = (Button) findViewById(R.id.forgot_password);
    forgot_btn.setOnClickListener(this);

    username = (EditText) findViewById(R.id.username);
    password = (EditText) findViewById(R.id.password);

}

From source file:co.lmejia.iglesia.AssistanceListActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    Log.d(TAG, "onActivityResult");

    Assistance assistance_new;
    String message = "";

    if (requestCode == ASSISTANCE_REQUEST_CODE && data != null) {

        if (data.hasExtra(Assistance.TAG)) {

            assistance_new = (Assistance) data.getSerializableExtra(Assistance.TAG);

            if (resultCode == AssistanceActivity.RESULT_OK) {

                mAdapter.addItem(assistance_new, 0);
                message = "Se agreg una asistencia";

            } else if (resultCode == AssistanceActivity.RESULT_EDIT) {

                mAdapter.updateItem(assistance_new, positionEdit);
                message = "Se modific una asistencia";

            }//from  w  w  w. java 2 s. c om

            Toast t = Toast.makeText(this, message, Toast.LENGTH_SHORT);
            t.show();
        }
    }
}

From source file:com.mobshep.insufficienttls.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    referenceXML();//from   w  w  w  .j a  v a  2s .  c o m

    logPrefSession();
    logProviderSession();

    if (checkSession()) {
        // Intent intent = new Intent(MainActivity.this, LoggedIn.class);
        // startActivity(intent);
    }

    //TODO
    //Remove this and replace with AsyncTask
    StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
    StrictMode.setThreadPolicy(policy);
    //end remove

    SharedPreferences SP = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
    String address = SP.getString("server_preference", "NA");

    Toast addressTest = Toast.makeText(MainActivity.this, "Server Address : " + address, Toast.LENGTH_LONG);
    addressTest.show();

}

From source file:com.alwinyong.alightsg.SearchTestingActivity.java

public void showToast(String text) {
    Toast toast;
    int duration = Toast.LENGTH_SHORT;

    if (null != text) {
        toast = Toast.makeText(this, text, duration);
        toast.show();
    }// ww  w .  j a  va2s  .c om
}

From source file:com.mobshep.insufficienttls.InsufficientTLS.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);

    setContentView(R.layout.layout);//from   w w w.  ja v a 2  s . com
    referenceXML();

    if (isNetworkAvailable() == false) {
        Toast networkError = Toast.makeText(InsufficientTLS.this, "No Network Connection Detected.",
                Toast.LENGTH_SHORT);
        networkError.show();
    }
}

From source file:io.openkit.leaderboards.OKLeaderboardsFragment.java

private void getLeaderboards() {
    startedLeaderboardsRequest = true;/*from w  w  w .j  av a2  s  .co m*/

    spinnerBar.setVisibility(View.VISIBLE);

    //Get the leaderboards
    OKLeaderboard.getLeaderboards(new OKLeaderboardsListResponseHandler() {

        @Override
        public void onSuccess(List<OKLeaderboard> leaderboardList, int playerCount) {
            listAdapter = new OKLeaderboardsListAdapter(OKLeaderboardsFragment.this.getActivity(),
                    android.R.layout.simple_list_item_1, leaderboardList);

            numPlayers = playerCount;

            //Add a header to the list. Must be done before setting list adapter
            listHeaderTextView.setText(numPlayers + " Players");

            //Display the list
            OKLeaderboardsFragment.this.setListAdapter(listAdapter);
            listView.setVisibility(View.VISIBLE);
            spinnerBar.setVisibility(View.INVISIBLE);
        }

        @Override
        public void onFailure(Throwable e, JSONObject errorResponse) {
            spinnerBar.setVisibility(View.INVISIBLE);
            if (OKLeaderboardsFragment.this.getActivity() != null) {
                Toast toast = Toast.makeText(OKLeaderboardsFragment.this.getActivity(),
                        "Couldn't connect to server to get leaderboards", Toast.LENGTH_LONG);
                toast.show();
            }
        }
    });
}

From source file:at.andreasrohner.spartantimelapserec.BackgroundService.java

@Override
public boolean handleMessage(Message m) {
    String status = m.getData().getString("status");
    String tag = m.getData().getString("tag");
    String msg = m.getData().getString("msg");

    String name = getString(R.string.app_name);

    if ("error".equals(status)) {
        Log.e(tag, "Error: " + msg);

        final Context context = getApplicationContext();
        final String text = name + " Error: " + msg;

        surfaceView.post(new Runnable() {
            @Override//from   w ww. j a  v  a  2s . co  m
            public void run() {
                Toast toast = Toast.makeText(context, text, Toast.LENGTH_LONG);
                toast.show();
            }
        });
    }

    stopSelf();
    return true;
}