I have a class that is currently extending Activity and I have methods like findViewById, ArrayAdapter etc. I want to turn it into an independent class but all the above met
Please try the following:
public static View getLayoutByRes(@LayoutRes int layoutRes,@Nullable ViewGroup viewGroup)
{
final LayoutInflater factory = getSystemService(Context.LAYOUT_INFLATER_SERVICE);
return factory.inflate(layoutRes, viewGroup);
}
TextView tv = (TextView) getLayoutByRes(R.layout.xxx ,Null).findViewById(R.id.editd);