Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- final Activity targetActivity = Solo.getCurrentActivity(); // Using Robotium to get current displayed Activity
- Toast.makeText(targetActivity, "Hello from Instrumentation", Toast.LENGTH_SHORT).show();
- final Activity targetActivity = Solo.getCurrentActivity(); // Using Robotium to get current displayed Activity
- LayoutInflater inflater = targetActivity.getLayoutInflater();
- View layout = inflater.inflate(test.my.package.R.layout.my_custom_toast, null); // resource is located in test project
- TextView text = (TextView) layout.findViewById(test.my.package.R.id.textToShow); // textview within the layout
- text.setText("Hello from Instrumentation"); // here I get the NullPointerException
- Toast toast = new Toast(targetActivity);
- toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
- toast.setDuration(Toast.LENGTH_LONG);
- toast.setView(layout);
- toast.show();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement