|
Not necessarily. Many (probably almost all) devices have low power sleep modes that can be woken from by real time clock interrupts (and other interrupts, like a pushbutton). So setting a time-of-day alarm and going to sleep is a very effective strategy for minimising power consumption.
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
Hence the caveat - ty
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
I have an Amazon affiliate site & I want to make an app for this where users can easily find Amazon Coupons in India & get notification as soon as the new coupon deal or promo code arrives in our database.
Please help me understand the technology I should use in my programming & UX.I want to build a fast, efficient and user friendly application for my users.
|
|
|
|
|
You need to hire a guy who will code this app for you.
|
|
|
|
|
Hi
For example, deem I have a rectangle and a button. I want to place the button inside the rectangle with a relative distance from all four sides of the rectangle so that in any screen size, these relations are kept. Please write me a sample XAML code to study.
Thanks.
|
|
|
|
|
<pre lang="Kotlin"><pre>package com.example.cryptotracker
import android.os.Bundle
import android.util.Log
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.LinearLayoutManager
import kotlinx.android.synthetic.main.activity_main.*
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
class MainActivity : AppCompatActivity() {
private lateinit var mAdapter :CryptoAdapter
private var crypto1 = mutableListOf<Crypto>()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
mAdapter = CryptoAdapter(this,crypto1)
recyclerView.adapter = mAdapter
recyclerView.layoutManager = LinearLayoutManager(this)
getCrypto()
}
private fun getCrypto() {
val crypto:Call<CryptoList> = CryptoService.cryptoInstance.getExchanges()
crypto.enqueue(object : Callback<CryptoList> {
override fun onResponse(call: Call<CryptoList>, response: Response<CryptoList>) {
val crypto:CryptoList? = response.body()
if(crypto!=null)
{
Log.d("THISSSSS",crypto.toString())
crypto1.addAll(crypto.crypto1)
mAdapter.notifyDataSetChanged()
}
}
override fun onFailure(call: Call<CryptoList>, t: Throwable) {
Log.d("ERRRRRROR","ERROR IN FETCHING",t)
}
} )
}
}</pre></pre>
<pre lang="Kotlin"><pre>package com.example.cryptotracker
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
class CryptoAdapter(val context:Context, val crypto1:List<Crypto> ):RecyclerView.Adapter<CryptoViewHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CryptoViewHolder {
val view:View = LayoutInflater.from(context).inflate(R.layout.item_crypto,parent,false)
return CryptoViewHolder(view)
}
override fun onBindViewHolder(holder: CryptoViewHolder, position: Int) {
val current_item:Crypto = crypto1[position]
holder.cryptoName.text = current_item.name
holder.cryptoCountry.text = current_item.country
holder.cryptoUrl.text = current_item.url
holder.cryptoVolume.text = current_item.trade_volume_24h_btc
Glide.with(context).load(current_item.image).into(holder.cryptoImage)
}
override fun getItemCount(): Int {
return crypto1.size
}
}
class CryptoViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
var cryptoName = itemView.findViewById<TextView>(R.id.cryptoName)
var cryptoImage = itemView.findViewById<ImageView>(R.id.cryptoImage)
var cryptoCountry = itemView.findViewById<TextView>(R.id.cryptoCountry)
var cryptoUrl = itemView.findViewById<TextView>(R.id.cryptoUrl)
var cryptoVolume = itemView.findViewById<TextView>(R.id.cryptoVolume)
}</pre></pre>
<pre lang="Kotlin"><pre>package com.example.cryptotracker
import retrofit2.Call
import retrofit2.Retrofit
import retrofit2.http.GET
import retrofit2.create
import retrofit2.converter.gson.GsonConverterFactory
import retrofit2.http.Query
const val BASE_URL = "https://api.coingecko.com/"
interface CryptoInteface {
@GET("api/v3/exchanges")
fun getExchanges(): Call<CryptoList>
}
object CryptoService {
val cryptoInstance: CryptoInteface
init {
val retrofit: Retrofit = Retrofit.Builder()
.baseUrl(BASE_URL).addConverterFactory(GsonConverterFactory.create())
.build()
cryptoInstance = retrofit.create(CryptoInteface::class.java)
}
}</pre></pre>
<pre lang="Kotlin"><pre>package com.example.cryptotracker
data class CryptoList (
val crypto1:List<Crypto>
)</pre></pre>
<pre lang="Kotlin">package com.example.cryptotracker
data class Crypto (
val name:String,
val country:String,
val url:String,
val image:String,
val trade_volume_24h_btc:String,
val trade_volume_24h_btc_normalized:String
)</pre>
<pre lang="text">com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:226)
at retrofit2.converter.gson.GsonResponseBodyConverter.convert(GsonResponseBodyConverter.java:40)
at retrofit2.converter.gson.GsonResponseBodyConverter.convert(GsonResponseBodyConverter.java:27)
at retrofit2.OkHttpCall.parseResponse(OkHttpCall.java:243)
at retrofit2.OkHttpCall$1.onResponse(OkHttpCall.java:153)
at okhttp3.RealCall$AsyncCall.execute(RealCall.java:174)
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $
at com.google.gson.stream.JsonReader.beginObject(JsonReader.java:386)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:215)
at retrofit2.converter.gson.GsonResponseBodyConverter.convert(GsonResponseBodyConverter.java:40)
at retrofit2.converter.gson.GsonResponseBodyConverter.convert(GsonResponseBodyConverter.java:27)
at retrofit2.OkHttpCall.parseResponse(OkHttpCall.java:243)
at retrofit2.OkHttpCall$1.onResponse(OkHttpCall.java:153)
at okhttp3.RealCall$AsyncCall.execute(RealCall.java:174)
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764) </pre>
|
|
|
|
|
jerry pugu wrote: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $
The JSON you are trying to deserialize doesn't match the object graph you are trying to deserialize it to.
Specifically, you are expecting JSON that represents a single object, but the JSON you are trying to deserialize represents an array of objects.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
thank you i also ahd the same problem i think these code lines would solve that
|
|
|
|
|
What are the basic topics needed for app development .I had learned the concepts of inheritence , virtual functions and polymorphism. Is template concept is needed ? Please give the list of all topics needed or oops concepts .
|
|
|
|
|
I have made a BMI calculator based on a tutorial from Youtube. I added a wallpaper to my app. I want to add a transparent frame to my background and all the controls would be put on that frame.
I tried this code:
<Frame BackgroundColor="Black"
CornerRadius="10"
HasShadow="False"
Opacity="0.5"
Margin="30">
<FlexLayout Direction="Column"
JustifyContent="SpaceEvenly"
Padding="5">
<StackLayout>
<Label Text="قد شما چند سانتیمتر است؟"
Style="{StaticResource TitleStyle}"/>
<Label Text="{Binding Source={x:Reference HeightSlider},
Path=Value,
StringFormat='{0:F0} cm'}"
Style="{StaticResource ValueStyle}"/>
<Slider x:Name="HeightSlider"
Maximum="220"
Minimum="40"
Value="{Binding Height}"/>
</StackLayout>
<StackLayout>
<Label Text="وزن شما چند کیلوگرم است؟"
Style="{StaticResource TitleStyle}"/>
<Label Text="{Binding Source={x:Reference WeightSlider},
Path=Value,
StringFormat='{0:F0} kg'}"
Style="{StaticResource ValueStyle}"/>
<Slider x:Name="WeightSlider"
Maximum="150"
Minimum="5"
Value="{Binding Weight}"/>
</StackLayout>
<StackLayout>
<Label Text="شاخص توده بدنی شما:"
Style="{StaticResource LabelStyle}"/>
<Label Text="{Binding BMI}"
Style="{StaticResource LabelStyle}"
FontSize="48"/>
<Label Text="{Binding Classification}"
Style="{StaticResource LabelStyle}"
FontSize="20"/>
</StackLayout>
</FlexLayout>
</Frame>
The problem is that all the child nodes get affected by opacity and marigin settings.
I want to have opacity just in fram, not child nodes. Also, Child nodes must have their own padding.
How to fix this problem?
|
|
|
|
|
You need to specify the values for child controls, otherwise they inherit from the parent.
|
|
|
|
|
I added
Opacity ="1" to each child control, but it doesn't take any effect and all the child controls are still semi-transparent.
<Frame BackgroundColor="Black"
CornerRadius="10"
HasShadow="False"
Opacity="0.5"
Margin="30">
<FlexLayout Direction="Column"
JustifyContent="SpaceEvenly"
Padding="5">
<StackLayout Opacity="1">
<Label Text="قد شما چند سانتیمتر است؟"
Style="{StaticResource TitleStyle}"/>
<Label Text="{Binding Source={x:Reference HeightSlider},
Path=Value,
StringFormat='{0:F0} cm'}"
Style="{StaticResource ValueStyle}"/>
<Slider x:Name="HeightSlider"
Maximum="220"
Minimum="40"
Value="{Binding Height}"/>
</StackLayout>
<StackLayout Opacity="1">
<Label Text="وزن شما چند کیلوگرم است؟"
Style="{StaticResource TitleStyle}"/>
<Label Text="{Binding Source={x:Reference WeightSlider},
Path=Value,
StringFormat='{0:F0} kg'}"
Style="{StaticResource ValueStyle}"/>
<Slider x:Name="WeightSlider"
Maximum="150"
Minimum="5"
Value="{Binding Weight}"/>
</StackLayout>
<StackLayout Opacity="1">
<Label Text="شاخص توده بدنی شما:"
Style="{StaticResource LabelStyle}"/>
<Label Text="{Binding BMI}"
Style="{StaticResource LabelStyle}"
FontSize="48"/>
<Label Text="{Binding Classification}"
Style="{StaticResource LabelStyle}"
FontSize="20"/>
</StackLayout>
</FlexLayout>
</Frame>
|
|
|
|
|
|
I read it. But I couldn't find any way to separate chide control opacity from its parent.
Can you help me?
|
|
|
|
|
Sorry, I have never used it. But the remarks suggest you need a higher value for the child. Try some different numbers to see which one works.
|
|
|
|
|
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.
|
|
|
|
|