List of usage examples for android.content Context LAYOUT_INFLATER_SERVICE
String LAYOUT_INFLATER_SERVICE
To view the source code for android.content Context LAYOUT_INFLATER_SERVICE.
Click Source Link
From source file:com.messagesight.mqtthelper.PayloadAdapter.java
@Override public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { String headerTitle = (String) getGroup(groupPosition); if (convertView == null) { LayoutInflater inflater = (LayoutInflater) this.ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(R.layout.list_group, null); }/* www . ja va 2 s . c o m*/ TextView lblListHeader = (TextView) convertView.findViewById(R.id.lblListHeader); lblListHeader.setTypeface(null, Typeface.BOLD); String[] tempTitle = headerTitle.split(":"); headerTitle = tempTitle[0]; lblListHeader.setText(headerTitle); return convertView; }
From source file:com.ubikod.capptain.android.sdk.reach.activity.CapptainPollActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { /* Init layout */ super.onCreate(savedInstanceState); /* If no content, nothing to do, super class already called finish */ if (mContent == null) return;/*ww w.j av a 2s . c o m*/ /* Render questions */ LinearLayout questionsLayout = getView("questions"); JSONArray questions = mContent.getQuestions(); LayoutInflater layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); try { for (int i = 0; i < questions.length(); i++) { /* Get question */ JSONObject question = questions.getJSONObject(i); /* Inflate question layout */ LinearLayout questionLayout = (LinearLayout) layoutInflater .inflate(getLayoutId("capptain_poll_question"), null); /* Set question's title */ TextView questionTitle = (TextView) questionLayout.findViewById(getId("question_title")); questionTitle.setText(question.getString("title")); /* Set choices */ RadioGroup choicesView = (RadioGroup) questionLayout.findViewById(getId("choices")); choicesView.setTag(question); JSONArray choices = question.getJSONArray("choices"); int choiceViewId = 0; for (int j = 0; j < choices.length(); j++) { /* Get choice */ JSONObject choice = choices.getJSONObject(j); /* Inflate choice layout */ RadioButton choiceView = (RadioButton) layoutInflater .inflate(getLayoutId("capptain_poll_choice"), null); /* Each choice is a radio button */ choiceView.setId(choiceViewId++); choiceView.setTag(choice.getString("id")); choiceView.setText(choice.getString("title")); choiceView.setChecked(choice.getBoolean("default")); choicesView.addView(choiceView); } /* Add to parent layouts */ questionsLayout.addView(questionLayout); /* Watch state */ mRadioGroups.add(choicesView); choicesView.setOnCheckedChangeListener(mRadioGroupListener); } } catch (JSONException jsone) { /* Won't happen */ } /* Disable action if a choice is not selected */ updateActionState(); }
From source file:com.cloudkick.CheckViewActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); CheckViewState previousState = (CheckViewState) getLastNonConfigurationInstance(); if (previousState != null) { nodeName = previousState.nodeName; nodeId = previousState.nodeId;// ww w. j ava 2 s .c o m checkId = previousState.checkId; check = previousState.check; } else { Bundle data = this.getIntent().getExtras(); nodeName = (String) data.getSerializable("nodeName"); nodeId = (String) data.getSerializable("nodeId"); checkId = (String) data.getSerializable("checkId"); check = (Check) data.getSerializable("check"); } String inflater = Context.LAYOUT_INFLATER_SERVICE; LayoutInflater li = (LayoutInflater) getSystemService(inflater); checkView = new RelativeLayout(this); li.inflate(R.layout.check_view, checkView, true); setContentView(checkView); setTitle(nodeName + ": " + check.type + " check"); redrawCheck(); reloadAPI(); }
From source file:com.andrewshu.android.reddit.common.Common.java
public static void showErrorToast(String error, int duration, Context context) { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); Toast t = new Toast(context); t.setDuration(duration);//from ww w . j a v a2s . c o m View v = inflater.inflate(R.layout.error_toast, null); TextView errorMessage = (TextView) v.findViewById(R.id.errorMessage); errorMessage.setText(error); t.setView(v); t.show(); }
From source file:it.crs4.most.ehrlib.widgets.DvCodedTextAsListWidget.java
/** * Instantiates a new {@link DvCodedTextAsListWidget} * * @param provider the widget provider/*from w w w.jav a 2s. co m*/ * @param name the name of this widget * @param path the path of the {@link DvCodedText} mapped on this widget * @param attributes the attributes of the {@link DvCodedText} mapped on this widget * @param parentIndex the parent index */ public DvCodedTextAsListWidget(WidgetProvider provider, String name, String path, JSONObject attributes, int parentIndex) { super(provider, name, new DvCodedText(path, attributes), parentIndex); Log.d(TAG, "istanziato DvCodedTextAsListWidget"); LayoutInflater inflater = (LayoutInflater) _context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = inflater.inflate(R.layout.dv_coded_text_listview, null); Log.d(TAG, "Root view recuperata"); _root_view = view; list = (ListView) _root_view.findViewById(R.id.list_coded_text); Log.d(TAG, "LIST istanziata"); txtTitle = (TextView) _root_view.findViewById(R.id.txt_title); this.updateLabelsContent(); _help = (ImageView) _root_view.findViewById(R.id.image_help); toolTipRelativeLayout = (ToolTipRelativeLayout) _root_view .findViewById(R.id.activity_main_tooltipRelativeLayout); _help.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (myToolTipView == null) { myToolTipView = toolTipRelativeLayout.showToolTipForView(toolTip, _help); //myToolTipView.setOnToolTipViewClickedListener(DvTextWidget.this); } else { myToolTipView.remove(); myToolTipView = null; } } }); // ViewGroup header = (ViewGroup)inflater.inflate(R.layout.dv_coded_text_listview_header, list, false); // TextView txtView = (TextView) header.findViewById(R.id.txt_header); // txtView.setText(name); // Log.d(TAG, "Header creato"); // list.addHeaderView(header, null, false); // Log.d(TAG, "Header aggiunto"); this.setupListViewAdapter(); }
From source file:com.aboveware.sms.ui.MessageListAdapter.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) public MessageListAdapter(Context context, ListView listView, Pattern highlight) { super(context, null, 0); mContext = context;/*from w ww .j a v a 2 s.c om*/ mHighlight = highlight; mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); mMessageItemCache = new MessageItemCache(CACHE_SIZE); listView.setRecyclerListener(new AbsListView.RecyclerListener() { @Override public void onMovedToScrapHeap(View view) { if (view instanceof MessageListItem) { MessageListItem mli = (MessageListItem) view; // Clear references to resources mli.unbind(); } } }); }
From source file:com.filemanager.free.adapters.DrawerAdapter.java
public DrawerAdapter(Context context, ArrayList<Item> values, MainActivity m, SharedPreferences Sp) { super(context, R.layout.drawerrow, values); this.context = context; this.values = values; for (int i = 0; i < values.size(); i++) { myChecked.put(i, false);//from w ww . j a v a 2 s. c o m } icons = new IconUtils(Sp, m); this.m = m; fabskin = Color.parseColor(m.fabskin); color = colors.get(m.fabskin); if (color == null) { color = colors.get("#e91e63"); } inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); }
From source file:cl.smartcities.isci.transportinspector.adapters.dialogAdapters.EventAdapter.java
/** * Constructor for the event adapter//from ww w . j a v a 2s . c o m * * @param pContext the context * @param pCode The code to be sent to the server, if a Bus, the code is the license plate * if a BusStop, the code is the busStop code * @param pTitle The title to be sent to the server, if a Bus, it's the service of the bus. * BusStop does not use it * @param pType Parameter to see if the events are from a bus or from a busStop * @param pEvents List of Events to show */ public EventAdapter(Context pContext, String pCode, String pTitle, String pType, List<Event> pEvents) { super(pContext, R.layout.event_layout_row, pEvents); this.events = pEvents == null ? new ArrayList<Event>() : pEvents; this.context = pContext; this.code = pCode; this.title = pTitle; this.type = pType; this.mInflater = (LayoutInflater) pContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); }
From source file:com.example.run_tracker.CustomListAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { if (inflater == null) { inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); }// w w w . j a va 2s. c om if (convertView == null) { convertView = inflater.inflate(R.layout.list_row, null); } TextView date = (TextView) convertView.findViewById(R.id.date); TextView time = (TextView) convertView.findViewById(R.id.time); TextView distance = (TextView) convertView.findViewById(R.id.distance); ImageButton delete = (ImageButton) convertView.findViewById(R.id.delete_btn); delete.setOnClickListener(this); delete.setTag(position);// set the tag for recognizing each row // getting track data for the row Track m = TrackItems.get(position); date.setText("Date: " + m.getDate()); time.setText("Time: " + m.getTime() + "min"); distance.setText("Distance: " + m.getDistance()); return convertView; }
From source file:at.alladin.rmbt.android.views.ResultDetailsView.java
/** * /* w w w . jav a 2s .c o m*/ * @param context * @param attrs */ public ResultDetailsView(Context context, AttributeSet attrs, RMBTMainActivity activity, String uid, JSONArray testResult) { super(context, attrs); LayoutInflater layoutInflater = (LayoutInflater) getContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); this.view = createView(layoutInflater); this.activity = activity; this.uid = uid; this.testResult = testResult; }