|
One typically uses a "Style" to affect all instances of a given "type of control" within that Style's scope (e.g. "Padding").
Styling Xamarin.Forms Apps - Xamarin | Microsoft Docs
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
I'm new in Android programming and about to begin my classes on it. Before that, I had to install Android Studio on my PC. I downloaded Android Studio 4.1.3 for Windows 64-bit from developer.android.com. After successful installation and initial setup I launched it by selecting an Empty Activity Project Template. Once the IDE got ready with the default Hello World programme with its default code in MainActivity.java, I tried to run it with the default virtual device- Pixel_3a_API_30_x86. Now this is where the problem arises. Once the virtual device pops up, it's screen remains black and never fires up. I tried creating another virtual device in AVD manager and launch it from there, but of no avail, the problem still persists. As an alternative, I deleted all virtual devices from AVD manager, closed the project, re-opened it and created a virtual device anew. But again the same problem, the screen of the virtual device doesn't fire up and even the timeout for the app to connect the virtual device expires after sometime. I deleted the application and created a new one from the scratch and followed all the steps mentioned above, but with no effect. Assuming something wrong in the current release, I downloaded a previous release of Android Studio, i.e., Android Studio 4.1.1 for Windows 64-bit. But the problem still prevails in this one too. I spoke to a couple of Android programmers working on PCs running on Intel as well as AMD processors, but they never came across such a problem; everything is running fine on their PCs. I'm not even getting any error so that I can look into it. The only error being generated while creating a new virtual device in AVD manager for the first time, which says: "The ADB binary found at C:\Users\Admin\AppData\Local\Android\Sdk\platform-tools\adb.exe is obsolete and has serious performance problems with the Android Emulator. Please update to a newer version to get significantly faster app/file transfer." But as far I can see, I already have the updated version of the platform tools.
I tried all the options mentioned here and here, but none of them solved my problem. So I want to know why is Emulator not running on my PC and how can I make it work? Is it hardware problem? Do I need to update my processor, motherboard and RAM? Or is there some other issue I'm missing? I tried everything in my hand, but to no use. I'm absolutely new in Android and am not familiar with the settings and commands of the Android IDE. My classes are getting unreasonably delayed for this, because if the Emulator doesn't work, how will I run and test the codes and see how it actually works in a device. A whole month got wasted on this and I can't even write my first Hello World programme. Therefore I seek assistance from fellow Android programmers and experts to get me out of this deadlock anyhow. Please help.
Summary of my PC is given below:
- OS Name: Microsoft Windows 10 Pro (64 bit OS)
- OS Version: 10.0.19042 Build 19042.906
- OS Experience: Windows Feature Experience Pack 120.2212.551.0
- Processor: AMD Phenom II X2 545 Processor, 3.00 GHz, 2 Cores (x64-based processor)
- Motherboard: ASUS M4A78LT-M-LE
- Motherboard Version: Rev X.0x
- RAM: 6.00 GB (5.75 GB usable)
- Hyper-V - VM Monitor Mode Extensions: Yes
- Hyper-V - Second Level Address Translation Extensions: Yes
- Hyper-V - Virtualization Enabled in Firmware: Yes
- Hyper-V - Data Execution Protection: Yes
Click to view the screenshot of the problem.
Click to view screenshots of SDK Platforms and SDK Tools of my SDK Manager.
|
|
|
|
|
priyamtheone wrote: Once the virtual device pops up, it's screen remains black and never fires up. How long are you waiting. At home, I used to have an Intel Core 2 Duo E7300 running at 2.66GHz with 4GB of RAM and it took over 2 minutes for my emulator to completely boot up. At work I had a slightly faster CPU and 8GB of RAM and it still took over a minute.
priyamtheone wrote: I tried creating another virtual device in AVD manager... With what specs? The default is probably taxing your PC's RAM. On the two aforementioned PCs, I would scale the emulator specs down to the bare minimum.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
How long are you waiting?
I'm waiting so long as the timeout for the app to connect the virtual device expires, for around fifteen minutes, but in vain.
With what specs?
While creating a virtual device in AVD manager, I tried with the default specs, i.e. Android 11 API level 30, 1536 MB RAM, 384 MB VM Heap, 800 MB Internal Storage, 512 MB SD Card memory (Studio-managed). It didn't work. Thereafter, I tried with Android 5.0 API level 21 and Android 5.1 API level 22, but to no effect. In terms of memory and storage settings, I increased specs more than the default settings with 2048 MB RAM, 2048 MB VM Heap, 2048 MB Internal Storage, 2048 MB SD Card memory (Studio-managed). Result is the same black screen. Next time, I scaled down the specs way below the default settings, i.e., 500 MB RAM, 250 MB VM Heap, 500 MB Internal Storage, 250 MB SD Card memory (Studio-managed). As usual, it yielded to nothing but the same black screen. Regarding Emulated Performance Graphics, I switched between Automatic, Hardware and Software, but of no avail.
|
|
|
|
|
|
Gone through the link you attached. But my adb.exe is in the default Android SDK directory, exactly where it's supposed to be as mentioned by the posters in that link.
C:\Users\Admin\AppData\Local\Android\Sdk\platform-tools
I don't see any discrepancy with the adb.exe. What am I missing?
|
|
|
|
|
I am not an expert but I learned somewhere that you can Install HAXM and Switch to x86. Using an x86 system image can speed up the emulator. Creating an x86 AVD is simple. All you need to do is when you’re creating a new AVD, simply select the ‘x86 Images’ tab in the ‘System Image’ window.
|
|
|
|
|
Thanks for your reply.
HAXM is needed in a machine that runs on an Intel processor. Mine is an AMD Phenom processor for which you need to install Android Emulator Hypervisor Driver for AMD Processors, which is the equivalent of HAXM on AMD machines. However, for diagnosis, I already installed HAXM which can be seen in the screenshot of the SDK tools of my SDK Manager here. But that didn't yield to anything.
Regarding using x86 system image, that's what I tried multiple times but with no effect. While creating a virtual device, I tried selecting the default x86 image [Release Name: R, API Level: 30, ABI: x86, Target: Android 11.0 (Google APIs)] that is available in the "Recommended" tab of the System Image window. That produced no effect other than the black emulator screen. Assuming the emulator and image specs to be too high for my RAM/PC, I scaled it down by using the following two images from the "x86 Images" tab of the System Image window as you mentioned:
1. Release Name: Lollipop, API Level: 22, ABI: x86, Target: Android 5.1
2. Release Name: Lollipop, API Level: 21, ABI: x86, Target: Android 5.0
Both yielded the same black dead emulator screen.
I tried using other non-x86 arm and armeabi images, but to no avail. None could produce any activity on the emulator screen.
As more reading on the topic brought forward, I guess, in case of AMD processors, emulator is supported only by the Ryzen series and above. Any processor below it won't work. Android emulators are developed keeping in mind Intel processors primarily. So, I believe, the only safe bet to get rid of this problem and be future-proof is to update my hardware (processor, motherboard, RAM), specifically with a contemporary Intel processor. I don't see any other solution as of now. Although, any better advice is always welcome!
|
|
|
|
|
Is it possible to write an application that takes the user coordinates and puts it in uber application
|
|
|
|
|
You would need to find out how the Uber app accepts its request details, and try to emulate a user doing that on the screen.
|
|
|
|
|
Doesn't that app already have a "Use my location" feature?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
How can we create leitner box app in android studio ?
|
|
|
|
|
By gathering your requirements, designing the application, and then writing some code. It seems you're yet to start step 1.
Zainab Hussaini wrote: leitner box app
Or maybe you should ask Bruce[^]?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
package com.ishidakorea.test02
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import java.lang.Exception
class MainActivity : AppCompatActivity(), A.interA, Child.interChild
{
override fun Child_EventFire()
{
}
override fun A_SendPost()
{
}
override fun onCreate(savedInstanceState: Bundle?)
{
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
var A1 = A()
}
}
class A : Child(), Child.interChild {
interface interA
{
fun A_SendPost()
}
lateinit var LinstenerA : A.interA
init {
LinstenerA = this@A as A.interA
}
fun FireA()
{
if (LinstenerA != null)
LinstenerA.A_SendPost()
}
override fun Child_EventFire()
{
}
}
open class Child {
interface interChild
{
fun Child_EventFire()
}
lateinit var LinstenerB : interChild
init {
LinstenerB = this@Child as interChild
}
fun Fire()
{
if (LinstenerB != null)
LinstenerB.Child_EventFire()
}
}
An error occurs while creating a new listener from a parent class that inherits a child class that has a listener.
Why is that?
If you know anyone, please advise.
|
|
|
|
|
leesungyoen wrote: An error occurs What error, and where does it occur?
|
|
|
|
|
leesungyoen wrote: Why is that?
If you know anyone, please advise. Since there are 143,213,227 possible errors, I don't think we should guess. It would help if you would post the actual error message.
|
|
|
|
|
Does the message appear during compilation or execution? If the latter, should you be using try/catch blocks to help trap the error?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Hi,
In Android Studion ,<pre>why the methods are crossed out here ?
because when I insert AsyncTask the methods don't work
Select Methods to Override/Implement
--android.os.AsyncTask
--onPreExecute():void
--doInBackround(params...):Result
|
|
|
|
|
Did you hover the mouse over them to see what the actual issue is? Could they be deprecated, used in the wrong context, or not inside of a try/catch block?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
|
Something weird has happened with Android Studio. The toolbar has become "merged" with the main window's caption. Normally it would sit just below it. I've been through all of the settings I can find.
Screenshot
Any ideas?
Thanks.
DC
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
I have just upgraded and see the same thing (it's the menu not the toolbar). It looks like they are just rying to save some space.
|
|
|
|
|
how to add button in the of the menu item fragment of the navigation drawer so that when the user click on the button he is redirected to anther sub fragment but one issue here is I am using the android custom navigation drawer implementation below is my try
package com.example.entertainmentlab.ui.store;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProviders;
import com.example.entertainmentlab.R;
import com.example.entertainmentlab.ui.setting.SettingViewModel;
public class StoreFragment extends Fragment {
private StoreViewModel StoreViewModel;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
StoreViewModel =
ViewModelProviders.of(this).get(StoreViewModel.class);
View root = inflater.inflate(R.layout.fragment_store, container, false);
final ImageView MusicButton = root.findViewById(R.id.music_btn);
MusicButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
Fragment fragment = new BlankFragment();
FragmentManager fragmentManager = getActivity().getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.nav_host_fragment_container, fragment);
fragmentTransaction.addToBackStack(null);
fragmentTransaction.commit();
}catch (Exception e ){
Toast.makeText(getActivity(), "erro "+e, Toast.LENGTH_SHORT).show();
}
}
});
return root;
|
|
|
|
|
So what exactly is the problem?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
I have been trying FOREVER to get a simple Xamarin Forms app to call a Web API. I am running this Microsoft sample Xamarin.Forms - TodoREST - Code Samples | Microsoft Docs
The only change I made was the port number that the API uses. This line is in a constants file. The emulator uses the internal ip of 10.0.2.2:
public static string RestUrl = DeviceInfo.Platform ==
DevicePlatform.Android ?
"http://10.0.2.2:44300/api/todoitems/{0}" :
"http://localhost:44300/api/todoitems/{0}";
Here's the relevant code. The URI being passed is correct from the line above:
public async Task> RefreshDataAsync()
{
Items = new List();
Uri uri = new Uri(string.Format(Constants.RestUrl, string.Empty));
try
{
HttpResponseMessage response = await client.GetAsync(uri);
if (response.IsSuccessStatusCode)
{
string content = await response.Content.ReadAsStringAsync();
Items = JsonConvert.DeserializeObject>(content);
}
}
catch (Exception ex)
{
Debug.WriteLine(@"\tERROR {0}", ex.Message);
}
return Items;
}
It throws this exception:
{Java.Net.SocketException: Connection reset
at Java.Interop.JniEnvironment+InstanceMethods.CallIntMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x0006e] in :0
at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualInt32Method (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0002a] in :0
at Java.Net.HttpURLConnection.get_ResponseCode () [0x0000a] in :0
at Xamarin.Android.Net.AndroidClientHandler+<>c__DisplayClass46_0.b__2 () [0x00000] in :0
at System.Threading.Tasks.Task`1[TResult].InnerInvoke () [0x0000f] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Future.cs:534
at System.Threading.Tasks.Task.Execute () [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2319
--- End of stack trace from previous location where exception was thrown ---
at Xamarin.Android.Net.AndroidClientHandler.DoProcessRequest (System.Net.Http.HttpRequestMessage request, Java.Net.URL javaUrl, Java.Net.HttpURLConnection httpConnection, System.Threading.CancellationToken cancellationToken, Xamarin.Android.Net.AndroidClientHandler+RequestRedirectionState redirectState) [0x00372] in :0
at Xamarin.Android.Net.AndroidClientHandler.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x002d0] in :0
at System.Net.Http.HttpClient.FinishSendAsyncBuffered (System.Threading.Tasks.Task`1[TResult] sendTask, System.Net.Http.HttpRequestMessage request, System.Threading.CancellationTokenSource cts, System.Boolean disposeCts) [0x0017e] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.Net.Http/src/System/Net/Http/HttpClient.cs:506
at TodoREST.RestService.RefreshDataAsync () [0x0006b] in C:\Projects\SandBox\Xamarin\Mirosoft Examples\Web Services\ToDoREST\TodoREST\Data\RestService.cs:30
--- End of managed Java.Net.SocketException stack trace ---
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:209)
at java.net.SocketInputStream.read(SocketInputStream.java:139)
at com.android.okhttp.okio.Okio$2.read(Okio.java:136)
at com.android.okhttp.okio.AsyncTimeout$2.read(AsyncTimeout.java:211)
at com.android.okhttp.okio.RealBufferedSource.indexOf(RealBufferedSource.java:306)
at com.android.okhttp.okio.RealBufferedSource.indexOf(RealBufferedSource.java:300)
at com.android.okhttp.okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:196)
at com.android.okhttp.internal.http.Http1xStream.readResponse(Http1xStream.java:186)
at com.android.okhttp.internal.http.Http1xStream.readResponseHeaders(Http1xStream.java:127)
at com.android.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:737)
at com.android.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:609)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:471)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:407)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:538)
}
Can anyone help? All I want is to call into a Rest API can get data back.
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|