create webView programmatically in android (without using xml) - layout

I want to create WebView programmatically without using xml files. I have used this :
LinearLayout view = new LinearLayout(MainActivity.this);
view.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
view.setOrientation(LinearLayout.VERTICAL);
WebView web=new WebView(this);
web.loadUrl("https://www.google.com");
view.addView(web);
I have also added internet permission in manifest file. But nothing is happening no webView is there when i launch the application. Please help.

Related

How to make a 3D model viewer android app?

I'm trying to make my own 3d viewer app.
I just want it works like,
Open an app (tap on my smartphone screen),
Show a 3d model,
Close the app when the back button is tapped.
Actually, I made an app (with Kotlin on android studio) that is working like my idea.
The app is working well with a file that is located on a server.
But I want to make an app that works without an internet connection.
How to import a file(glTF format) to the app.?
In the part,
.appendQueryParameter("file", "PATH/XXXX.gltf")
If the PATH is with "https//", it works with an internet connection.
but, How can I set the PATH local storage in order for the apps to work without internet connections?
Here is the kotlin code snippet that I'm using.
val sceneViewerIntent: Intent = Intent(Intent.ACTION_VIEW)
val intentUri: Uri = Uri.parse("https://arvr.google.com/scene-viewer/1.0").buildUpon()
.appendQueryParameter(
"file","ludovic_v2_gltf.gltf" //<<<<---- how to import this file?
//"https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/Avocado/glTF/Avocado.gltf"
//<<<--- with this line, works very well.
)
.appendQueryParameter("mode", "3d_only")
.build()
sceneViewerIntent.data = intentUri
sceneViewerIntent.setPackage("com.google.ar.core")
startActivity(sceneViewerIntent)
finish()
Thanks a lot!!!
This is my environment.
windows10, android-studio 20212.1Patch1(build on May 18,2022)
My project was started with "empty activity".

Unable to open Google Play store with Xamarin.Forms Portable class Library

Currently I use this to try and open the Google Play Store directly to my app however this does not work.
var intent = new Intent(Intent.ActionView, Uri.Parse("market://details?id=" + appPackageName));
In a Forms PCL project, you can open a URI by using Device.OpenUri()
Device.OpenUri(new Uri("http://www.google.com"));

Image in Local Folder from WebView

I am working on a project where I need to access an image stored in the applications local folder from within a webview control. When I try to use the ms-appdata:/// scheme it does not work.
I should also mention that I have no control over what content is loaded into the webview and so I must assume that there is no reference to base.js.
I guess my question is, is there any folder where I can store images on the device that I can access from within a webview.
I have tried:
ms-appdata:///local/
ms-appx-web:///local/
file://[path]
Update
This project is done using WinJS and Universal Apps. So it is written entirely in JavaScript.
I use this :
StorageFile file = await dir.GetFileAsync(name + ".jpg");
and I set this
"ms-appdata:///local/" + file.Name
in the "src" attribute of my image tag.

cannot find symbol class LoginActivityError

I am making an app and I have a button that says Sign in and when you click on the button it is supposed to redirect you to a new page that will have you sign in. When i clicked New>Activity and selected a log in page and clicked finish there was an error that says Cannot Find Symbol Class Login Activity. Heres the location of the error in code:
private void addEmailsToAutoComplete(List<String> emailAddressCollection) {
//Create adapter to tell the AutoCompleteTextView what to show in its dropdown list.
ArrayAdapter<String> adapter =
new ArrayAdapter<String>(LoginActivity.this,
android.R.layout.simple_dropdown_item_1line,
emailAddressCollection);
mEmailView.setAdapter(adapter);
}
Open your SDK Manager (Tools menu > Android), and install Android Support Repository in Extras. After this you may need to click the Sync Project with Gradle Files button in the toolbar.
I'm just starting, and I had the same issue.
I added the login activity using Android Studio's wizard, but I didn't use the default activity name.
When the class was generated, it referenced to "LoginActivity.this", using the default name.
In my case, I just needed to replace the Activity name for the one I've used while creating it.
Example:
new ArrayAdapter( "ActualNameOfLoginActivity" .this...

How to manage views programmatically in an iPad storyboard application using Monotouch

I have created an iPad storyboard application using the newest version of Monotouch. My first screen is a login screen that I only want to show if the user has not saved his credentials. If credentials are available I want to instead navigate to the UITabBarController that is the second scene. I can't seem to find any documentation on how to do this. I tried creating an instance of the UITabBarController and pushing to it but it does not work.
homeScreen = new HomeTabBarNavigator(this.Handle);
this.NavigationController.PushViewController(homeScreen,true);
HomeTabBarNavigator is a UITabBarController that is already linked to other scenes. I get the following error:
[ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object
I assume I am getting this error because I have not defined any views to the ViewControllers property of my HomeTabBarNavigator. I was hoping that those views were already defined but that does not seem to be the case. Any ideas.
The best solution I could find is to call PerformSegue on the controller. Here is some example code:
this.PerformSegue("LoginSegue",this);
The controller that is loaded is the LoginController, and LoginSegue is a Segue that points to the HomeTabBarNavigator. While it is not perfect, the applications loaded the tabbar properly.
I used this stackoverlflow iOS question as the basis for my solution.

Resources