저는 java와 android에 익숙하지 않습니다. getContext()
메서드는 View 클래스의 인스턴스에 의해 참조되지 않고 직접 호출됩니다. 외관상으로는 방법은 정적이 아닌입니다. 정적이 아닌 메서드를 직접 호출 하는게 어떨까요. 여기서 내가 무엇을 놓치고 있습니까? 아래에 내 코드를 추가했습니다 (의심스러운 부분은 마지막 줄에 있음). 감사합니다. LayoutInflater.from()
이상이 어댑터를 호스팅하는 활동이라고ce. 명백하게 메서드가 정적이 아닙니다.
package in.shopperstreet.honeywell;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
public class CustomAdapter extends ArrayAdapter<String> {
public CustomAdapter(Context context, String[] books) {
super(context,R.layout.activity_main2,books);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater lif = LayoutInflater.from(getContext());
....