I'm jumping straight into the deep end at outer extents of my knowledge of Android layouts (to mix a metaphor or two)!
Is it possible to use an ArrayAdapter with views in B4A? All the constructors seem to need ids from the R file produced by the layout XML which B4A doesn't do.
One of the limitations of my BasicIDE has always been the editor based on an EditText. Unbeknownst to me there is apparently an extension of EditText with more capability called MultiAutoCompleteTextView which is used by this very small library which I am wrapping.
Android Library to make it easy to create an Code editor or IDE that support any languages and themes, with auto complete, auto indenting, snippets and more features - AmrDeveloper/CodeView
github.com
So far I am very pleased to have syntax and error line highlighting working in BasicIDE which is giving a far better development experience, although my regexes are probably a bit primitive . The cherry on the cake would be to add autocomplete which is supported by the library.
Java:
Add Custom AutoComplete Adapter
//Your langauge keywords
String[] languageKeywords = .....
//List item custom layout
int layoutId = .....
//TextView id on your custom layout to put suggestion on it
int viewId = .....
//Create ArrayAdapter object that contain all information
ArrayAdapter<String> adapter = new ArrayAdapter<>(context, layoutId, viewId, languageKeywords);
//Set the adapter on CodeView object
codeView.setAdapter(adapter);
However I am totally at a loss at how to create the ArrayAdapter as it requires a layout Id and a view Id that I really don't understand what they are the Ids of, except that they seem to come from the R file. It doesn't help that I don't really know what an ArrayAdaper does.
That's good, the road ahead may not be blocked then. Any idea what views the layoutI and viewId should belong to in this case? A specially added Panel with a Label child? I'll go and play.
That's the last thing I ever want to do. My tiny semi-autistic mind can't cope with declarative stuff like Regex, Xml and Html, although I do try on occasion. Procedural logic is what I am best at.
Looks like its a Resource Id needed so I guess I'm stuck
android.content.res.Resources$NotFoundException: Resource ID #0xb
at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:239)
at android.content.res.MiuiResourcesImpl.getValue(MiuiResourcesImpl.java:96)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2309)
at android.content.res.Resources.getLayout(Resources.java:1189)
at android.view.LayoutInflater.inflate(LayoutInflater.java:536)
at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:428)
at android.widget.ArrayAdapter.getView(ArrayAdapter.java:419)
at android.widget.AbsListView.obtainView(AbsListView.java:2437)
at android.widget.DropDownListView.obtainView(DropDownListView.java:305)
at android.widget.ListView.measureHeightOfChildren(ListView.java:1441)
at android.widget.ListPopupWindow.buildDropDown(ListPopupWindow.java:1299)
at android.widget.ListPopupWindow.originalShow(ListPopupWindow.java:651)
at android.widget.ListPopupWindow.show(ListPopupWindow.java:645)
at android.widget.AutoCompleteTextView.showDropDown(AutoCompleteTextView.java:1316)
Hi All, A very generalised question. The cursor in Edittext is not easily seen, there have been numerous posts to change colour, blink rate, size etc. I think I have tried them all, none really work. EG Some years ago Erel provided me with a java sub to SHOWPINS. Still works well on my...
www.b4x.com
That I suppose will at least go into the R file. I'll play with that but I'm really running blind here
Can I reference the R file in a library? I get an error here
C:\Users\Andy\Documents\B4A\Projects\Libraries\CodeEditorView\src\ba\agraham\CodeViewWrapper.java:135: error: package R does not exist
final int layoutId = R.layout.layout1;
Yes ? BasicIDE has a primitive looking autautocomplete working after a process of hitting it around the head with trial and error and ignorance until it succumbed! Needs tidying up to production standard now
I used CreateRsource in the manifest to get the layout into the resources and JavaObject to get the resource Ids which were needed, not the view Ids.