getDeclaredMethod not work
Em chào mọi người.
<p>
</p>
<p>
Em sử dụng getDeclaredMethod để show toast nhưng khi run thì không thấy gì. Em chưa biết mình sai chỗ nào, mong mọi người giúp đỡ ạ.
</p>
<p>
</p>
<pre>
Class toast = Class.forName("android.widget.Toast");
Object mToast = toast.newInstance();
Method make = toast.getDeclaredMethod("makeText", Context.class, CharSequence.class, int.class);
Method show = toast.getDeclaredMethod("show", null);
make.invoke(mToast, getBaseContext(), "Hello", Toast.LENGTH_LONG);
show.invoke(mToast, null);
</pre>