Id
int64 21.6M
75.6M
| PostTypeId
int64 1
1
| AcceptedAnswerId
int64 21.6M
75.2M
⌀ | ParentId
int64 | Score
int64 -14
71
| ViewCount
int64 5
87.5k
| Body
stringlengths 1
26.6k
| Title
stringlengths 20
150
| ContentLicense
stringclasses 2
values | FavoriteCount
int64 0
0
⌀ | CreationDate
stringlengths 23
23
| LastActivityDate
stringlengths 23
23
| LastEditDate
stringlengths 23
23
⌀ | LastEditorUserId
int64 -1
21.3M
⌀ | OwnerUserId
int64 127k
21.3M
⌀ | Tags
sequencelengths 1
5
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
71,244,401 | 1 | null | null | -1 | 451 | I am doing a function that return the GCD of two long number, and when I tried this example I get this error "integer number too large" although I tried with too number less than the max of long value
```
public class MyClass {
public static void main(String args[]) {
System.out.println(reduction(149361408, 37822859361));
}
static long reduction(long a, long b){
if(b==0) return a;
return reduction(b, a%b);
}
}
```
| integer number too large .error , what can I do | CC BY-SA 4.0 | null | 2022-02-23T21:44:47.403 | 2022-02-23T21:48:15.413 | null | null | 18,293,399 | [
"java",
"android",
"compiler-errors",
"long-integer",
"mobile-development"
] |
71,288,056 | 1 | null | null | 0 | 1,645 | This is the code for the event file
```
import 'package:flutter/foundation.dart';
abstract class AuthEvent {}
class InitEvent extends AuthEvent {}
class SubmitEvent extends AuthEvent {
final String email;
final String password;
SubmitEvent({@required this.email, @required this.password});
}
```
This is how the InitEvent was called...
```
import 'auth_event.dart';
import 'auth_state.dart';
class AuthBloc extends Bloc<AuthEvent, AuthStates> {
AuthBloc() : super(WaitingAuth());
Stream<AuthStates> mapEventToState(AuthEvent event) async* {
yield WaitingAuth();
switch (event.runtimeType) {
case InitEvent:
SharedPreferences prefs = await SharedPreferences.getInstance();
bool login = prefs.getBool('login');
if (login == null || !login) {
prefs.clear();
yield Initialization();
break;
} else {
String token = prefs.getString('token');
String tokenJWT = prefs.getString('tokenJWT');
if (token == null ||
tokenJWT == null ||
token.isEmpty ||
tokenJWT.isEmpty) {
yield Initialization();
} else {
setToken(token);
setJWTToken(tokenJWT);
final response = await Api.getAccount();
if (response is Account) {
final sensorResponse = await Api.getDevices();
if (sensorResponse is List<Sensor>) {
yield SuccessAuth(account: response, sensors: sensorResponse);
} else {
yield SuccessAuth(account: response, sensors: []);
}
} else {
yield Initialization();
}
}
}
break;
case SubmitEvent:
```
Login screen snippet for InitEvent
```
@override
void initState() {
_authBloc = AuthBloc();
_authBloc.add(InitEvent());
_passwordFocusNode = FocusNode();
_emailController = TextEditingController();
_passController = TextEditingController();
super.initState();
}
```
Then in the login screen, InitEvent was called but there is the error of unregistered handler. I don't know what it means. Any help would be appreciated.
| State error was called without a registered event handler | CC BY-SA 4.0 | null | 2022-02-27T20:00:01.897 | 2022-02-27T21:53:17.680 | 2022-02-27T21:53:17.680 | 15,427,566 | 17,268,944 | [
"flutter",
"mobile-development",
"flutter-bloc"
] |
71,349,693 | 1 | null | null | 0 | 64 | Hey guys I am a beginner in Android Develpoment. I am currently learning Navigation Components, but stuck in this app. I am setting listener to the button present in the activity_main.xml inside the FirstFragment.java and SecondFragment.java but my app crashes. I don't know what I am doing wrong.
```
package com.ahstore.inventory;
import android.os.Bundle;
import com.google.android.material.snackbar.Snackbar;
import androidx.appcompat.app.AppCompatActivity;
import android.view.View;
import androidx.navigation.NavController;
import androidx.navigation.Navigation;
import androidx.navigation.fragment.NavHostFragment;
import androidx.navigation.ui.AppBarConfiguration;
import androidx.navigation.ui.NavigationUI;
import com.ahstore.inventory.databinding.ActivityMainBinding;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Button;
public class MainActivity extends AppCompatActivity {
private AppBarConfiguration appBarConfiguration;
private ActivityMainBinding binding;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = ActivityMainBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
setSupportActionBar(binding.toolbar);
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment_content_main);
appBarConfiguration = new AppBarConfiguration.Builder(navController.getGraph()).build();
NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration);
binding.fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public boolean onSupportNavigateUp() {
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment_content_main);
return NavigationUI.navigateUp(navController, appBarConfiguration)
|| super.onSupportNavigateUp();
}
}
```
```
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/coordinatorLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:theme="@style/Theme.Inventory.AppBarOverlay"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
app:popupTheme="@style/Theme.Inventory.PopupOverlay" />
</com.google.android.material.appbar.AppBarLayout>
<HorizontalScrollView
android:id="@+id/horizontalScrollView"
android:layout_width="409dp"
android:layout_height="50dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:scrollIndicators="none"
android:scrollbarAlwaysDrawHorizontalTrack="false"
android:scrollbarAlwaysDrawVerticalTrack="false"
android:scrollbars="none"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/appBarLayout">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:layout_weight="1"
android:text="Button" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:layout_weight="1"
android:text="Button" />
</LinearLayout>
</HorizontalScrollView>
<fragment
android:id="@+id/nav_host_fragment_content_main"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="0dp"
android:layout_height="0dp"
app:defaultNavHost="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/horizontalScrollView"
app:navGraph="@navigation/nav_graph" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:srcCompat="@android:drawable/ic_input_add"
tools:ignore="SpeakableTextPresentCheck,SpeakableTextPresentCheck" />
</androidx.constraintlayout.widget.ConstraintLayout>
```
```
package com.ahstore.inventory;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.navigation.fragment.NavHostFragment;
import com.ahstore.inventory.databinding.FragmentFirstBinding;
public class FirstFragment extends Fragment {
private FragmentFirstBinding binding;
@Override
public View onCreateView(
LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState
) {
View view=inflater.inflate(R.layout.fragment_first,container,false);
return view;
}
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
Button button1=view.findViewById(R.id.button1);
button1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
NavHostFragment.findNavController(FirstFragment.this)
.navigate(R.id.action_FirstFragment_to_SecondFragment);
}
});
}
@Override
public void onDestroyView() {
super.onDestroyView();
binding = null;
}
}
```
```
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".FirstFragment">
<ScrollView
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="First" />
</LinearLayout>
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
```
```
package com.ahstore.inventory;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.navigation.fragment.NavHostFragment;
import com.ahstore.inventory.databinding.FragmentSecondBinding;
public class SecondFragment extends Fragment {
private FragmentSecondBinding binding;
@Override
public View onCreateView(
LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState
) {
View view=inflater.inflate(R.layout.fragment_second,container,false);
return view;
}
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
Button button=view.findViewById(R.id.button2);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
NavHostFragment.findNavController(SecondFragment.this)
.navigate(R.id.action_SecondFragment_to_FirstFragment);
}
});
}
@Override
public void onDestroyView() {
super.onDestroyView();
binding = null;
}
}
```
```
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/cl"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".SecondFragment">
<TextView
android:id="@+id/textview_second"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="am second"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
```
```
2022-03-04 16:54:11.473 2392-2392/com.ahstore.inventory E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.ahstore.inventory, PID: 2392
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ahstore.inventory/com.ahstore.inventory.MainActivity}: android.view.InflateException: Binary XML file line #79 in com.ahstore.inventory:layout/activity_main: Binary XML file line #79 in com.ahstore.inventory:layout/activity_main: Error inflating class fragment
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3800)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3976)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2315)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8550)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
Caused by: android.view.InflateException: Binary XML file line #79 in com.ahstore.inventory:layout/activity_main: Binary XML file line #79 in com.ahstore.inventory:layout/activity_main: Error inflating class fragment
Caused by: android.view.InflateException: Binary XML file line #79 in com.ahstore.inventory:layout/activity_main: Error inflating class fragment
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Button.setOnClickListener(android.view.View$OnClickListener)' on a null object reference
at com.ahstore.inventory.FirstFragment.onViewCreated(FirstFragment.java:35)
at androidx.fragment.app.Fragment.performViewCreated(Fragment.java:2987)
at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:546)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:282)
at androidx.fragment.app.FragmentStore.moveToExpectedState(FragmentStore.java:112)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1647)
at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3128)
at androidx.fragment.app.FragmentManager.dispatchViewCreated(FragmentManager.java:3065)
at androidx.fragment.app.Fragment.performViewCreated(Fragment.java:2988)
at androidx.fragment.app.FragmentStateManager.ensureInflatedView(FragmentStateManager.java:392)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:281)
at androidx.fragment.app.FragmentLayoutInflaterFactory.onCreateView(FragmentLayoutInflaterFactory.java:140)
at androidx.fragment.app.FragmentController.onCreateView(FragmentController.java:135)
at androidx.fragment.app.FragmentActivity.dispatchFragmentsOnCreateView(FragmentActivity.java:319)
at androidx.fragment.app.FragmentActivity.onCreateView(FragmentActivity.java:298)
at android.view.LayoutInflater.tryCreateView(LayoutInflater.java:1067)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:995)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:959)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1121)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082)
at android.view.LayoutInflater.inflate(LayoutInflater.java:680)
at android.view.LayoutInflater.inflate(LayoutInflater.java:532)
at com.ahstore.inventory.databinding.ActivityMainBinding.inflate(ActivityMainBinding.java:75)
at com.ahstore.inventory.databinding.ActivityMainBinding.inflate(ActivityMainBinding.java:69)
at com.ahstore.inventory.MainActivity.onCreate(MainActivity.java:32)
at android.app.Activity.performCreate(Activity.java:8198)
2022-03-04 16:54:11.474 2392-2392/com.ahstore.inventory E/AndroidRuntime: at android.app.Activity.performCreate(Activity.java:8182)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3773)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3976)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2315)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8550)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
```
| Accessing Parent Activity Button in Fragment Crashes App | CC BY-SA 4.0 | null | 2022-03-04T10:03:39.573 | 2022-03-04T11:43:16.277 | 2022-03-04T11:30:56.327 | 18,372,253 | 18,372,253 | [
"java",
"android",
"mobile-development"
] |
71,349,984 | 1 | 71,366,500 | null | 0 | 205 | I have a mobile app in Xamarin where a QR-code scanner is needed. Scanning the code works fine... After scanning a code, the user is redirected to another page. After checking out this page, the user is redirected to the page where the scanner is located. So, when this redirection happens, I get the error `Java.Lang.RuntimeException: 'getParameters failed (empty parameters)'`... I googled for hours but couldn't find any solution for this problem. BTW, it also happens when I use the 'back' button on the emulator or real word Android device...
| How to solve Java.Lang.RuntimeException: 'getParameters failed (empty parameters)' | CC BY-SA 4.0 | null | 2022-03-04T10:25:38.207 | 2022-03-05T22:48:11.607 | null | null | 18,372,619 | [
"c#",
"xamarin",
"xamarin.forms",
"camera",
"mobile-development"
] |
71,422,322 | 1 | null | null | 5 | 1,269 | In react native default when I use some large fontsize I got vertical spacing. I tried `lineHeight` but after giving exact lineHeight equals to fontSize it just remove spacing from top not from bottom. I have added the border to see the diff.
```
<Text
style={{
fontSize: 40,
lineHeight: 40,
textTransform: 'uppercase',
borderWidth: 1
}}
>
Account
</Text>
```
I want to add some fix margin from top and bottom but that extra space added up and making more gap between elements. and I don't know how much this spacing is so I can add/sub it from original margin.
Note: I am just doing it for android now.
[](https://i.stack.imgur.com/pg08D.png)
| react-native : How to remove vertical spacing in <Text> | CC BY-SA 4.0 | null | 2022-03-10T10:08:45.550 | 2023-01-03T18:17:48.820 | 2022-03-10T10:16:06.140 | 11,528,511 | 11,528,511 | [
"android",
"reactjs",
"react-native",
"mobile-development",
"react-native-stylesheet"
] |
71,431,252 | 1 | null | null | 0 | 30 | Does react-native have any way of communicating with and using the expansion packs that are available on the google play store? Or am I limited to a small app size or using external hosting?
Thanks!
| How to use android expansion packs in react-native? | CC BY-SA 4.0 | null | 2022-03-10T21:54:59.243 | 2022-03-10T21:54:59.243 | null | null | 18,432,346 | [
"android",
"react-native",
"mobile-development"
] |
71,449,405 | 1 | 71,796,514 | null | 1 | 2,985 | I would like to develop an app just for my own iPhone and download the app on it, but I don't have the apple developer account. I found out that (if I'm not wrong) for an app made with Flutter it is not possible, unless I do every week some procedure. Is there some other tool like I don't know React Native or something else with which there is a way to do it? And if there is, what is that way?
| Build an app for iPhone no apple developer account | CC BY-SA 4.0 | null | 2022-03-12T11:42:52.533 | 2022-04-08T11:51:45.997 | null | null | 14,274,608 | [
"ios",
"iphone",
"flutter",
"react-native",
"mobile-development"
] |
71,489,916 | 1 | null | null | 1 | 171 | I have an issue with my flutter application, I have searched a lot but I didn't find the solution, my problem is when I used pageview builder without stream builder, it was scrolling horizontally, but when I add stream builder because I need data from firebase, it doesn't scroll anymore, when I try scrolling, it's like refreshing, here is my code using stream builder, please help.
```
import 'package:dots_indicator/dots_indicator.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:like_button/like_button.dart';
import 'package:p2_flutter/utils/colors.dart';
import 'package:p2_flutter/utils/dimensions.dart';
import 'package:p2_flutter/widgets/app_column.dart';
import 'package:p2_flutter/widgets/big_text.dart';
import 'package:p2_flutter/widgets/icon_and_text_widget.dart';
import 'package:p2_flutter/widgets/small_text.dart';
import '../../routes/route_helper.dart';
import '../constants.dart';
import 'informations.dart';
import 'article.dart';
class Part1PageBody extends StatefulWidget {
const Part1PageBody({Key? key}) : super(key: key);
@override
_Part1PageBodyState createState() => _Part1PageBodyState();
}
class _Part1PageBodyState extends State<Part1PageBody> {
PageController pageController = PageController(viewportFraction: 0.90);
var _currPageValue = 0.0;
final double _scaleFactor = 0.8;
final double _height = Dimensions.pageViewContainer;
@override
void initState() {
super.initState();
pageController.addListener(() {
setState(() {
_currPageValue = pageController.page!;
});
});
}
@override
Future<void> dispose() async {
pageController.dispose();
}
FirebaseFirestore Firestore = FirebaseFirestore.instance;
@override
Widget build(BuildContext context) {
return Column(
children: [
GestureDetector(
onTap: () {
Get.toNamed(RouteHelper.getMeetsDetail());
},
child: Container(
height: Dimensions.pageView,
child: StreamBuilder<QuerySnapshot>(
stream: Firestore.collection('meets').snapshots(),
builder: (context, snapshot) {
if (snapshot.hasError) {
return Center(
child: Text(snapshot.error.toString()),
);
}
if (!snapshot.hasData ||
snapshot.connectionState == ConnectionState.waiting) {
return const Center(child: CircularProgressIndicator());
} else {
final data = snapshot.requireData;
return PageView.builder(
controller: pageController,
itemCount: data.docs.length,
itemBuilder: (context, position) {
return _buildPageItem(
position, data.docs[position]);
});
}
})),
), ],
);
}
Widget _buildPageItem(int index,QueryDocumentSnapshot<Object?> s) {
Matrix4 matrix = new Matrix4.identity();
if (index == _currPageValue.floor()) {
var currScale = 1 - (_currPageValue - index) * (1 - _scaleFactor);
var currTrans = _height * (1 - currScale) / 2;
matrix = Matrix4.diagonal3Values(1, currScale, 1)
..setTranslationRaw(0, currTrans, 0);
} else if (index == _currPageValue.floor() + 1) {
var currScale =
_scaleFactor + (_currPageValue - index + 1) * (1 - _scaleFactor);
var currTrans = _height * (1 - currScale) / 2;
matrix = Matrix4.diagonal3Values(1, currScale, 1);
matrix = Matrix4.diagonal3Values(1, currScale, 1)
..setTranslationRaw(0, currTrans, 0);
} else if (index == _currPageValue.floor() - 1) {
var currScale = 1 - (_currPageValue - index) * (1 - _scaleFactor);
var currTrans = _height * (1 - currScale) / 2;
matrix = Matrix4.diagonal3Values(1, currScale, 1);
matrix = Matrix4.diagonal3Values(1, currScale, 1)
..setTranslationRaw(0, currTrans, 0);
} else {
var currScale = 0.8;
matrix = Matrix4.diagonal3Values(1, currScale, 1);
matrix = Matrix4.diagonal3Values(1, currScale, 1)
..setTranslationRaw(0, _height * (1 - _scaleFactor) / 2, 1);
}
return Transform(
transform: matrix,
child: Stack(
children: [
GestureDetector(
onTap: () {
Get.toNamed(RouteHelper.getMeetsDetail());
},
child: Container(
height: Dimensions.pageViewContainer,
margin: EdgeInsets.only(
left: Dimensions.width10, right: Dimensions.width10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(Dimensions.radius30),
color: index.isEven ? Color(0xFF69c5df) : Color(0xFF9294cc),
image: const DecorationImage(
fit: BoxFit.cover,
image: AssetImage("assets/image/img1.jpg")))),
),
Align(
alignment: Alignment.bottomCenter,
child: Container(
height: Dimensions.pageViewTextContainer,
margin: EdgeInsets.only(
left: Dimensions.width30,
right: Dimensions.width30,
bottom: Dimensions.height30),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(Dimensions.radius20),
color: Colors.white,
boxShadow: const [
BoxShadow(
color: Color(0xFFe8e8e8),
blurRadius: 5.0,
offset: Offset(0, 5),
),
BoxShadow(
color: Colors.white,
offset: Offset(-5, 0),
),
BoxShadow(
color: Colors.white,
offset: Offset(5, 0),
),
]),
child: Container(
padding: EdgeInsets.only(
top: Dimensions.height15, left: 15, bottom: 15),
child: AppColumn(
text:s.get('titre') as String,
),
),
),
),
],
),
);
}
}
```
and here is my code that was working without using stream builder.
```
import 'package:dots_indicator/dots_indicator.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:get/get_core/src/get_main.dart';
import 'package:p2_flutter/utils/colors.dart';
import 'package:p2_flutter/utils/dimensions.dart';
import 'package:p2_flutter/widgets/app_column.dart';
import 'package:p2_flutter/widgets/big_text.dart';
import 'package:p2_flutter/widgets/icon_and_text_widget.dart';
import 'package:p2_flutter/widgets/small_text.dart';
import '../../routes/route_helper.dart';
import '../constants.dart';
import 'informations.dart';
import 'meets_detail.dart';
class Part1PageBody extends StatefulWidget {
const Part1PageBody({Key? key}) : super(key: key);
@override
_Part1PageBodyState createState() => _Part1PageBodyState();
}
class _Part1PageBodyState extends State<Part1PageBody> {
PageController pageController = PageController(viewportFraction: 0.90 );
var _currPageValue=0.0;
final double _scaleFactor = 0.8;
final double _height =Dimensions.pageViewContainer;
@override
void initState(){
super.initState();
pageController.addListener(() {
setState(() {
_currPageValue = pageController.page!;
// print(" Current Value is"+ _currPageValue.toString());
});
});
}
@override
Future<void> dispose() async {
pageController.dispose();
}
@override
Widget build(BuildContext context) {
return Column(
children: [
//slider section
GestureDetector(
/* onTap:()
{
Get.toNamed(RouteHelper.getMeetsDetail());
// Get.to(()=>MeetsDetail());
} ,*/
child: Container(
// color: Color(0xFF9294cc),
height:Dimensions.pageView,
child: PageView.builder(
controller: pageController,
itemCount:5 ,
itemBuilder: (context , position){
return _buildPageItem(position);
}
),
),
),
],
);
}
Widget _buildPageItem(int index){
Matrix4 matrix = new Matrix4.identity();
if(index== _currPageValue.floor()){
var currScale = 1-(_currPageValue-index)*(1-_scaleFactor);
var currTrans= _height*(1-currScale)/2;
matrix=Matrix4.diagonal3Values(1, currScale ,1)..setTranslationRaw(0,currTrans,0);
}
else if(index== _currPageValue.floor()+1)
{
var currScale = _scaleFactor+(_currPageValue-index+1)*(1-_scaleFactor);
var currTrans= _height*(1-currScale)/2;
matrix=Matrix4.diagonal3Values(1, currScale ,1);
matrix=Matrix4.diagonal3Values(1, currScale ,1)..setTranslationRaw(0,currTrans,0);
}
else if(index== _currPageValue.floor()-1)
{
var currScale = 1-(_currPageValue-index)*(1-_scaleFactor);
var currTrans= _height*(1-currScale)/2;
matrix=Matrix4.diagonal3Values(1, currScale ,1);
matrix=Matrix4.diagonal3Values(1, currScale ,1)..setTranslationRaw(0,currTrans,0);
}
else
{
var currScale =0.8;
matrix=Matrix4.diagonal3Values(1, currScale ,1);
matrix=Matrix4.diagonal3Values(1, currScale ,1)..setTranslationRaw(0,_height*(1-_scaleFactor)/2,1);
}
return Transform(
transform: matrix,
child: Stack(
children: [
GestureDetector(
/* onTap: (){
Get.toNamed(RouteHelper.getMeetsDetail());
},*/
child: Container(
height:Dimensions.pageViewContainer,
margin: EdgeInsets.only(left: Dimensions.width10,right: Dimensions.width10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(Dimensions.radius30),
color: index.isEven?Color(0xFF69c5df):Color(0xFF9294cc),
image : const DecorationImage(
fit: BoxFit.cover,
image : AssetImage(
"assets/image/img1.jpg"
)
)
)
),
),
Align(
alignment: Alignment.bottomCenter,
child: Container(
height:Dimensions.pageViewTextContainer,
margin: EdgeInsets.only(left: Dimensions.width30,right: Dimensions.width30,bottom: Dimensions.height30),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(Dimensions.radius20),
color: Colors.white,
boxShadow: const [
BoxShadow(
color: Color(0xFFe8e8e8),
blurRadius: 5.0,
offset: Offset(0 ,5),
),
BoxShadow(
color: Colors.white,
offset: Offset(-5,0),
),
BoxShadow(
color: Colors.white,
offset: Offset(5,0),
),
]
),
child: Container(
padding: EdgeInsets.only(top: Dimensions.height15,left: 15, bottom:15),
child: const AppColumn(text: "meeting sujet",),
),
),
),
], ),
);
}
}
```
| page view builder doesn't scroll when I add strembuilder | CC BY-SA 4.0 | null | 2022-03-15T22:54:22.530 | 2022-11-17T19:17:22.750 | 2022-11-17T19:17:22.750 | 18,670,641 | 14,388,991 | [
"flutter",
"dart",
"hybrid-mobile-app",
"mobile-development"
] |
71,508,139 | 1 | 71,508,489 | null | 1 | 706 | I have a flatlist component rendered inside a flex: 1 view, that doesn't perform pull to refresh on iOS. The gesture itself doesn't work, as the list refuses to get pushed down, but works fine on Android.
Here is my flatlist code, and the only code in the screen.
```
<FlatList<any>
style={{
flex: 1,
// marginTop: 10,
}}
contentContainerStyle={{ flexGrow: 1 }}
showsVerticalScrollIndicator={false}
showsHorizontalScrollIndicator={false}
data={ordersDetails?.docs}
keyExtractor={(item) => item._id}
renderItem={renderItem}
bounces={false}
refreshControl={
<RefreshControl
refreshing={loading}
onRefresh={() => {
fetchOrders(getOrdersListRefreshing);
}}
/>
}
initialNumToRender={10}
onEndReachedThreshold={0.01}
onEndReached={() => {
fetchOrders(getOrdersListNoLoading);
}}
removeClippedSubviews
maxToRenderPerBatch={5}
updateCellsBatchingPeriod={200}/>;
```
renderItem is nothing but a text component.
Sorry I am a bit new to React Native.
Thanks in advance!
| React Native Expo Flatlist pull to refresh gesture not triggering on iOS but works fine on Android | CC BY-SA 4.0 | null | 2022-03-17T06:54:10.513 | 2022-03-17T07:31:35.563 | null | null | 7,870,277 | [
"android",
"ios",
"react-native",
"expo",
"mobile-development"
] |
71,561,225 | 1 | null | null | 1 | 603 | So I am pulling data from Cloud Firestore but a bit stuck on checking to see whether the data is being retrieved via the cache or server. So to do this here is how I am pulling the data from cloud firestore
```
marketplacedata() async {
try {
var snapshot = await FirebaseFirestore.instance
.collection('marketplaces')
.doc('All')
.collection('offers')
.get();
```
I'm pulling the data from the init
```
class _SearchMarketplaceState extends State<SearchMarketplace> {
void initState() {
widget.futuredata = getData();
super.initState();
}
getData() async {
return await FireStoreData().marketplacedata('All');
}
```
Then I am using future builder to retrieve the data as such
```
FutureBuilder(
future: widget.futuredata,
builder: (BuildContext context, AsyncSnapshot snapshot) {
var marketplacedata = snapshot.data;
if (snapshot.hasError) {
return Text('something went wrong');
}
**if (snapshot.hasData) {
HOW DO I CHECK WHETHER THE DATA IS COMING FROM CACHE?);
.metadata doesnt work on AsyncSnapShot
}**
if (searchController.text.isNotEmpty) {
marketplacedata = searchFilter(
searchController.text.toLowerCase(), marketplacedata);
}
if (snapshot.connectionState == ConnectionState.waiting) {
return Loading();
} else {
return GridView.builder(
gridDelegate:
const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3,
childAspectRatio: (4 / 4),
),
itemCount: marketplacedata.length ?? 1,
itemBuilder: (BuildContext context, int index) {
return buildMarketplace(context, index,
marketplaceID: marketplacedata[index].marketplaceID,
heading: marketplacedata[index].heading,
companyDesc: marketplacedata[index].companyDesc,
iconURL: marketplacedata[index].iconURL,
keywords: marketplacedata[index].keywords,
preferred: marketplacedata[index].preferred,
imgURL: marketplacedata[index].imgURL);
},
);
}
},
),
```
Any help is appreciated. In the end I am trying to minimize the number of reads I am getting and hoping to get most of the data read from the cache. However I cant seem to access any data. Thanks in advance.
| How to get Metadata for Asynchronous Snapshot in Flutter | CC BY-SA 4.0 | null | 2022-03-21T16:50:27.100 | 2022-03-22T19:11:07.733 | null | null | 8,128,856 | [
"firebase",
"flutter",
"dart",
"google-cloud-firestore",
"mobile-development"
] |
71,578,390 | 1 | null | null | 0 | 131 | I've been using android profiler to see how well my application performs on different devices and I was wondering if there's a way to automatically get average values such as average memory consumption in a set amount of time or for the entire duration of the profiling session. Peak values are easy to notice and mark down but an average would be very hard and time consuming to manually determine. I couldn't find any option that would allow me to easily get theses averages for me to make a report on how well my application performs in general.
I've tried searching for any examples on how to do this but haven't been able to find anything similar to what I'm trying to do.
| Getting average values with Android Profiler in Android Studio | CC BY-SA 4.0 | null | 2022-03-22T20:15:08.723 | 2022-03-23T06:11:29.613 | null | null | 15,412,161 | [
"android",
"android-studio",
"kotlin",
"mobile-development",
"android-profiler"
] |
71,582,494 | 1 | null | null | 0 | 24 | I Have recently finished designing my mobile app in balsamic wireframe and now it's time build it in android studio.
What should be right approach for me?
should or can I create all the layout first before starting the hard coding.
or do one by one.
I would be a great if someone can help me with it.
thanks
I Haven't tried to implement the design in the android studio
| What should be the right approach while developing android app when the prototype is ready | CC BY-SA 4.0 | null | 2022-03-23T06:03:47.107 | 2022-03-23T06:03:47.107 | null | null | 11,939,496 | [
"android",
"kotlin",
"mobile-development"
] |
71,603,942 | 1 | 71,606,402 | null | 0 | 377 | [Image of Code](https://i.stack.imgur.com/ZQSTR.png)
So I had a question about how to run rendering in react native after data is loaded from a database. In my code, I want to list prescriptions, but it keeps giving errors as it tries to load the prescription in the rendering function before executing the code that reaches out to firebase and gets the prescription data. How do I make it so that the rendering happens after the firebase data is gathered.
| How to delay rendering in React Native or make rendering happen after the data is found | CC BY-SA 4.0 | null | 2022-03-24T14:05:17.280 | 2022-03-24T17:15:06.477 | null | null | 18,569,252 | [
"reactjs",
"react-native",
"rendering",
"mobile-development"
] |
71,658,121 | 1 | null | null | 1 | 132 | I have a project from my developer, they make apps for me Android and iOS apps. When I check the source code they used Java code and they call file XML to load the data and all the logic is in the XML. This is the code structure:
`ProjectName`
`--and``keystore``--Android``--IOS``--plist``----common``----data``----html``----popover``----resource``----screen``----tr``----base``screen.xml`
`----finger.xml`
`----login.xml`
`----intro.xml`
This code was created in 2015 - 2016
My question is, what is the framework or tool to make this code? Cuz the developer didn't tell me. Please help
I think they used a hybrid framework to generate this project. Same as Flutter, React Native, Iconic, etc but they use XML so it's not Flutter, React native, and Iconic I guess.
| What kind of framework or tools to make Android and iOS App using XML (logic and layout) | CC BY-SA 4.0 | null | 2022-03-29T07:35:35.177 | 2022-03-29T10:04:34.950 | 2022-03-29T08:24:41.323 | 6,021,333 | 6,021,333 | [
"android",
"ios",
"xml",
"mobile",
"mobile-development"
] |
71,691,182 | 1 | null | null | 1 | 130 | How to solve the problem where the value in xAxis Mpcharts is -1? Because of this problem, my first array in xAxis is not showing.
```
inner class MyAxisFormatter : IndexAxisValueFormatter() {
override fun getAxisLabel(value: Float, axis: AxisBase?): String {
var xValue = ""
val index = value.toInt()
Log.d("Main Activity", "value: " + value)
xValue = if (index < Month_AmountArrayList.size && index > 0) {
Month_AmountArrayList[index].month
} else {
""
}
return xValue
}
}
```
2 elements in the array:
[](https://i.stack.imgur.com/dRGRC.png)
The output in logcat:
[](https://i.stack.imgur.com/WmdmS.png)
The output in phone:
[](https://i.stack.imgur.com/pRGai.png)
chart output not showing Jan
| xAxis in MP Android Chart getAxisLabel(value: Float, axis: AxisBase?) value showing negative -1 | CC BY-SA 4.0 | null | 2022-03-31T10:49:50.717 | 2022-03-31T14:12:40.707 | 2022-03-31T14:12:40.707 | 4,420,967 | 16,802,042 | [
"android",
"kotlin",
"mpandroidchart",
"mobile-development"
] |
71,694,558 | 1 | null | null | 0 | 526 | ```
Launching lib/main.dart on SM A715F in debug mode...Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=trueException in thread "main" java.net.UnknownHostException: DESKTOP-O8L0ETS 9204at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:220)at java.base/java.net.Socket.connect(Socket.java:609)at java.base/java.net.Socket.connect(Socket.java:558)at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:182)at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:474)at java.base/sun.net.www.http.HttpClient$1.run(HttpClient.java:526)at java.base/sun.net.www.http.HttpClient$1.run(HttpClient.java:524)at java.base/java.security.AccessController.doPrivileged(Native Method)at java.base/sun.net.www.http.HttpClient.privilegedOpenServer(HttpClient.java:523)at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:564)at java.base/sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:265)at java.base/sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:372)at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:212)at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1208)at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1081)at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:189)at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1592)at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1520)at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:250)at org.gradle.wrapper.Download.downloadInternal(Download.java:58)at org.gradle.wrapper.Download.download(Download.java:44)at org.gradle.wrapper.Install$1.call(Install.java:61)at org.gradle.wrapper.Install$1.call(Install.java:48)at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)at org.gradle.wrapper.Install.createDist(Install.java:48)at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:128)at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)Exception: Gradle task assembleDebug failed with exit code 1Exited (sigterm)
```
I am a student.
I am trying to run this app created by flutter but I get this error. I disabled all Java options yesterday thinking that was the problem
I am running on flutter version 2.10.3, dart version 2.16.1.
| Flutter : Gradle task assembleDebug failed with exit code 1 | CC BY-SA 4.0 | null | 2022-03-31T14:42:06.923 | 2022-03-31T15:50:37.620 | null | null | 18,385,404 | [
"flutter",
"android-studio",
"dart",
"mobile-development"
] |
71,709,082 | 1 | 71,744,759 | null | 1 | 623 | If I use a wildcard to define deeplinking in Android 12 does not work it fails with `legacy_failure` if I run `pm get-app-links com.example.app` in `adb shell` but if I use a specific domain, the it works. So if I use
`<data android:host="*.example.com" android:pathPrefix="/profile/" />`
it gives me `legacy_failure`
but if I use
`<data android:host="www.example.com" android:pathPrefix="/profile/" />`
it works fine, and verifies. Wildcard usage should be possible based on documentation, and it worked in previous versions ( if I fun my app on a device with < 12 version of android it works just fine )
[https://developer.android.com/training/app-links/verify-site-associations#multi-subdomain](https://developer.android.com/training/app-links/verify-site-associations#multi-subdomain)
I need to catch every subdomain, because we have a lot for this project - any idea how can I overcome this is much appreciated :)
( I made sure that everything from [https://developer.android.com/training/app-links/verify-site-associations](https://developer.android.com/training/app-links/verify-site-associations) is correct )
| Using wildcard in host attribute for android 12 AppLinks does not work ( android:host="*.example.com" does not work but www.example.com does ) | CC BY-SA 4.0 | null | 2022-04-01T15:07:27.457 | 2022-04-04T23:23:18.357 | null | null | 1,214,492 | [
"android",
"deep-linking",
"mobile-development",
"applinks"
] |
71,734,452 | 1 | null | null | 3 | 958 | In my react native app , http requests are working fine, but when it comes to https request, it is giving error , network request failed . Problem is bit strange here as if I pick and run any example api from the internet, it is working alright even with https. I can't tell ,if problem is with my api or with my system.
i have tried few solutions ,but they didnt work
| why https request is not working in my react-native app? | CC BY-SA 4.0 | null | 2022-04-04T08:54:59.633 | 2022-09-08T10:42:03.390 | null | null | 17,189,337 | [
"android",
"reactjs",
"react-native",
"networking",
"mobile-development"
] |
71,750,190 | 1 | null | null | 2 | 305 | what is the difference here
first yield push our status to the stream
and what does the second yield* do?
```
final _controller = StreamController<AuthenticationStatus>();
Stream<AuthenticationStatus> get status async* {
await Future<void>.delayed(const Duration(seconds: 1));
yield AuthenticationStatus.unauthenticated;
yield* _controller.stream;
}
```
what would be the difference between and ?
i can’t understand why we need to yield* controller.stream and what difference it makes
| what is yield* controller.stream | CC BY-SA 4.0 | null | 2022-04-05T10:29:17.140 | 2022-04-05T10:32:35.267 | null | null | 18,388,574 | [
"flutter",
"dart",
"stream",
"bloc",
"mobile-development"
] |
71,753,981 | 1 | null | null | 0 | 120 | In Firebase i can only login and register with email/password.
Also using phone number/ OTP to register, login.
How about login with phone number and password?
Did i missing some information or courses?
| How to Register/Log in using Phone Number/Password | CC BY-SA 4.0 | null | 2022-04-05T14:55:20.177 | 2022-04-05T14:55:20.177 | null | null | 16,656,227 | [
"firebase",
"flutter",
"mobile-development"
] |
71,766,964 | 1 | null | null | 0 | 491 | I have a native Splash Screen so no need to create a new one here and need to set LoginPage as default
as well I have authenticated status than define which route to follow
so I set onGenerateRoute: (_) =>LoginPage.route(), and it loads twice in and mode
```
case AuthenticationStatus.authenticated:
_navigator.pushAndRemoveUntil<void>(
HomePage.route(),
(route) => false
);
break;
case AuthenticationStatus.unauthenticated:
_navigator.pushAndRemoveUntil<void>(
LoginPage.route(),
(route) => false
);
break;
default:
break;
...
onGenerateRoute: (_) =>LoginPage.route(),
```
How to save the same logic but without double loading?
| Home Screen Loads Twice | CC BY-SA 4.0 | null | 2022-04-06T12:43:10.823 | 2022-04-06T15:28:54.723 | null | null | 18,388,574 | [
"flutter",
"dart",
"bloc",
"mobile-development"
] |
71,818,001 | 1 | null | null | 0 | 418 | I'm trying to implement phone authentication in my Flutter application using `FirebaseAuth.instance.verifyPhoneNumber` but do not know how to await it in an async function, so that the asynchronous `codeSent` parameter completes before moving on.
For example, with the following code:
```
ElevatedButton(
onPressed: () async {
await FirebaseAuth.instance.verifyPhoneNumber(
phoneNumber: phoneNumber,
verificationCompleted: (phoneAuthCredential) {},
verificationFailed: (error) {},
codeSent: (verificationId, forceResendingToken) async {
await Future.delayed(
Duration(seconds: 2),
);
},
codeAutoRetrievalTimeout: (verificationId) {},
);
print('COMPLETED');
},
child: Text('Verify'),
),
```
I want the `Future.delayed(Duration(seconds: 2))` to complete before the print statement. Is there any way of implementing this functionality? Am I missing something obvious?
| Flutter FireBase - How can you asynchronously await verifyPhoneNumber? | CC BY-SA 4.0 | null | 2022-04-10T15:24:07.067 | 2022-08-04T11:47:17.653 | null | null | 4,039,432 | [
"firebase",
"flutter",
"firebase-authentication",
"mobile-development"
] |
71,823,579 | 1 | null | null | 0 | 17 | I am creating an app where the user can decide if he/she wants to setup or upgrade his/her account so that he/she can sell products. In that app there is a 4 bottom navigation menu fragments (`Home`, `Purchases`, `Sell`, `Account`). When the user clicks the `Sell menu` it shows if the user wants to sell or not and there is a `Get Started button`. So if the user want to sell a product, the user will click the `get started` button and the user will setup his/her account. So after the user finishes the account setup I want to change the layout in `Sell menu` where the user can now sell items. Now when the user clicks the `Sell menu` instead of seeing the `get started button`, the user will now see the options to sell items. I want to implement this and I do not know how.
| How to show activity only once until setup is complete in android studio | CC BY-SA 4.0 | null | 2022-04-11T06:39:28.010 | 2022-04-12T02:15:35.293 | null | null | 18,589,054 | [
"android-studio",
"mobile",
"mobile-development"
] |
71,890,672 | 1 | 71,911,341 | null | 1 | 49 | I am creating an app and one of the aspects is just a pretty simple rating section. It's quite simple at the moment with just getting the average rating and displaying that using stars. I have 5 ImageViews displayed in a Linear Layout and the background of each Imageview changes to one of three star drawables depending on the rating score. Here is the layout structure of the stars:
```
starFilled = ContextCompat.getDrawable(requireContext(), R.drawable.ic_baseline_star_rate_24);
starOutline = ContextCompat.getDrawable(requireContext(), R.drawable.ic_baseline_star_outline_24);
halfStar = ContextCompat.getDrawable(requireContext(), R.drawable.ic_baseline_star_half_24);enter code here
<LinearLayout
android:id="@+id/overall_rating_stars"
android:layout_width="wrap_content"
android:layout_height="35dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/overall_rating_title">
<ImageView
android:id="@+id/overall_rating_s1"
android:layout_width="35dp"
android:layout_height="match_parent"
android:background="@drawable/ic_baseline_star_outline_24"/>
<ImageView
android:id="@+id/overall_rating_s2"
android:layout_width="35dp"
android:layout_height="match_parent"
android:background="@drawable/ic_baseline_star_outline_24"/>
<ImageView
android:id="@+id/overall_rating_s3"
android:layout_width="35dp"
android:layout_height="match_parent"
android:background="@drawable/ic_baseline_star_outline_24"/>
<ImageView
android:id="@+id/overall_rating_s4"
android:layout_width="35dp"
android:layout_height="match_parent"
android:background="@drawable/ic_baseline_star_outline_24"/>
<ImageView
android:id="@+id/overall_rating_s5"
android:layout_width="35dp"
android:layout_height="match_parent"
android:background="@drawable/ic_baseline_star_outline_24"/>
</LinearLayout>
```
And here is how I am changing the background of the stars:
```
private void mapRating(ImageView star1, ImageView star2, ImageView star3, ImageView star4, ImageView star5, double rating) {
if (rating == 0.0) {
star1.setBackground(starOutline);
star2.setBackground(starOutline);
star3.setBackground(starOutline);
star4.setBackground(starOutline);
star5.setBackground(starOutline);
} else {
if (rating <= 0.50) {
star1.setBackground(halfStar);
}
if (rating > 0.50) {
star1.setBackground(starFilled);
}
if (rating > 1.00 && rating <= 1.50) {
star2.setBackground(halfStar);
}
if (rating > 1.50) {
star2.setBackground(starFilled);
}
if (rating > 2.00 && rating <= 2.50) {
star3.setBackground(halfStar);
}
if (rating > 2.50) {
star3.setBackground(starFilled);
}
if (rating > 3.00 && rating <= 3.50) {
star4.setBackground(halfStar);
}
if (rating > 3.50) {
star4.setBackground(starFilled);
}
if (rating > 4.00 && rating <= 4.50) {
star5.setBackground(halfStar);
}
if (rating > 4.50) {
star5.setBackground(starFilled);
}
}
}
```
It's certainly not the most refined or elegant way of changing the stars but my problem is at least one of the stars seems to change in size when running the application and viewing the ratings: [smaller 5th star](https://i.stack.imgur.com/g4n1R.png), [smaller 4th star](https://i.stack.imgur.com/8vVDg.png),[smaller 2nd star](https://i.stack.imgur.com/ILHQL.png)
I have tried a multitude of different things such as changing from background to src in both XML and Fragment. As well changing the scaleType for each but to center|crop or center or even XY. However, none of it seems to be fixing it. All the stars have the same height (50dp), width (50dp), and viewport height/width (24). Help would be greatly appreciated as this is a minor yet frustrating problem.
| ImageView in LinearLayout changes size when background changes | CC BY-SA 4.0 | null | 2022-04-16T02:43:23.607 | 2022-04-18T11:42:50.840 | null | null | 18,819,957 | [
"java",
"android",
"android-studio",
"mobile-development"
] |
71,953,797 | 1 | null | null | 0 | 700 | I want to show the image returned from the endpoint that I requested, in the NetworkImage widget. Each image to return has a separate id. I need to update this id when making request to endpoint. How can I do that? I use provider class.
```
//provider
class InfoDetailsProvider with ChangeNotifier {
HttpService _httpService = HttpService();
Future<StorageItem> getImage(String imageId ) async {
StorageItem storageItem;
_httpService.initWithToken(authToken);
final urlImage= "http://example../$imageId";
try {
final result = await _httpService.request(url: urlImage, method: Method.GET);
if (result != null) {
if (result is d.Response) {
var responseData = result.data;
storageItem=responseData.forEach((key,value){ });
notifyListeners();
return storageItem;
}
}
} on d.DioError catch (error) {
throw error;
}
return storageItem;
}
}
```
I want to call getImage function in Info Details Screen to display image. Is it possible to call function with in NetworkImage widget?
```
//Screen
class InfoDetailsState extends State<InfoDetailsScreen> {
var _isInit = true;
var _isLoading = false;
@override
void initState() {
super.initState();
}
@override
void didChangeDependencies() {
if (_isInit) {
setState(() {
_isLoading = true;
});
Provider.of<InfoDetailsProvider>(context).getImage(imageId);
}
_isInit = false;
super.didChangeDependencies();
}
...
return Scaffold(
appBar: AppBar(),
body: RefreshIndicator(
....
child: SlidingUpPanel(
...
body: SafeArea(
child: Column(
children: <Widget>[
Container(
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage(
** //Should I call function here?**
),
fit: BoxFit.fill,
),
));
```
| I want to call a function of the provider class from within the NetworkImage widget | CC BY-SA 4.0 | null | 2022-04-21T11:36:27.647 | 2022-04-21T12:22:43.367 | null | null | 16,696,046 | [
"flutter",
"android-studio",
"flutter-provider",
"mobile-development",
"flutter-widget"
] |
71,980,488 | 1 | null | null | 1 | 736 | Up until recently, my app was running on iOS. I am now running into a white screen issue when running `npx run-ios`.
When running `npx run-ios`, the simulator starts up and builds the application, but Metro bundler says `warn No apps connected. Sending "reload" to all React Native apps failed. Make sure your app is running in the simulator or on a phone connected via USB.` on the terminal. Which is odd as the command itself opens the simulator and builds the application.
I am also unable to access the developer menu in both the terminal and on the simulator. So I can't access/edit bundler configs.
Things I've tried:
1. I've tried to delete the node_modules and run npm-install.
2. Deleting the Pods folder and Podfile.lock and then running pod install.
3. As I was working in a development branch, so I checked out to the main branch, which was working fine before, but the same issue persists, so I am doubtful that it's my code (I might be wrong however".
4. Doing Clear device and settingson the simulator.
5. Trying a different simulator.
6. I've seen on different similar posts that the simulator and my dev environment should be on the same network. However, this was never an issue before, and there is also no wifi edit function on the simulator.
7. Running the iOS application from Xcode instead
| React Native White Screen on iOS Simulator | CC BY-SA 4.0 | null | 2022-04-23T14:17:45.107 | 2022-11-10T09:01:32.703 | null | null | 17,561,817 | [
"javascript",
"ios",
"react-native",
"mobile-development"
] |
71,983,784 | 1 | null | null | 0 | 397 | I'm working on a react native app, but when I use `<Image>` to display an image, it only shows up on the web testing. When I open the testing on mobile using Expo Go, I get a blank space where the image should have been. Anyone have tips on what to do?
My code is below:
```
<Text>{recipe.title}</Text>
<Image
style={globalStyles.recipeImage}
source={recipe.image}
/>
</View>
```
The recipeImage style just sets height and width, and `{recipe.image}` is an image link returned by an api, which will look something like this: [https://spoonacular.com/recipeImages/73420-312x231.jpg](https://spoonacular.com/recipeImages/73420-312x231.jpg)
Any help would be much appreciated!
| Images not showing on mobile (ios), but showing on web for React Native | CC BY-SA 4.0 | null | 2022-04-23T21:33:08.473 | 2022-06-29T22:09:30.443 | null | null | 14,417,953 | [
"reactjs",
"react-native",
"image",
"mobile-development"
] |
71,984,471 | 1 | null | null | 2 | 1,332 | I have installed the last version of android studio but i have this error when i start execute my project, the emulator don't working.
I have trying a lot of solution but none of them work with me.
please HELP !!!
[AAPT2 process unexpectedly exit](https://i.stack.imgur.com/HMA2O.jpg)
| Android Studio Bumblebee AAPT2 process unexpectedly exit | CC BY-SA 4.0 | 0 | 2022-04-23T23:56:13.617 | 2022-06-21T11:16:06.133 | null | null | 14,958,896 | [
"java",
"android",
"android-studio",
"android-emulator",
"mobile-development"
] |
71,987,005 | 1 | null | null | 1 | 287 | I'm a beginner in Flutter and need an assistance to integrate Google one tap sign in into my code with [google_one_tap_sign_in](https://pub.dev/packages/google_one_tap_sign_in) Flutter package.
Here's the code:
```
@override
Future<TheUser?> signInWithCredential() async {
final String _webClientId = "XXXXXXXXXXXX-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.apps.googleusercontent.com";
var googleAccount = await GoogleOneTapSignIn.startSignIn(webClientId: _webClientId);
// final googleAccount = await GoogleAuth.instance.getSignedInAccount();
if (googleAccount != null) {
final googleAuth = await googleAccount.authentication;
if (googleAuth.accessToken != null || googleAuth.idToken != null) {
final authResult = await _firebaseAuth.signInWithCredential(
GoogleAuthProvider.credential(idToken: googleAuth.idToken, accessToken: googleAuth.accessToken),
);
return _userFromFirebase(authResult.user);
} else {
throw PlatformException(
code: 'ERROR_MISSING_GOOGLE_AUTH_TOKEN',
message: 'Error Missing Google Auth Token',
);
}
} else {
throw PlatformException(
code: 'ERROR_ABORTED_BY_USER',
message: 'Sign in aborted by user',
);
}
}
```
I don't know how to write the rest of the code inside "if (googleAccount != null) {}".
| Google one tap sign in on Android with Flutter | CC BY-SA 4.0 | null | 2022-04-24T09:14:33.390 | 2022-10-17T23:11:24.757 | null | null | 11,878,615 | [
"android",
"flutter",
"google-signin",
"mobile-development",
"googlesigninaccount"
] |
71,998,054 | 1 | null | null | 1 | 1,227 | How do I set current user using hydrated storage instead of cachedClient
Like its done in bloc docs for firebase login?
```
Stream<User> get user {
return _firebaseAuth.authStateChanges().map((firebaseUser) {
final user = firebaseUser == null ? User.empty : firebaseUser.toUser;
_cache.write(key: userCacheKey, value: user);
return user;
});
}
User get currentUser {
return _cache.read<User>(key: userCacheKey) ?? User.empty;
}
```
I have in my User model but in firebase there is a getter current user where cachedClient used
In my user repository i only have
```
Future<User> getUser({required String username, required String password}) async
```
and thats it
But for changing status they added new bloc where they read this current user to set authenticated/unauthenticated
This is how its done for firebase login: [https://bloclibrary.dev/#/flutterfirebaselogintutorial?id=authentication-repository](https://bloclibrary.dev/#/flutterfirebaselogintutorial?id=authentication-repository)
| Authentication with Flutter Bloc/Cubit | CC BY-SA 4.0 | 0 | 2022-04-25T10:26:27.963 | 2022-04-25T10:26:27.963 | null | null | 18,388,574 | [
"android",
"flutter",
"mobile-development",
"flutter-bloc",
"cubit"
] |
72,087,926 | 1 | 72,388,005 | null | 1 | 587 | I have a react native app that worked seamlessly fine on android and ios a few weeks ago (no lags or slow downs)
Until recently, I started noticing that mostly ios devices complain that their phones heat up immediately they enter into my app
Has anyone experienced such an issue before?, and If so what to do to fix it, i am memorizing most components and am caching some images that will render in my app multiple times as optimization efforts but the stats remain the same
Below are some of the stats for the app from Xcode, in my opinion, I don't think it's enough to cause heating
[Memory Usage from Xcode profiler](https://i.stack.imgur.com/jzdNm.png)
[More memory usage from Xcode run](https://i.stack.imgur.com/GuZNJ.png)
[CPU Usage from Xcode](https://i.stack.imgur.com/rhyht.png)
[Cpu Usage details from profiler](https://i.stack.imgur.com/OKGYU.png)
[Image showing next process causing cpu usage](https://i.stack.imgur.com/bnFDX.png)
[Run loop function causing the High CPU usage](https://i.stack.imgur.com/AxW9g.png)
| React Native App causing phone to heat up extensively | CC BY-SA 4.0 | null | 2022-05-02T14:07:35.197 | 2022-05-26T07:04:24.040 | 2022-05-03T10:49:24.677 | 13,157,706 | 13,157,706 | [
"android",
"ios",
"react-native",
"mobile",
"mobile-development"
] |
72,105,825 | 1 | 72,106,155 | null | 0 | 404 | I am following [this](https://blog.logrocket.com/react-native-contacts-how-to-access-a-devices-contact-list/) blog to set up react-native-contacts. After following the steps when I try to get all contacts
```
Contacts.getAll().then((contacts) => {
console.log(contacts)
})
```
I get this error.
`TypeError: Cannot read property 'getAll' of null`
For some reason importing from appears to be null?
I am not sure if there is an issue with my set up. I followed up by reading over [react-natives-contacts](https://github.com/morenoh149/react-native-contacts) set up instructions.
- -
```
PermissionsAndroid.request(
PermissionsAndroid.PERMISSIONS.READ_CONTACTS,
{
'title': 'Contacts',
'message': 'This app would like to view your contacts.',
'buttonPositive': 'Please accept bare mortal'
}
)
.then(Contacts.getAll()
.then((contacts) => {
// work with contacts
console.log(contacts)
})
.catch((e) => {
console.log(e)
}))
-----------------------------
// in AndroidManifest.xml
<uses-permission android:name="android.permission.READ_CONTACTS" />
```
- -
I am using RN 0.69 so auto linking should be enabled? not sure what am I missing?
| React-Native-Contacts: Cannot read property 'getAll' of null | CC BY-SA 4.0 | 0 | 2022-05-03T21:52:24.047 | 2022-05-03T22:40:04.893 | 2022-05-03T22:05:12.017 | 8,282,133 | 8,282,133 | [
"android",
"ios",
"react-native",
"mobile-development",
"react-native-contacts"
] |
72,164,130 | 1 | null | null | -2 | 40 | ```
for (Evenement r : list) {
Container c3 = new Container(new FlowLayout());
Image placeholder = Image.createImage(380, 380);
EncodedImage enc = EncodedImage.createFromImage(placeholder, false);
URLImage urlim = URLImage.createToStorage(enc, r.getImg(), url + "/" + r.getImg());
ImageViewer imgV = new ImageViewer();
imgV.setImage(urlim);
SpanLabel cat= new SpanLabel("Nom de l'evenement :" + r.getNom());
SpanLabel cat6= new SpanLabel(" " );
Label lab= new Label("jjj");
c3.add(imgV);
c3.add(cat6);
add(lab);
```
Images display in `FlowLayout` but I want to add some text under every image. When I add a label with text in it, it appears to the right of the image. Even when I used another `Container` and put in the label, nothing is changed.
Thanks in advance.
Just another question: Is it possible to Itext PDF API which I have already used in java, before.
| How to add text under an image that display in FlowLayout() in codename one | CC BY-SA 4.0 | 0 | 2022-05-08T18:44:28.807 | 2022-05-18T02:38:12.220 | 2022-05-17T13:51:09.733 | 2,164,365 | 18,324,198 | [
"java",
"codenameone",
"mobile-development"
] |
72,175,141 | 1 | null | null | 0 | 97 | I am a student and I have started learning flutter. I have java and Gradle installed and I am using VS Code in Kali Linux.
I am building an app and when I try to run it, it gives this error:
```
Launching lib/main.dart on SM A715F in debug mode...
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
Exception in thread "main" java.util.zip.ZipException: zip END header not found
atjava.base/java.util.zip.ZipFile$Source.zerror(ZipFile.java:1581)
at java.base/java.util.zip.ZipFile$Source.findEND(ZipFile.java:1476)
at java.base/java.util.zip.ZipFile$Source.initCEN(ZipFile.java:1483)
at java.base/java.util.zip.ZipFile$Source.<init>(ZipFile.java:1288)
at java.base/java.util.zip.ZipFile$Source.get(ZipFile.java:1251)
at java.base/java.util.zip.ZipFile$CleanableResource.<init>(ZipFile.java:732)
at java.base/java.util.zip.ZipFile$CleanableResource.get(ZipFile.java:849)
at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:247)
at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:177)
at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:191)
at org.gradle.wrapper.Install.unzip(Install.java:214)
at org.gradle.wrapper.Install.access$600(Install.java:27)
at org.gradle.wrapper.Install$1.call(Install.java:74)
at org.gradle.wrapper.Install$1.call(Install.java:48)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
at org.gradle.wrapper.Install.createDist(Install.java:48)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:128)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
```
| How am I going to solve this error in Flutter? | CC BY-SA 4.0 | null | 2022-05-09T16:16:08.877 | 2022-05-09T16:16:08.877 | null | null | 18,385,404 | [
"android",
"flutter",
"gradle",
"visual-studio-code",
"mobile-development"
] |
72,191,622 | 1 | 72,192,668 | null | 1 | 1,002 | [](https://i.stack.imgur.com/vzAGt.png)
[](https://i.stack.imgur.com/FuqEf.png)
So I want to implement a progress bar like this in react native. I have found a library which is [https://www.npmjs.com/package/react-native-progress](https://www.npmjs.com/package/react-native-progress), but this library does not have a progress bar like this. The issue is the circle part. Is there a library which has a progress bar like this one? If there isn't, then any idea on how to implement this would be appreciated. So as a fellow commenter got confused whether it is a slider or progress bar, I will include the full screen image. There is a timer and the progress bar or progress slider reflects that in real time.
| How do I get this progress bar from react native? | CC BY-SA 4.0 | null | 2022-05-10T18:50:07.510 | 2022-05-10T20:39:02.633 | 2022-05-10T18:55:24.237 | 17,349,712 | 17,349,712 | [
"javascript",
"android",
"react-native",
"mobile-development"
] |
72,257,901 | 1 | null | null | 0 | 235 | In my case, I have a bottom-placed TextFormField above ListView, user can type multiline in TextFormField, but when the user is typing in TextFormField the ListView starts to scroll up automatically, The top tab bar is implemented in a NestedScrollView, and TextFormField is placed in a Stack view, Is there any way to stop that weird behavior.
[](https://i.stack.imgur.com/Hq1OX.gif)
here is the code that include listview
```
@override
Widget build(BuildContext context) {
Log.debug("rebuild comment view");
return Scaffold(
backgroundColor: Colors.white,
body: NestedScrollView(
floatHeaderSlivers: false,
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
return <Widget>[
SliverToBoxAdapter(
child: timeline != null
? UserDetailsCard(
timeline: timeline,
)
: SizedBox(),
),
SliverToBoxAdapter(
child: Padding(
padding: const EdgeInsets.fromLTRB(20, 20, 20, 0),
child: timeline != null
? ExpandableText(
timeline.post.content,
TimelineTextStyles.regular14BlackStyle(),
AppColors.lightGreen,
isEventWidgetEnable: false,
isThumbnailEnable: false,
)
: SizedBox()),
),
SliverSafeArea(
top: false,
bottom: false,
sliver: SliverAppBar(
pinned: true,
floating: false,
snap: false,
automaticallyImplyLeading: false,
backgroundColor: Colors.white,
toolbarHeight: 0,
collapsedHeight: 0,
expandedHeight: 0,
bottom: PreferredSize(
preferredSize: Size.fromHeight(kTextTabBarHeight),
child: timeline != null ? Padding(
padding: EdgeInsets.only(
bottom: 4,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.only(top: 0, left: 20),
child: TabBar(
isScrollable: true,
indicatorColor: AppColors.lightGreen,
indicatorSize: TabBarIndicatorSize.tab,
labelPadding: const EdgeInsets.symmetric(
vertical: 5, horizontal: 15),
indicatorWeight: 3,
indicatorPadding: EdgeInsets.zero,
unselectedLabelColor: AppColors.darkGrey,
labelColor: Colors.white,
indicator: BoxDecoration(
borderRadius: BorderRadius.circular(30),
color: AppColors.lightOrange,
),
tabs: [
for (var tab in _tabsName)
Text(
"$tab",
style: TextStyle(
fontWeight: FontWeight.w500,
fontSize: 14,
),
),
],
onTap: (index) {},
controller: _tabController,
),
),
],
),
) : SizedBox(),
),
),
),
];
},
body: _tabController != null
? TabBarView(
physics: NeverScrollableScrollPhysics(),
children: _tabs,
controller: _tabController,
)
: Center(
child: SizedBox(
width: 40,
height: 40,
child: CircularProgressIndicator(),
),
),
),
);
}
```
| Prevent ListView scrolling automatically when typing in a TextField | CC BY-SA 4.0 | null | 2022-05-16T10:38:49.583 | 2022-05-21T20:31:53.853 | null | null | 10,350,687 | [
"flutter",
"dart",
"listview",
"mobile-development",
"textformfield"
] |
72,275,236 | 1 | null | null | 1 | 533 | I have an app in which I'm using sveltekit with static adapter to build a mobile application using CapacitorJS,
I would like to send push notifications from the server to the client app but I don't want to use any third party like firebase, one signal etc, Please is there any means that would help, I read about service worker but not sure how it would work, thanks in advance
| How to send push notification on mobile app with capacitorJS without third party like firebase or onesignal | CC BY-SA 4.0 | null | 2022-05-17T13:49:23.770 | 2022-05-27T12:21:23.163 | null | null | 9,873,050 | [
"ionic-framework",
"push-notification",
"service-worker",
"sveltekit",
"mobile-development"
] |
72,318,419 | 1 | null | null | 0 | 721 | After upgrading to Flutter version 3.0, my project crashes on the first run. See the log below.
Please I need help.
Launching lib/main.dart on AOSP on IA Emulator in debug mode...
✓ Built build/app/outputs/flutter-apk/app-debug.apk.
Connecting to VM Service at ws://127.0.0.1:41249/xUB1prU2wGQ=/ws
I/Choreographer( 6207): Skipped 81 frames! The application may be doing too much work on its main thread.
[GETX] Instance "GetMaterialController" has been created
[GETX] Instance "GetMaterialController" has been initialized
D/eglCodecCommon( 6207): setVertexArrayObject: set vao to 0 (0) 1 0
D/EGL_emulation( 6207): eglMakeCurrent: 0xdfc05840: ver 3 0 (tinfo 0xc70e43c0)
D/eglCodecCommon( 6207): setVertexArrayObject: set vao to 0 (0) 1 2
F/libc ( 6207): Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 6245 (1.raster), pid 6207 (wetinyouget_app)
---
Build fingerprint: 'google/sdk_gphone_x86_arm/generic_x86_arm:9/PSR1.180720.122/6736742:userdebug/dev-keys'
Revision: '0'
ABI: 'x86'
pid: 6207, tid: 6245, name: 1.raster >>> com.example.wetinyouget_app <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
Cause: null pointer dereference
eax c82ff400 ebx ca35d508 ecx 00000000 edx c82e400c
edi 00000000 esi c82e4068
ebp c817fc08 esp c817fba0 eip c9d7d119
backtrace:
#00 pc 01830119 /data/app/com.example.wetinyouget_app-e_DWA-LGkZ1rYX5KIkh6xA==/lib/x86/libflutter.so (offset 0x147e000)
#01 pc 018383b6 /data/app/com.example.wetinyouget_app-e_DWA-LGkZ1rYX5KIkh6xA==/lib/x86/libflutter.so (offset 0x147e000)
#02 pc 018370bd /data/app/com.example.wetinyouget_app-e_DWA-LGkZ1rYX5KIkh6xA==/lib/x86/libflutter.so (offset 0x147e000)
#03 pc 01766b3b /data/app/com.example.wetinyouget_app-e_DWA-LGkZ1rYX5KIkh6xA==/lib/x86/libflutter.so (offset 0x147e000)
#04 pc 01764fc8 /data/app/com.example.wetinyouget_app-e_DWA-LGkZ1rYX5KIkh6xA==/lib/x86/libflutter.so (offset 0x147e000)
#05 pc 017d73a9 /data/app/com.example.wetinyouget_app-e_DWA-LGkZ1rYX5KIkh6xA==/lib/x86/libflutter.so (offset 0x147e000)
#06 pc 017d72d2 /data/app/com.example.wetinyouget_app-e_DWA-LGkZ1rYX5KIkh6xA==/lib/x86/libflutter.so (offset 0x147e000)
#07 pc 017eab6c /data/app/com.example.wetinyouget_app-e_DWA-LGkZ1rYX5KIkh6xA==/lib/x86/libflutter.so (offset 0x147e000)
#08 pc 017eaa42 /data/app/com.example.wetinyouget_app-e_DWA-LGkZ1rYX5KIkh6xA==/lib/x86/libflutter.so (offset 0x147e000)
#09 pc 01759062 /data/app/com.example.wetinyouget_app-e_DWA-LGkZ1rYX5KIkh6xA==/lib/x86/libflutter.so (offset 0x147e000)
#10 pc 01758c7c /data/app/com.example.wetinyouget_app-e_DWA-LGkZ1rYX5KIkh6xA==/lib/x86/libflutter.so (offset 0x147e000)
#11 pc 0175948e /data/app/com.example.wetinyouget_app-e_DWA-LGkZ1rYX5KIkh6xA==/lib/x86/libflutter.so (offset 0x147e000)
#12 pc 017533cc /data/app/com.example.wetinyouget_app-e_DWA-LGkZ1rYX5KIkh6xA==/lib/x86/libflutter.so (offset 0x147e000)
#13 pc 015c74b5 /data/app/com.example.wetinyouget_app-e_DWA-LGkZ1rYX5KIkh6xA==/lib/x86/libflutter.so (offset 0x147e000)
#14 pc 015c747b /data/app/com.example.wetinyouget_app-e_DWA-LGkZ1rYX5KIkh6xA==/lib/x86/libflutter.so (offset 0x147e000)
#15 pc 015c7436 /data/app/com.example.wetinyouget_app-e_DWA-LGkZ1rYX5KIkh6xA==/lib/x86/libflutter.so (offset 0x147e000)
#16 pc 019e789d /data/app/com.example.wetinyouget_app-e_DWA-LGkZ1rYX5KIkh6xA==/lib/x86/libflutter.so (offset 0x147e000)
#17 pc 019e7bc9 /data/app/com.example.wetinyouget_app-e_DWA-LGkZ1rYX5KIkh6xA==/lib/x86/libflutter.so (offset 0x147e000)
#18 pc 014ace7c /data/app/com.example.wetinyouget_app-e_DWA-LGkZ1rYX5KIkh6xA==/lib/x86/libflutter.so (offset 0x147e000)
#19 pc 018c1909 /data/app/com.example.wetinyouget_app-e_DWA-LGkZ1rYX5KIkh6xA==/lib/x86/libflutter.so (offset 0x147e000)
#20 pc 018c1976 /data/app/com.example.wetinyouget_app-e_DWA-LGkZ1rYX5KIkh6xA==/lib/x86/libflutter.so (offset 0x147e000)
#21 pc 018c193e /data/app/com.example.wetinyouget_app-e_DWA-LGkZ1rYX5KIkh6xA==/lib/x86/libflutter.so (offset 0x147e000)
#22 pc 018de9b8 /data/app/com.example.wetinyouget_app-e_DWA-LGkZ1rYX5KIkh6xA==/lib/x86/libflutter.so (offset 0x147e000)
#23 pc 018dcfe7 /data/app/com.example.wetinyouget_app-e_DWA-LGkZ1rYX5KIkh6xA==/lib/x86/libflutter.so (offset 0x147e000)
#24 pc 018ddd57 /data/app/com.example.wetinyouget_app-e_DWA-LGkZ1rYX5KIkh6xA==/lib/x86/libflutter.so (offset 0x147e000)
#25 pc 018df15a /data/app/com.example.wetinyouget_app-e_DWA-LGkZ1rYX5KIkh6xA==/lib/x86/libflutter.so (offset 0x147e000)
#26 pc 014b1185 /data/app/com.example.wetinyouget_app-e_DWA-LGkZ1rYX5KIkh6xA==/lib/x86/libflutter.so (offset 0x147e000)
#27 pc 018dd4fd /data/app/com.example.wetinyouget_app-e_DWA-LGkZ1rYX5KIkh6xA==/lib/x86/libflutter.so (offset 0x147e000)
#28 pc 018dd1c7 /data/app/com.example.wetinyouget_app-e_DWA-LGkZ1rYX5KIkh6xA==/lib/x86/libflutter.so (offset 0x147e000)
#29 pc 018eeb7c /data/app/com.example.wetinyouget_app-e_DWA-LGkZ1rYX5KIkh6xA==/lib/x86/libflutter.so (offset 0x147e000)
#30 pc 014aab19 /data/app/com.example.wetinyouget_app-e_DWA-LGkZ1rYX5KIkh6xA==/lib/x86/libflutter.so (offset 0x147e000)
#31 pc 014aec6d /data/app/com.example.wetinyouget_app-e_DWA-LGkZ1rYX5KIkh6xA==/lib/x86/libflutter.so (offset 0x147e000)
#32 pc 014aeb7e /data/app/com.example.wetinyouget_app-e_DWA-LGkZ1rYX5KIkh6xA==/lib/x86/libflutter.so (offset 0x147e000)
#33 pc 014b618a /data/app/com.example.wetinyouget_app-e_DWA-LGkZ1rYX5KIkh6xA==/lib/x86/libflutter.so (offset 0x147e000)
#34 pc 014b61b8 /data/app/com.example.wetinyouget_app-e_DWA-LGkZ1rYX5KIkh6xA==/lib/x86/libflutter.so (offset 0x147e000)
#35 pc 00012a77 /system/lib/libutils.so (android::SimpleLooperCallback::handleEvent(int, int, void*)+39)
#36 pc 00013896 /system/lib/libutils.so (android::Looper::pollInner(int)+998)
#37 pc 0001340b /system/lib/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+43)
#38 pc 0000e220 /system/lib/libandroid.so (ALooper_pollOnce+96)
#39 pc 014b60cd /data/app/com.example.wetinyouget_app-e_DWA-LGkZ1rYX5KIkh6xA==/lib/x86/libflutter.so (offset 0x147e000)
#40 pc 014aeb2c /data/app/com.example.wetinyouget_app-e_DWA-LGkZ1rYX5KIkh6xA==/lib/x86/libflutter.so (offset 0x147e000)
#41 pc 014ae654 /data/app/com.example.wetinyouget_app-e_DWA-LGkZ1rYX5KIkh6xA==/lib/x86/libflutter.so (offset 0x147e000)
#42 pc 014b3e22 /data/app/com.example.wetinyouget_app-e_DWA-LGkZ1rYX5KIkh6xA==/lib/x86/libflutter.so (offset 0x147e000)
#43 pc 0008f065 /system/lib/libc.so (__pthread_start(void*)+53)
#44 pc 0002485b /system/lib/libc.so (__start_thread+75)
Lost connection to device.
Exited (sigterm)
| Emulator crashed on build of app after upgrading to Flutter 3.0 | CC BY-SA 4.0 | null | 2022-05-20T11:45:37.423 | 2022-05-20T12:37:41.233 | null | null | 14,512,909 | [
"flutter",
"dart",
"flutter-layout",
"mobile-development"
] |
72,339,604 | 1 | 72,339,660 | null | 0 | 298 | Below is my code that contains the error while I was following an youtube video (link provided) I got an error when I used packageManager.PERMISSION_GRANTED the code contains
error called "Unresolved reference: PERMISSION_GRANTED".PLease help to solve the error fast
```
package com.example.machineleaarningapp
import android.content.ActivityNotFoundException
import android.content.Intent
import android.graphics.Camera
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.provider.MediaStore
import android.widget.Button
import android.widget.ImageView
import android.widget.TextView
import androidx.activity.result.contract.ActivityResultContracts
import androidx.core.content.ContextCompat
import com.example.machineleaarningapp.databinding.ActivityMainBinding
import org.w3c.dom.Text
import java.security.Permission
class MainActivity : AppCompatActivity() {
private lateinit var binding:ActivityMainBinding
private lateinit var imageView: ImageView
private lateinit var button: Button
private lateinit var tvOutput:TextView
private val GALLERREQUESTCODE=123
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding= ActivityMainBinding.inflate(layoutInflater)
val view=binding.root
setContentView(R.layout.activity_main)
setContentView(view)
imageView=binding.imageView
tvOutput=binding.resulttv
button=binding.capture
val buttonLoad=binding.Loadimage
button.setOnClickListener{
if(ContextCompat.checkSelfPermission(this,android.Manifest.permission.CAMERA)==packageManager.PERMISSION_GRANTED){
takePicturePreview.lauch(null)
}
else{
requestPermission.launch(android.Manifest.permission.CAMERA)
}
}
}
}[I was following code on this youtube channel[\]\[1\]][1]
```
| My kotlin code to access the camera is giving this error ->unsolved reference:PERMISSION_GRANTED.Please help me to solve the error | CC BY-SA 4.0 | null | 2022-05-22T16:56:41.743 | 2022-05-22T17:04:42.010 | null | null | 14,146,697 | [
"java",
"android",
"kotlin",
"android-permissions",
"mobile-development"
] |
72,353,114 | 1 | null | null | 0 | 61 | I am getting the following error as show in the screenshot,please help me to solve the error related to the tensorflow lite.
[i was following this tutorial on youtube][1]
Iam not getting why the error is occurring as the code in the tutorial runs well.
thankyou
Below is the code where I am getting the following error.
```
package com.example.machineleaarningapp
import android.app.Activity
import android.content.ContentValues
import android.content.Intent
import android.content.pm.PackageManager
import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.graphics.drawable.BitmapDrawable
import android.net.Uri
import android.os.Bundle
import android.provider.MediaStore
import android.util.Log
import android.widget.Button
import android.widget.ImageView
import android.widget.TextView
import android.widget.Toast
import androidx.activity.result.ActivityResult
import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import com.example.machineleaarningapp.databinding.ActivityMainBinding
import com.example.machineleaarningapp.ml.Birdmodel2
import java.io.IOException
class MainActivity : AppCompatActivity() {
private lateinit var binding: ActivityMainBinding
private lateinit var imageView: ImageView
private lateinit var button: Button
private lateinit var tvOutput: TextView
private val GALLERY_REQUEST_CODE = 123
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityMainBinding.inflate(layoutInflater)
val view = binding.root
setContentView(view)
imageView = binding.imageView
button = binding.btnCaptureImage
tvOutput = binding.tvOutput
val buttonLoad = binding.btnLoadImage
button.setOnClickListener {
if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.CAMERA)
== PackageManager.PERMISSION_GRANTED
) {
takePicturePreview.launch(null)
}
else {
requestPermission.launch(android.Manifest.permission.CAMERA)
}
}
buttonLoad.setOnClickListener {
if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.READ_EXTERNAL_STORAGE)
== PackageManager.PERMISSION_GRANTED){
val intent = Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI)
intent.type = "image/*"
val mimeTypes = arrayOf("image/jpeg","image/png","image/jpg")
intent.putExtra(Intent.EXTRA_MIME_TYPES, mimeTypes)
intent.flags = Intent.FLAG_GRANT_READ_URI_PERMISSION
onresult.launch(intent)
}else {
requestPermission.launch(android.Manifest.permission.READ_EXTERNAL_STORAGE)
}
}
//to redirct user to google search for the scientific name
tvOutput.setOnClickListener {
val intent = Intent(Intent.ACTION_VIEW, Uri.parse("https://www.google.com/search?q=${tvOutput.text}"))
startActivity(intent)
}
// to download image when longPress on ImageView
imageView.setOnLongClickListener {
requestPermissionLauncher.launch(android.Manifest.permission.WRITE_EXTERNAL_STORAGE)
return@setOnLongClickListener true
}
}
//request camera permission
private val requestPermission = registerForActivityResult(ActivityResultContracts.RequestPermission()){granted->
if (granted){
takePicturePreview.launch(null)
}else {
Toast.makeText(this, "Permission Denied !! Try again", Toast.LENGTH_SHORT).show()
}
}
//launch camera and take picture
private val takePicturePreview = registerForActivityResult(ActivityResultContracts.TakePicturePreview()){bitmap->
if(bitmap != null){
imageView.setImageBitmap(bitmap)
outputGenerator(bitmap)
}
}
//to get image from gallery
private val onresult = registerForActivityResult(ActivityResultContracts.StartActivityForResult()){result->
Log.i("TAG", "This is the result: ${result.data} ${result.resultCode}")
onResultReceived(GALLERY_REQUEST_CODE,result)
}
private fun onResultReceived(requestCode: Int, result: ActivityResult?){
when(requestCode){
GALLERY_REQUEST_CODE ->{
if (result?.resultCode == Activity.RESULT_OK){
result.data?.data?.let{uri ->
Log.i("TAG", "onResultReceived: $uri")
val bitmap = BitmapFactory.decodeStream(contentResolver.openInputStream(uri))
imageView.setImageBitmap(bitmap)
outputGenerator(bitmap)
}
}else {
Log.e("TAG", "onActivityResult: error in selecting image")
}
}
}
}
private fun outputGenerator(bitmap: Bitmap){
//declearing tensor flow lite model variable
val birdsModel = Birdmodel2.newInstance(this)
// converting bitmap into tensor flow image
val newBitmap = bitmap.copy(Bitmap.Config.ARGB_8888, true)
val tfimage = TensorImage.fromBitmap(newBitmap)
//process the image using trained model and sort it in descending order
val outputs = birdsModel.process(tfimage)
.probabilityAsCategoryList.apply {
sortByDescending { it.score }
}
//getting result having high probability
val highProbabilityOutput = outputs[0]
//setting ouput text
tvOutput.text = highProbabilityOutput.label
Log.i("TAG", "outputGenerator: $highProbabilityOutput")
}
// to download image to device
private val requestPermissionLauncher = registerForActivityResult(ActivityResultContracts.RequestPermission()){
isGranted: Boolean ->
if (isGranted){
AlertDialog.Builder(this).setTitle("Download Image?")
.setMessage("Do you want to download this image to your device?")
.setPositiveButton("Yes"){_, _ ->
val drawable:BitmapDrawable = imageView.drawable as BitmapDrawable
val bitmap = drawable.bitmap
downloadImage(bitmap)
}
.setNegativeButton("No") {dialog, _ ->
dialog.dismiss()
}
.show()
}else {
Toast.makeText(this, "Please allow permission to download image", Toast.LENGTH_LONG).show()
}
}
//fun that takes a bitmap and store to user's device
private fun downloadImage(mBitmap: Bitmap):Uri? {
val contentValues = ContentValues().apply {
put(MediaStore.Images.Media.DISPLAY_NAME,"Birds_Images"+ System.currentTimeMillis()/1000)
put(MediaStore.Images.Media.MIME_TYPE,"image/png")
}
val uri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI
if (uri != null){
contentResolver.insert(uri, contentValues)?.also {
contentResolver.openOutputStream(it).use { outputStream ->
if (!mBitmap.compress(Bitmap.CompressFormat.PNG, 100, outputStream)){
throw IOException("Couldn't save the bitmap")
}
else{
Toast.makeText(applicationContext, "Image Saved", Toast.LENGTH_LONG).show()
}
}
return it
}
}
return null
}
}
```[These are the errors I am getting][2]
[1]: https://www.youtube.com/watch?v=hsSPb6V84zc&t=1034s
[2]: https://i.stack.imgur.com/GsmBW.png
```
| Getting the below errors related to the tensorflow lite while building kotlin app | CC BY-SA 4.0 | null | 2022-05-23T18:14:16.413 | 2022-05-23T18:14:16.413 | null | null | 14,146,697 | [
"android",
"tensorflow",
"kotlin",
"machine-learning",
"mobile-development"
] |
72,367,905 | 1 | null | null | 0 | 177 | When I tried to use the `AdvancedDrawer` in the code as below I am getting the error as show in the screenshot please help me to solve the error it tells that"Class referenced in the layout file, `com.infideap.drawerbehavior.AdvanceDrawerLayout`, was not found in the project or the libraries"
The code of the activity and gradle file are mentioned below please tell me how to solve the error.
```
<?xml version="1.0" encoding="utf-8"?>
<com.infideap.drawerbehavior.AdvanceDrawerLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
</com.infideap.drawerbehavior.AdvanceDrawerLayout>
```
`build.gradle`
```
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlin-android-extensions'
id 'kotlin-kapt'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.example.plantdisease"
minSdk 21
targetSdk 32
multiDexEnabled true
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
aaptOptions{
noCompress "tfLite"
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.6.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
implementation 'org.tensorflow:tensorflow-lite:1.14.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.github.razir.progressbutton:progressbutton:2.1.0'
implementation 'com.infideap.drawerbehavior:drawer-behavior:1.0.1'
implementation 'androidx.core:core-ktx:1.0.1'
implementation 'com.github.ibrahimsn98:SmoothBottomBar:1.7.5'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.navigation:navigation-fragment:2.2.2'
implementation 'androidx.navigation:navigation-ui:2.2.2'
implementation 'com.android.support:multidex:1.0.3'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
```
[enter image description here](https://i.stack.imgur.com/XpvB6.png)
Please help to solve the error.
| Getting error for AdvancedDrawerLayout in kotlin when used in code | CC BY-SA 4.0 | 0 | 2022-05-24T18:36:26.873 | 2022-05-24T18:51:49.793 | 2022-05-24T18:51:49.793 | 7,799,462 | 14,146,697 | [
"java",
"android",
"kotlin",
"drawerlayout",
"mobile-development"
] |
72,371,133 | 1 | null | null | 0 | 155 | I'm getting an `"Element intent-filter is not allowed here"` error. The instructions were to simply cut and paste the intent filter from `WeatherActivity` to `MainMenuActivity` since `WeatherActivity` was created first but it doesn't like it when I do it. What am I doing wrong?
```
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.introandroidapp">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.IntroAndroidApp">
<activity
android:name=".MyDrawing"
android:exported="false" />
<activity
android:name=".MainMenuActivity"
android:exported="false" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<activity
android:name=".WeatherActivity"
android:exported="true">
</activity>
</application>
</manifest>
```
| intent-filter is not allowed? | CC BY-SA 4.0 | null | 2022-05-25T01:38:30.090 | 2022-05-25T09:04:02.340 | 2022-05-25T09:04:02.340 | 16,279,195 | 19,193,982 | [
"android",
"android-studio",
"android-intent",
"intentfilter",
"mobile-development"
] |
72,388,235 | 1 | 72,389,918 | null | 3 | 844 | I have a microcontroller connected with HC-06 bluetooth module. I want to build a flutter app that can comunicate with the microcontroller to send an integer value via bluetooth and then receive integer values as well from the microcontroller. The code on the other end is written by C programming. on my side I started building the app with flutter. I am using flutter_bluetooth_serial package. For the bluetooth connection, I used some of the code from the example on the official package github. [https://github.com/edufolly/flutter_bluetooth_serial](https://github.com/edufolly/flutter_bluetooth_serial). (I copied the file named: BluetoothDeviceListEntry to my project).
Next, I created the main page of the application and the bluetooth connection coding.
This is my main.dart file:
```
void main(){
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: HomePage() ,
debugShowCheckedModeBanner: false,
);
}
}
class HomePage extends StatefulWidget{
@override
State<HomePage> createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
BluetoothState _bluetoothState = BluetoothState.UNKNOWN;
List<BluetoothDevice> devices = <BluetoothDevice>[];
@override
void initState() {
super.initState();
_getBTState();
_stateChangeListener();
_listBondedDevices();
_stateChangeListener();
}
@override
void dispose(){
WidgetsBinding.instance!.removeObserver(this);
super.dispose();
@override
void disChangeAppLifeCycleState(AppLifecycleState state){
if(state.index == 0){
//resume
if(_bluetoothState.isEnabled){
_listBondedDevices();
}
}
}
}
_getBTState(){
FlutterBluetoothSerial.instance.state.then((state){
_bluetoothState = state;
if(_bluetoothState.isEnabled){
_listBondedDevices();
}
setState(() {});
});
}
_stateChangeListener(){
FlutterBluetoothSerial.instance.onStateChanged().listen((BluetoothState state) {
_bluetoothState = state;
if(_bluetoothState.isEnabled){
_listBondedDevices();
}else{
devices.clear();
}
print("State isEnabled: ${state.isEnabled}");
setState(() {});
});
}
_listBondedDevices(){
FlutterBluetoothSerial.instance.getBondedDevices().then((List<BluetoothDevice> bondedDevices){
devices = bondedDevices;
setState(() {});
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text("Bluetooth Scanner"),),
body: Container(
child: Column(children: <Widget>[
SwitchListTile(
title: Text('Enable Bluetooth'),
value: _bluetoothState.isEnabled,
onChanged: (bool value){
future() async{
if(value){
await FlutterBluetoothSerial.instance.requestEnable();
}else{
await FlutterBluetoothSerial.instance.requestDisable();
}
future().then((_){
setState(() {});
});
}
},
),
ListTile(
title: Text("Bluetooth Status"),
subtitle: Text(_bluetoothState.toString()),
trailing: RaisedButton(child: Text("Settings"), onPressed: (){
FlutterBluetoothSerial.instance.openSettings();
},
),
),
// adaptor code
Expanded(
child: ListView(
children: devices
.map((_device)=> BluetoothDeviceListEntry(
device: _device,
enabled: true,
onTap: (){
print("item");
_startDataCollection(context, _device);
},
))
.toList(),
),
),
// discovery code
],
),
),
);
}
void _startDataCollection(BuildContext context, BluetoothDevice server){
Navigator.of(context).push(MaterialPageRoute(builder: (context){
return DetailPage(server: server);
}));
}
}
```
When I press on the paired device the function _startDataCollection is triggered and I go to the other file (detailpage.dart) and here is where I started suffering...
here is the coding in detail page:
```
class DetailPage extends StatefulWidget {
final BluetoothDevice server;
DetailPage({required this.server});
@override
State<DetailPage> createState() => _DetailPageState();
}
class _DetailPageState extends State<DetailPage> {
late BluetoothConnection connection;
bool isConnecting = true;
bool get isConnected => connection.isConnected;
bool isDisconnecting = false;
int _selectedvalue =0;
int chunks = 0;
int rcvdData = 0;
int contentLength =0;
late Uint8List _bytes;
@override
void initState() {
super.initState();
_getBTConnection();
}
@override
void dispose() {
if(isConnected){
isDisconnecting = true;
connection.dispose();
}
super.dispose();
}
_getBTConnection(){
BluetoothConnection.toAddress(widget.server.address).then((_connection){
connection = _connection;
isConnecting = false;
isDisconnecting = false;
setState(() {});
connection.input?.listen(_onDataReceived).onDone(() {
if(isDisconnecting){
print("Disconnecting locally");
}else{
print("Disconnecting remotely");
}
if(mounted){
setState(() {});
}
Navigator.of(context).pop();
});
}).catchError((error){
Navigator.of(context).pop();
});
}
_onDataReceived(int data){
if(data != null && data.bitLength > 0){
chunks.add(data);
}
}
Future<void> _sendMessageString() async {
connection.output.add(ascii.encode('Hello!'));
await connection.output.allSent;
print('ok send message');
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.grey,
appBar: AppBar(title: (isConnecting ? Text('Connecting to ${widget.server.name} ...')
: isConnected ? Text ('Connected with ${widget.server.name}') : Text(
'Disconnected with ${widget.server.name}')),),
body: SafeArea(child: isConnected
? Column(
children: <Widget>[
submitButton()
],
)
: const Center(
child: Text(
"Connecting ...",
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
color: Colors.white),
),
),
));
}
Widget submitButton(){
return Container(
padding: const EdgeInsets.all(16),
child: ElevatedButton(
onPressed: () {
print (chunks);
},
child: const Padding(
padding: EdgeInsets.all(8),
child: Text("show value", style: TextStyle(fontSize: 24),
),
),
),
);
}
}
```
What i am trying to do is that i want to print the received data in the compiler when i press the button (show value) but I am getting 2 errors.
The first one is on _getBTConnection function:
"connection.input?.listen().onDone(()"
> The argument type 'dynamic Function(int)' can't be assigned to the parameter type 'void Function(Uint8List)?'.
And the other one is on (_onDataReceived) function:
> The method 'add' isn't defined for the type 'int'.
I tried to make some functions to send integers as well but non of them seems to work as well. Please if anyone can help me with this as im new to flutter
thank you so much
| Flutter blluetooth serial communication | CC BY-SA 4.0 | null | 2022-05-26T07:24:29.290 | 2022-05-27T17:31:45.993 | null | null | 19,194,189 | [
"flutter",
"android-studio",
"dart",
"serial-communication",
"mobile-development"
] |
72,390,473 | 1 | null | null | 0 | 15 | I am trying to get just the key from the secureStore in react native, but I don't know how to do it exactly.
| How to get just the key of your input in securestore in react native? | CC BY-SA 4.0 | null | 2022-05-26T10:38:36.450 | 2022-05-26T10:38:36.450 | null | null | 18,337,391 | [
"reactjs",
"react-native",
"error-handling",
"syntax-error",
"mobile-development"
] |
72,443,337 | 1 | 72,443,404 | null | 0 | 198 | I am new to android development and Kotlin. I am trying to implement a feature that takes a screenshot when there is an issue in the application and uploads the screenshot to a server.
I am currently writing a function that uses DrawingCache and saves the view to a bitmap image. Other than this approach, is there a better way to do this? I was wondering whether there is a way to use the Android OS level screenshot capturing mechanism for this?
| Android Screenshot Capturing | CC BY-SA 4.0 | null | 2022-05-31T06:51:32.247 | 2022-05-31T06:58:28.840 | null | null | 11,383,407 | [
"android",
"kotlin",
"mobile-development"
] |
72,473,522 | 1 | 72,486,100 | null | 1 | 274 | I went through few suggestions by the developers here. [What is the simplest way to get screenshot in android using kotlin?](https://stackoverflow.com/questions/57591950/what-is-the-simplest-way-to-get-screenshot-in-android-using-kotlin)
Some says, this canvas and drawingCache based approach is old and it seems there are some issues with it like capturing Dark/Black screenshots.
Some have suggested a method based on the PixelCopy API. What is the most suitable approach for this? For device using Android 10 or higher versions?
| What is the best way to capture screenshots programmatically in Android Kotlin? | CC BY-SA 4.0 | null | 2022-06-02T09:01:42.720 | 2022-06-03T23:52:10.617 | 2022-06-03T23:52:10.617 | 5,413,981 | 11,383,407 | [
"android",
"android-studio",
"kotlin",
"mobile-development"
] |
72,474,666 | 1 | null | null | 0 | 161 | I have an onboarding system where the user can pick a language, when scrolling through the options, the text items on-screen display in the selected language. The problem is when the user goes to Hindi, the text size changes and alters the position/layout. This doesn't happen with any of the EU languages. The effect is quite jarring. Is there any simple way to fix this?
[Here is a video demo of the issue, it might not be too easy to notice the difference in the images below](https://youtube.com/shorts/8TA28m-dG9s?feature=share)
[](https://i.stack.imgur.com/WXGtk.png)
[](https://i.stack.imgur.com/0J6rO.png)
[](https://i.stack.imgur.com/czmDC.png)
```
import 'package:flutter/material.dart';
import 'package:overpowered/pre_onboarding/onboarding_screen_1.dart';
import 'package:overpowered/pre_onboarding/onboarding_screen_2.dart';
import 'package:overpowered/pre_onboarding/onboarding_screen_3.dart';
import 'package:smooth_page_indicator/smooth_page_indicator.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
class OnBoardingScreen extends StatefulWidget {
const OnBoardingScreen({Key? key}) : super(key: key);
@override
State<OnBoardingScreen> createState() => _OnBoardingScreenState();
}
class _OnBoardingScreenState extends State<OnBoardingScreen> {
final PageController _controller = PageController();
bool onFirst = true;
bool onLast = false;
@override
Widget build(BuildContext context) {
var translations = AppLocalizations.of(context);
return Scaffold(
body: Stack(
children: [
PageView(
controller: _controller,
onPageChanged: (index) {
setState(
() {
onFirst = (index == 0);
onLast = (index == 2);
},
);
},
children: const [
OnboardingScreen1(),
OnboardingScreen2(),
OnboardingScreen3(),
],
),
if (onFirst)
Container(
alignment: Alignment(-0.8, 0.9),
child: GestureDetector(
onTap: () {},
child: AnimatedOpacity(
opacity: 0.0,
duration: const Duration(milliseconds: 150),
child: Text(
translations!.back,
style: const TextStyle(
color: Color(0xFFD0FD3E),
),
),
),
),
)
else
Container(
alignment: Alignment(-0.8, 0.9),
child: GestureDetector(
onTap: () {
_controller.previousPage(
duration: const Duration(milliseconds: 300),
curve: Curves.easeIn,
);
},
child: AnimatedOpacity(
opacity: 1.0,
duration: const Duration(milliseconds: 150),
child: Text(
translations!.back,
style: const TextStyle(
color: Color(0xFFD0FD3E),
),
),
),
),
),
Container(
alignment: Alignment(0, 0.885),
child: SmoothPageIndicator(
controller: _controller,
count: 3,
effect: const ExpandingDotsEffect(
dotColor: Color(0xFFD0FD3E),
activeDotColor: Color(0xFFD0FD3E),
radius: 0.0,
dotWidth: 16.0,
dotHeight: 4.0,
spacing: 10.0,
expansionFactor: 2.25,
),
),
),
if (onLast)
Container(
alignment: Alignment(0.8, 0.9),
child: GestureDetector(
onTap: () {},
child: AnimatedOpacity(
opacity: 0.0,
duration: const Duration(milliseconds: 150),
child: Text(
translations.next,
style: const TextStyle(
color: Color(0xFFD0FD3E),
),
),
),
),
)
else
Container(
alignment: Alignment(0.8, 0.9),
child: GestureDetector(
onTap: () {
_controller.nextPage(
duration: const Duration(milliseconds: 300),
curve: Curves.easeIn,
);
},
child: AnimatedOpacity(
opacity: 1.0,
duration: const Duration(milliseconds: 150),
child: Text(
translations.next,
style: const TextStyle(
color: Color(0xFFD0FD3E),
),
),
),
),
),
],
),
);
}
}
```
| Stop text changing size when swapping language in Flutter | CC BY-SA 4.0 | null | 2022-06-02T10:25:51.067 | 2022-06-02T10:29:59.500 | 2022-06-02T10:29:59.500 | 19,089,459 | 19,089,459 | [
"flutter",
"dart",
"user-interface",
"flutter-layout",
"mobile-development"
] |
72,483,178 | 1 | 72,484,052 | null | 0 | 48 | Tried to make a sign up screen with a column and a form, but the page is displaying errors due to it overflowing. Checked on how to solve this and all sources say I should enclose the Container in a 'SingleChildScrollView' widget, but this doesn't seem to fix the problem for me.
Here's my code:
```
class RegisterPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
// code for the register layout
return Scaffold(
body: SingleChildScrollView(
child: Container(
padding: EdgeInsets.fromLTRB(47, 106, 47, 0),
height: MediaQuery.of(context).size.height,
child: Column(
children: [
Row(
children: [
Text(
'Create account',
style: TextStyle(color: Color(0xFFFD007C),
fontFamily: 'MontBlanc',
fontSize: 28,
),
),
],
),
SizedBox(height: 19),
Row(
children: [
Text(
'Or sign in with',
style: TextStyle(
fontFamily: 'TisaSansPro',
color: Color(0xFFACACAC),
),
),
SizedBox(width: 10),
ClipRect(
child: Container(
height: 20,
width: 20,
child: Image.asset('assets/icons8-google-48.png'),
),
),
SizedBox(width: 10),
Icon(
Icons.facebook,
color: Color(0xFF4267B2),
),
SizedBox(width: 10),
Icon(
Icons.apple,
color: Color(0xFF555555),
),
],
),
SizedBox(height: 39),
Form(
child: Column(
children: [
TextFormField(
decoration: InputDecoration(
labelText: 'Email address',
floatingLabelBehavior: FloatingLabelBehavior.always,
hintText: 'abcdef@gmail.com',
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: BorderSide(color: Color(0xFFECC2D6)),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: BorderSide(color: Color(0xFFFD007C)),
),
),
),
SizedBox(height: 36),
TextFormField(
obscureText: true,
decoration: InputDecoration(
labelText: 'Password',
floatingLabelBehavior: FloatingLabelBehavior.always,
hintText: 'Input your password',
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: BorderSide(color: Color(0xFFECC2D6)),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: BorderSide(color: Color(0xFFFD007C)),
),
),
),
SizedBox(height: 82),
Container(
height: 45,
width: MediaQuery.of(context).size.width,
child: ElevatedButton(
onPressed: () => Navigator.pushNamed(context, route.loginPage),
style: ElevatedButton.styleFrom(primary: Color(0xFFFD007C), elevation: 4.0),
child: Text(
'Register',
style: TextStyle(
color: Colors.white,
fontFamily: 'TisaSansPro',
),
),
),
),
],
),
),
],
),
),
),
);
}
}
```
I have looked at the code for any issues but cant see any, I also tried using the widget to wrap around the columns. I made a shorter form on another page that didn't overflow and that worked, but this doesn't.
| My SingleChildScrollView does not work on Container what is wrong? | CC BY-SA 4.0 | null | 2022-06-02T23:12:16.597 | 2022-06-03T02:17:03.613 | null | null | 18,355,313 | [
"android",
"ios",
"flutter",
"dart",
"mobile-development"
] |
72,488,573 | 1 | null | null | 0 | 44 | I don't know exactly how to explain it, but I'll try.
I want to make an application in react native similar to the applications that store passwords for different applications / sites and then enter them automatically when you visit that site.
The problem is that I have no idea how I can strictly solve this part of autocompletion.
e.g: The user has saved in my application the password for spotify.com. How my app automatically enter the password in his browser based on password that he saved in my app for spotify.com?
| How to autocomplete fields in other apps using data from react native app | CC BY-SA 4.0 | null | 2022-06-03T10:56:04.820 | 2022-06-03T10:56:04.820 | null | null | 13,461,590 | [
"react-native",
"mobile-development"
] |
72,516,684 | 1 | null | null | 0 | 19 | When I start to move the joystick when the player touch the ground the current frame is being rendered on top of the last frames(atleast it seems like it).
This only happens when I am building to mobile and trying the game on my device but works just fine on the editor.
I would really appreciate some help in fixing this.
[https://imgur.com/a/JJdq0OG](https://imgur.com/a/JJdq0OG)
| The rendering on the mobile build is broken(frame is being rendered on top of the last frames) | CC BY-SA 4.0 | null | 2022-06-06T11:00:53.640 | 2022-06-06T11:00:53.640 | null | null | 19,276,784 | [
"unity3d",
"game-development",
"mobile-development"
] |
72,558,357 | 1 | null | null | 0 | 850 | I Am trying to pass text widget data from one screen to another screen but I don't know how to do that in flutter.
I know how to do that from textfield and pass between screen. for example using a controller.
```
child: Text('Repetition', style: TextStyle(fontSize: 18, fontWeight: FontWeight.normal),)),
onPressed: ()=>{
Navigator.push(context, MaterialPageRoute(
builder:(context) => FingerGoalSt()))
},
```
I want to pass the Repetition String into next screen.
In other platform it's easy but in flutter i have no idea as i am new to it.
Thanks.
| How to pass text widget data from one screen to another screen in Flutter? | CC BY-SA 4.0 | null | 2022-06-09T10:00:57.713 | 2022-06-09T13:16:04.573 | null | null | 18,761,883 | [
"flutter",
"dart",
"mobile-development"
] |
72,580,622 | 1 | null | null | 1 | 162 | ```
import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_gauges/gauges.dart';
class CreditScoreGauge extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.all(20),
child: SfRadialGauge(
axes: <RadialAxis>[
RadialAxis(
showLabels: false,
showTicks: false,
minimum: 300,
maximum: 850,
startAngle: 180,
endAngle: 0,
axisLineStyle: const AxisLineStyle(
thickness: 0.12,
cornerStyle: CornerStyle.bothCurve,
thicknessUnit: GaugeSizeUnit.factor,
color: Colors.blueAccent,
gradient: SweepGradient(colors: <Color>[
Color(0xffa2c9e1),
Color(0xff62769D),
Color(0xff354F81),
Color(0Xff1B3568),
Color(0xff122345),
], stops: <double>[
0,
0.35,
0.7,
0.8,
1.0
]),
),
pointers: const <GaugePointer>[
MarkerPointer(
value: 600,
markerHeight: 25,
markerWidth: 25,
markerType: MarkerType.circle,
enableDragging: true,
color: Color.fromARGB(0, 3, 168, 244),
borderWidth: 7,
elevation: 10,
borderColor: Color.fromARGB(255, 255, 255, 255)),
],
),
],
),
);
}
}
```
This is my my widget using 'syncfusion_flutter_gauges: ^20.1.59' dependency that
displays the following gauge:
![](https://i.stack.imgur.com/PyZiy.png)
And my desired goal is the following:
![](https://i.stack.imgur.com/9ixGj.png)
I want to add the semi circle depicted in the picture but I am having trouble with it. Can anybody help?
| Flutter: How do I create a semicircle on top of this widget | CC BY-SA 4.0 | 0 | 2022-06-10T23:23:35.800 | 2022-06-10T23:52:24.693 | null | null | 9,453,919 | [
"flutter",
"flutter-layout",
"mobile-development"
] |
72,611,107 | 1 | 72,611,155 | null | -1 | 406 | I am using timer.periodic to call some functions at different times. The problem which I am facing is that the timer is much slower than real life like for example what you will see in my code that the timer should finish in 5 seconds but in real life its taking 25 seconds to finish.
```
void startTheTimer(){
var counter = 5;
final zeroDurationTimer = Timer.run(() {
_StartDataCollection();
});
Timer.periodic(const Duration(seconds: 5), (timer) {
print(timer.tick);
counter--;
if (counter == 2) {
_StopDataCollection();
}else if (counter == 1){
createUser();
}
if (counter == 0) {
print('Cancel timer');
timer.cancel();
print(numbers.length);
print(fifo.length);
}
});
}
```
the print on the compiler shows the timer ticks as 1-2-3-4-5 but its taking it too long to print 2 and then same goes for the rest of the ticks.
Anyone knows what is going on?
| Flutter timer.periodic is slower than real life | CC BY-SA 4.0 | null | 2022-06-14T03:06:18.627 | 2022-06-14T03:22:29.400 | null | null | 18,205,996 | [
"flutter",
"android-studio",
"dart",
"mobile-development",
"flutter-timer"
] |
72,615,171 | 1 | null | null | 0 | 94 | Getting this error when fetching items from API
""
```
class Services {
static Future<List<Products>> getProducts() async {
try {
final response =
await http.get(Uri.parse('http://67.205.140.117/api/products'));
if (response.statusCode == 200) {
List<Products> list = parseProducts(response.body);
return list;
} else {
throw Exception("Error");
}
} catch (e) {
throw Exception(e.toString());
}
}
static List<Products> parseProducts(String responseBody) {
List parsed = (json.decode(responseBody)).cast<Map<String, dynamic>>();
return parsed.map<Products>((json) => Products.fromJson(json)).toList();
}
}
```
json response
```
[[{"id":1,"productname":"iPhone","description":"iPhone Xs Max","price":120000,"units":2,"images":"2022061331Untitled design (2).png","category":"1","created_at":"2022-06-07T13:31:25.000000Z","updated_at":"2022-06-07T13:31:25.000000Z"}],"Products Fetched"]
```
| Getting this error when fetching items in flutter "Error Exception: type 'List<dynamic>' is not a subtype of type 'Map<String, dynamic>' in type cast" | CC BY-SA 4.0 | null | 2022-06-14T10:11:51.330 | 2022-06-14T11:32:29.840 | 2022-06-14T11:32:29.840 | 12,778,222 | 12,778,222 | [
"flutter",
"mobile",
"mobile-development"
] |
72,617,571 | 1 | 72,617,771 | null | 0 | 125 | I am trying to implement my own "expandable panel" in Flutter, basically there are questions and their answers, all having different length naturally. What i want to do is to display the question in a container first, and when user clicks the container i want to expand the second container's height, which has the answer text, from 0 to
```
double _theHeight = 0;
Column(
children: [
Container(
child:Inkwell(
onTap: () {setState({_theHeight = ????})},
child: Text(theQuestion)
)
),
Container(
height = _theHeight,
child: Text(theAnswer),
),
]
)
```
In such example, i tried to give _theHeight variable a constant value like 200 but as different answers have different lengths, this causes an overflow or too much unnecessary place.
Is there a default value for height such that the parent widget will only cover the space it's child requires? So can i type something like:
```
_theHeight = Container.default.height;
```
Thank you for your time.
| Is there a parameter for default height for widgets in Flutter? | CC BY-SA 4.0 | null | 2022-06-14T13:10:09.540 | 2022-06-14T17:31:37.180 | 2022-06-14T13:11:23.187 | 19,337,533 | 19,337,533 | [
"flutter",
"mobile-development"
] |
72,646,340 | 1 | null | null | 0 | 107 | I have a react-native project that's working fine on my local.
In order to distribute it to testers, we're using Appcenter.
The problem is that the iOS build is fine, but the Android build is not installing if I enable signing.
If I generate signed apk on my local, it works file. And if I disable signing on Appcenter, the apk is working fine.
But for distribution, I need to sign the apk, so I've uploaded a keystore file that I generated from my Android Studio and entered the keystore alias and passwords into Appcenter configuration.
After that, the apk is not being installed on Android devices and emulators.
I'm getting this error:
`Failed to commit install session 1050984903 with command cmd package install-commit 1050984903. Error: INSTALL_FAILED_INVALID_APK: Failed to extract native libraries, res=-2`
What I've tried so far:
- `signingConfig signingConfigs.debug``build.gradle`-
But none of these worked and I'm getting the same error.
If any of you have had this kind of issue, how did you fix this?
| Appcenter signed apk not installed | CC BY-SA 4.0 | null | 2022-06-16T13:04:14.590 | 2022-06-16T13:04:14.590 | null | null | 10,944,573 | [
"android",
"react-native",
"android-keystore",
"mobile-development",
"appcenter"
] |
72,656,557 | 1 | 72,656,864 | null | 1 | 1,563 | I am trying to get the UI of an OTP screen using flutter, but I am having errors on the FocusScope.of(context) lines. I thought the 'BuildContext context' defined for the class 'OtpPage' should have made this not an issue.
Here is the code;
```
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import '/routes/route.dart' as route;
class OtpPage extends StatelessWidget {
const OtpPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: PreferredSize(
preferredSize: Size.fromHeight(15.0),
child: AppBar(
elevation: 0,
flexibleSpace: Container(
decoration: BoxDecoration(
image: DecorationImage(image: AssetImage('assets/pattern.png'), fit: BoxFit.fill),
),
),
),
),
body: Container(
child: SingleChildScrollView(
padding: const EdgeInsets.fromLTRB(47, 26, 47, 75),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
'assets/logo4.png',
height: 50,
),
],
),
SizedBox(height: 26),
Row(
children: [
Text(
'Enter OTP',
style: GoogleFonts.inter(
textStyle: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 24,
),
),
),
],
),
SizedBox(height: 28),
Form(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
_textFieldOTP(first: true, last: false),
_textFieldOTP(first: false, last: false),
_textFieldOTP(first: false, last: false),
_textFieldOTP(first: false, last: false),
_textFieldOTP(first: false, last: true),
],
),
SizedBox(height: 34),
Container(
height: 45,
width: MediaQuery.of(context).size.width,
child: ElevatedButton(
onPressed: () => Navigator.pushNamed(context, route.resetPassword),
style: ElevatedButton.styleFrom(primary: Color(0xFFFF2957), elevation: 0.0, shape: new RoundedRectangleBorder(borderRadius: new BorderRadius.circular(8.0))),
child: Text(
'Verify',
style: GoogleFonts.inter(
textStyle: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 15,
),
),
),
),
),
],
),
),
],
),
),
),
);
}
Widget _textFieldOTP({required bool first, last}) {
return Container(
height: 60,
width: 52,
child: AspectRatio(
aspectRatio: 1.0,
child: TextField(
autofocus: true,
onChanged: (value) {
if(value.length == 1 && last == false){
FocusScope.of(context).nextFocus();
}
if(value.length == 1 && first == false){
FocusScope.of(context).previousFocus();
}
},
showCursor: false,
readOnly: false,
textAlign: TextAlign.center,
keyboardType: TextInputType.number,
maxLength: 1,
decoration: InputDecoration(
counter: Offstage(),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(width: 2, color: Colors.black),
borderRadius: BorderRadius.circular(6),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(width: 2, color: Colors.purple),
borderRadius: BorderRadius.circular(6),
),
),
),
),
);
}
}
```
I keep getting this error at the console;
lib/views/otp.dart:103:29: Error: The getter 'context' isn't defined for the class 'OtpPage'.
-
Same error too for the line FocusScope.of(context).previousFocus();
| Error: The getter 'context' isn't defined for the class 'OtpPage' | CC BY-SA 4.0 | null | 2022-06-17T08:39:34.977 | 2022-06-17T09:03:01.863 | 2022-06-17T08:41:22.060 | 18,355,313 | 18,355,313 | [
"flutter",
"dart",
"user-interface",
"mobile-development"
] |
72,663,519 | 1 | null | null | 0 | 172 | Soo i have been trying running an app on my phone but when i cloned a repo it gave me this error
```
@NonNull syncExpressions: List<Map<String, Any>>,
@NonNull dataStoreConfigurationBuilder: DataStoreConfiguration.Builder
) {
syncExpressions.forEach {
try {
val id = it["id"] as String
val modelName = it["modelName"] as String
val queryPredicate =
QueryPredicateBuilder.fromSerializedMap(it["queryPredicate"].safeCastToMap())!!
dataStoreConfigurationBuilder.syncExpression(modelName) {
var resolvedQueryPredicate = queryPredicate
val latch = CountDownLatch(1)
uiThreadHandler.post {
channel.invokeMethod("resolveQueryPredicate", id, object : Result {
override fun success(result: Any?) {
try {
resolvedQueryPredicate =
QueryPredicateBuilder.fromSerializedMap(result.safeCastToMap())!!
} catch (e: Exception) {
LOG.error("Failed to resolve query predicate. Reverting to original query predicate.")
}
latch.countDown()
}
override fun error(code: String?, msg: String?, details: Any?) {
LOG.error("Failed to resolve query predicate. Reverting to original query predicate.")
latch.countDown()
}
override fun notImplemented() {
LOG.error("resolveQueryPredicate not implemented.")
latch.countDown()
}
})
}
latch.await()
resolvedQueryPredicate
}
} catch (e: Exception) {
throw e
}
}
}
```
Object is not abstract and does not implement abstract member public abstract fun success(p0: Any?): Unit defined in io.flutter.plugin.common.MethodChannel.Result
| Object is not abstract and does not implement abstract member public abstract fun success(p0: Any?): Unit | CC BY-SA 4.0 | null | 2022-06-17T18:37:33.697 | 2022-06-17T18:37:33.697 | null | null | 14,021,579 | [
"flutter",
"mobile-development"
] |
72,697,651 | 1 | null | null | 1 | 121 | I am working on a food delivery rider application with mvc_pattern. I want to get order details, rider current location and customer delivery address (i-e: Source to destination). I am getting these values by api calls. When I call setState after getting the values, the widget tree is not being rebuilt.
When I debug the code, it says 'setState() callback argument returned a Future.'
```
await getOrderDetailsApi(orderid).then((value) {
orderDetails = value!;
ScaffoldMessenger.of(state!.context).showSnackBar(SnackBar(
content: Text(
S.of(state!.context).notificationWasRemoved,
),
));
}).catchError((e) {
ScaffoldMessenger.of(state!.context).showSnackBar(SnackBar(
content: Text("This Account Not Exists"),
));
}).whenComplete((){
final directions = await GooglemapRepo().getDirection(
origin: LatLng(position.latitude, position.longitude),
destination: LatLng(lat, lng),
);
print(directions);
setState(() {
info12 = directions;
});
});
```
| setState() callback argument returned a Future. even I didn't mark setState as async | CC BY-SA 4.0 | null | 2022-06-21T08:36:54.803 | 2022-06-21T08:36:54.803 | null | null | 10,873,841 | [
"flutter",
"dart",
"widget",
"setstate",
"mobile-development"
] |
72,699,381 | 1 | null | null | 2 | 1,358 | i'm working on app in expo to take and save image to device. I tried camera roll but it seems it's not supported in expo
so is there any way to save image to device using expo
| How to save image to device using expo | CC BY-SA 4.0 | null | 2022-06-21T10:43:05.717 | 2022-06-22T17:45:33.760 | null | null | 19,381,902 | [
"react-native",
"expo",
"mobile-development",
"imagepicker"
] |
72,738,170 | 1 | null | null | 1 | 295 | [Click here to see error log](https://i.stack.imgur.com/6yEYK.png)
error: Type of the parameter must be a class annotated with @Entity or a collection/array of it.
kotlin.coroutines.Continuation<? super java.lang.Long> continuation);
** Please see the below code for my ArticleDao and ArticleDatabase Class**
```
@Entity(
tableName = "articles"
)
@Parcelize
data class Article(
@PrimaryKey(autoGenerate = true)
var id: Int? = null,
val author: String?,
val content: String?,
val description: String?,
val publishedAt: String?,
val source: Source?,
val title: String?,
val url: String?,
val urlToImage: String?
) : Parcelable
```
```
class Converters {
@TypeConverter
fun fromSource(source : Source) : String{
return source.name
}
@TypeConverter
fun toSource(name : String) : Source {
return Source(name, name)
}
}
```
```
@Dao
interface ArticleDao {
@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun upsertArticle(article : Article) : Long
@Query("SELECT * FROM articles")
fun getAllArticles() : LiveData<List<Article>>
@Delete
suspend fun deleteArticle(article: Article)
}
```
```
@Database(
entities = [Article::class],
version = 1
)
@TypeConverters(Converters::class)
abstract class ArticleDatabase : RoomDatabase(){
abstract fun getArticleDao() : ArticleDao
companion object{
@Volatile
private var instance: ArticleDatabase? = null
private val LOCK = Any()
operator fun invoke(context: Context) = instance ?: synchronized(LOCK) {
instance ?: createDatase(context).also { instance = it }
}
private fun createDatase(context: Context) =
Room.databaseBuilder(
context.applicationContext,
ArticleDatabase::class.java,
"article_db.db"
).build()
}
}
```
```
def roomVersion = "2.4.2"
implementation("androidx.room:room-runtime:$roomVersion")
annotationProcessor("androidx.room:room-compiler:$roomVersion")
// To use Kotlin annotation processing tool (kapt)
kapt("androidx.room:room-compiler:$roomVersion")
implementation("androidx.room:room-ktx:$roomVersion")
// optional - Kotlin Extensions and Coroutines support for Room
implementation("androidx.room:room-ktx:$roomVersion")
```
| Error with Room dao class with Kotlin Coroutine | CC BY-SA 4.0 | null | 2022-06-24T01:36:43.017 | 2022-06-24T01:45:35.053 | 2022-06-24T01:45:35.053 | 9,212,106 | 9,212,106 | [
"android",
"kotlin",
"android-room",
"kotlin-coroutines",
"mobile-development"
] |
72,810,403 | 1 | null | null | 0 | 89 | I would like to know the pros and cons of following app architecture.
The app will have 5 features: login, feature1, feature2, feature3, and feature4. Refer to the attached UI.
To modularise the features in this application, each feature will be developed as a separate cocoa pod project. The main app will pod these features as libraries. The main app will do the necessary linking, navigation, etc. Refer to the attached architecture.
[](https://i.stack.imgur.com/p3q5s.jpg)
[](https://i.stack.imgur.com/kLyTv.jpg)
| iOS app project modularisation with cocoa pod | CC BY-SA 4.0 | null | 2022-06-30T04:45:29.293 | 2022-06-30T04:45:29.293 | null | null | 3,713,439 | [
"ios",
"design-patterns",
"architecture",
"mobile-development"
] |
72,813,399 | 1 | null | null | 0 | 88 | SO everytime I run or Hot restart my application, I get bunch or errors on the compiler as following:
> W/DynamiteModule( 6436): Local module descriptor class for com.google.android.gms.providerinstaller.dynamite not found.
> D/ConnectivityManager( 6436): requestNetwork; CallingUid : 10208, CallingPid : 6436
I/DynamiteModule( 6436): Considering local module com.google.android.gms.providerinstaller.dynamite:0 and remote module
com.google.android.gms.providerinstaller.dynamite:0
> W/ProviderInstaller( 6436): Failed to load providerinstaller module: No acceptable module com.google.android.gms.providerinstaller.dynamite found. Local version is 0 and remote version is 0.
> D/ConnectivityManager( 6436): unregisterNetworkCallback; CallingUid : 10208, CallingPid : 6436
> E/ConnectivityManager.CallbackHandler( 6436): callback not found for RELEASED message
> D/ConnectivityManager( 6436): requestNetwork; CallingUid : 10208, CallingPid : 6436
> D/ConnectivityManager( 6436): unregisterNetworkCallback; CallingUid : 10208, CallingPid : 6436
> E/ConnectivityManager.CallbackHandler( 6436): callback not found for AVAILABLE message
> E/ConnectivityManager.CallbackHandler( 6436): callback not found for RELEASED message
> D/ViewRootImpl@fd51152MainActivity: Relayout returned: oldFrame=[0,0][1080,1920] newFrame=[0,0][1080,1920] result=0x1 surface={isValid=true 518276111360} surfaceGenerationChanged=false
Although I have never faced any issue in the app what so ever but I am still concerning that these errors might cause a problem when releasing the app.
anyone have anyidea of what is causing these errors.
Thanks in advance for your help.
| bunch of errors when run an application or hot restart | CC BY-SA 4.0 | null | 2022-06-30T09:28:42.873 | 2022-06-30T09:28:42.873 | null | null | 18,205,996 | [
"flutter",
"android-studio",
"dart",
"cross-platform",
"mobile-development"
] |
72,817,864 | 1 | 72,817,931 | null | 0 | 41 | This is the error I am getting :
java.lang.RuntimeException: Canvas: trying to draw too large(115781908bytes) bitmap.
Is there any way by which I can fix this without reducing the image quality?
| I am adding an ImageView in android app in android studio. The image size is 1.93MB. When I am running the AVD, app is getting closed due to an error | CC BY-SA 4.0 | null | 2022-06-30T14:50:25.437 | 2022-06-30T20:47:18.807 | null | null | 15,176,148 | [
"android",
"android-studio",
"kotlin",
"mobile-development"
] |
72,845,300 | 1 | null | null | 4 | 314 | I recently published an app on the play store, and the console shows me, that this error happens frequently, only on Android 12 / 12L.I could not reproduce it
---
```
backtrace:
#00 pc 000000000004f75c /apex/com.android.runtime/lib64/bionic/libc.so (abort+168)
#00 pc 00000000006d157c /apex/com.android.art/lib64/libart.so (art::Runtime::Abort(char const*)+668)
#00 pc 000000000001695c /apex/com.android.art/lib64/libbase.so (android::base::SetAborter(std::__1::function<void (char const*)>&&)::$_3::__invoke(char const*)+76)
#00 pc 0000000000015f8c /apex/com.android.art/lib64/libbase.so (android::base::LogMessage::~LogMessage()+364)
#00 pc 00000000004af168 /apex/com.android.art/lib64/libart.so (art::Thread::ProtectStack(bool)+404)
#00 pc 00000000003de648 /apex/com.android.art/lib64/libart.so (art::Thread::InitStackHwm()+1556)
#00 pc 00000000003dcd0c /apex/com.android.art/lib64/libart.so (art::Thread::Init(art::ThreadList*, art::JavaVMExt*, art::JNIEnvExt*)+108)
#00 pc 0000000000457574 /apex/com.android.art/lib64/libart.so (art::Thread::CreateCallback(void*)+104)
#00 pc 00000000000b1590 /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+204)
#00 pc 0000000000050fac /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64)
```
Thank you for your help!
| Android 12(L) Crashing: signal 6 (SIGABRT), code -1 (SI_QUEUE) | CC BY-SA 4.0 | null | 2022-07-03T09:17:04.170 | 2022-07-03T09:17:04.170 | null | null | 19,471,597 | [
"java",
"android",
"error-handling",
"signals",
"mobile-development"
] |
72,872,867 | 1 | null | null | 2 | 946 | No logro buildear mi aplicacion y ya he probado de todo, cambie `com.facebook.react:react-native:+` en android/app/build-gradle por `com.facebook.react:react-native:0.68.2` y nada, probe agregando, borrando, y editando el jcenter() de buil-gradle y tampoco.
Ya no se que mas probar.
| Could not resolve com.facebook.react:react-native:+ | CC BY-SA 4.0 | null | 2022-07-05T16:38:57.420 | 2022-10-31T13:47:35.940 | null | null | 19,444,858 | [
"android",
"react-native",
"mobile-development"
] |
72,879,297 | 1 | null | null | 0 | 65 | I have a flutter app with different log in options (Email and password, phone number, ...etc).
The first thing I made was the signup and sign in with email and password with email verification for first time signup.
This was the main class I had at that time:
```
class mainPage extends StatelessWidget {
@override
Widget build(BuildContext context) => Scaffold(
body: StreamBuilder<User?>(
stream: FirebaseAuth.instance.authStateChanges(),
builder: (context, snapshot){
if (snapshot.hasData){
return VerifyEmailPage();
}else {
return AuthPage();
}
},
),
);
}
```
So here I check if the user signed in then he goes to VerifyEmailPage and from there if he verified his email then he goes to HomeScreen
```
@override
Widget build(BuildContext context) => isEmailVerified
? const HomeScreen()
:
WillPopScope(
onWillPop: _onBackPressed,
child: Scaffold( .....
```
So my question is how can I change my mainPage class code so that if the user signed in with phone number he can directly be sent to HomeScreen?
| Implement different log in options in flutter app | CC BY-SA 4.0 | 0 | 2022-07-06T07:14:48.433 | 2022-07-06T14:21:16.507 | 2022-07-06T14:21:16.507 | 209,103 | 18,205,996 | [
"flutter",
"dart",
"firebase-authentication",
"mobile-development"
] |
72,911,558 | 1 | 72,911,622 | null | 0 | 210 | hey I have created an app in flutter it has a download page just like youtube
what I want to do is when the app loads it should check the internet connection and if it is not there it should redirect the user to the download screen
```
This is the error
../../../../../.pub-cache/hosted/pub.dartlang.org/flutter_translate-3.1.0/lib/src/utils/device_locale.dart:11:49: Error: Property 'window' cannot be accessed on 'WidgetsBinding?' because it is potentially null.
- 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../../../../FlutterDev/flutter/packages/flutter/lib/src/widgets/binding.dart').
Try accessing using ?. instead.
final deviceLocales = WidgetsBinding.instance.window.locales;
^^^^^^
../../../../../.pub-cache/hosted/pub.dartlang.org/percent_indicator-4.2.1/lib/linear_percent_indicator.dart:162:5: Warning: The class 'WidgetsBinding' cannot be null.
Try replacing '?.' with '.'
WidgetsBinding?.instance.addPostFrameCallback((_) {
^^^^^^^^^^^^^^
../../../../../.pub-cache/hosted/pub.dartlang.org/percent_indicator-4.2.1/lib/linear_percent_indicator.dart:162:30: Error: Method 'addPostFrameCallback' cannot be called on 'WidgetsBinding?' because it is potentially null.
- 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../../../../FlutterDev/flutter/packages/flutter/lib/src/widgets/binding.dart').
Try calling using ?. instead.
WidgetsBinding?.instance.addPostFrameCallback((_) {
^^^^^^^^^^^^^^^^^^^^
FAILURE: Build failed with an exception.
* Where:
Script '/Users/samarthverulkar/FlutterDev/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1102
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command '/Users/samarthverulkar/FlutterDev/flutter/bin/flutter'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 2m 1s
Exception: Gradle task assembleDebug failed with exit code 1
```
| How to add offline screen in flutter? | CC BY-SA 4.0 | null | 2022-07-08T12:38:44.910 | 2022-07-08T18:42:56.297 | 2022-07-08T18:42:56.297 | 17,169,037 | 19,068,786 | [
"android",
"flutter",
"dart",
"flutter-dependencies",
"mobile-development"
] |
72,997,699 | 1 | null | null | 1 | 75 | I have a app that is for budgeting. I'm trying to create a Bloc that can withdraw money from a Budget Object. However I'm running into issues trying to figure out how to define the bloc in a way that it can withdraw the money and pass an update budget object back.
```
import 'package:bloc/bloc.dart';
import 'package:budget_app/model/budget.dart';
import 'package:budget_app/model/budget_repository.dart';
import 'package:equatable/equatable.dart';
part 'budget_event.dart';
part 'budget_state.dart';
class BudgetBloc extends Bloc<BudgetEvent, BudgetState> {
final BudgetRepository budgetRepository;
BudgetBloc({required this.budgetRepository}) : super(BudgetInitial()) {
on<AppStarted>((event, emit) async {
emit(BudgetLoading());
if (await budgetRepository.hasBudget()) {
var budget = await budgetRepository.getBudget();
emit(BudgetLoaded(budget: budget));
} else {
emit(BudgetNew());
}
});
}
}
```
```
part of 'budget_bloc.dart';
abstract class BudgetEvent extends Equatable {
const BudgetEvent();
@override
List<Object> get props => [];
}
class AppStarted extends BudgetEvent {}
class Withdraw extends BudgetEvent {}
```
```
part of 'budget_bloc.dart';
abstract class BudgetState extends Equatable {
const BudgetState();
@override
List<Object> get props => [];
}
class BudgetInitial extends BudgetState {}
class BudgetLoading extends BudgetState {}
class BudgetNew extends BudgetState {}
class BudgetLoaded extends BudgetState {
final Budget budget;
BudgetLoaded({required this.budget});
}
```
Budget is a simple class essentially just has a value and a name. It has functions for withdrawing and depositing money.
I thought about passing the budget back into the Withdraw method like such
```
Withdraw(Double amount, Budget budget)
```
then maybe Withdraw just emits a BudgetLoaded Object with the updated budget?
| Flutter withdraw money from a budget Object using bloc | CC BY-SA 4.0 | null | 2022-07-15T17:26:17.430 | 2022-07-15T17:26:17.430 | null | null | 18,653,070 | [
"flutter",
"dart",
"bloc",
"mobile-development"
] |
73,009,785 | 1 | 73,009,930 | null | 0 | 103 | So I recently started learning React Native by following a Udemy course. Until now, everything has worked just fine, but a couple of days ago I got this error message when running the simple "npm start" command. I've tried a few solutions like reinstalling the node_modules folder, updating everything to the latest version, but that did not help. Has anybody got the solution for this?
```
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module 'xdl'
Require stack:
- C:\Users\Korisnik\AppData\Roaming\npm\node_modules\expo-cli\build\exp.js
- C:\Users\Korisnik\AppData\Roaming\npm\node_modules\expo-cli\bin\expo.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at _xdl (C:\Users\Kori
snik\AppData\Roaming\npm\node_modules\expo-cli\build\exp.js:152:16)
at Object.<anonymous> (C:\Users\Korisnik\AppData\Roaming\npm\node_modules\expo-cli\build\exp.js:282:1)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\Korisnik\\AppData\\Roaming\\npm\\node_modules\\expo-cli\\build\\exp.js',
'C:\\Users\\Korisnik\\AppData\\Roaming\\npm\\node_modules\\expo-cli\\bin\\expo.js'
]
}
```
Thanks in advance!
| Error: Cannot find module 'xdl' when running "npm start" in React Native | CC BY-SA 4.0 | null | 2022-07-17T07:00:56.513 | 2022-07-17T07:43:36.323 | 2022-07-17T07:43:36.323 | 15,288,641 | 19,564,881 | [
"javascript",
"react-native",
"npm",
"mobile-development"
] |
73,012,512 | 1 | 73,013,048 | null | 0 | 64 | This question isn't specifically for flutter, but it's what I'm learning at the moment, so I'm tagging it as such.
I'm writing a flutter app where the user can "favourite" a note, which changes the state of that note's icon. I'm using firebase as backend.
The way I've implemented it is to update the state of the icon whenever the note object gets updated, but that of course takes time between the button press and the update.
This got me thinking about how do apps eliminate time between user action and feedback, when there's usually supposed to be time needed for the request to be sent to the backend, an update coming back to the app, etc?
When a user upvotes a post on reddit, they can see the upvote button change state immediately, and the post's upvote counter updates accordingly, without any delay.
Do apps cache these user actions and have some way of mixing using cached information and actual backend(live) data, so that the user gets this nice immediate feedback?
| How do you speed up frontend response to user actions that require backend actions? | CC BY-SA 4.0 | null | 2022-07-17T14:11:19.840 | 2022-07-17T15:29:39.020 | 2022-07-17T14:14:06.893 | 1,750,755 | 1,750,755 | [
"flutter",
"firebase",
"backend",
"mobile-development"
] |
73,017,844 | 1 | 73,022,952 | null | -1 | 378 | I want to convert html to pdf using jspdf but i want to generate the pdf without showing the html content to users. The technology im using is ionic.
Please help on this issue
| HTML to PDF using jspdf in ionic | CC BY-SA 4.0 | null | 2022-07-18T05:56:04.180 | 2022-07-18T13:17:52.657 | null | null | 7,002,162 | [
"angular",
"ionic-framework",
"mobile-development"
] |
73,049,570 | 1 | null | null | 0 | 52 | There is a list of tags whose number is dynamic. Those tags will be filling up to 3 lines of an area when those tags exceed more than 3 lines. The "See more" button should be visible and when the user clicks on it, it should open the whole list then the "See less" button will appear at the end of the whole list of tags, and on clicking on "see less" it should go back to the previous state. How to achieve this behavior in Flutter.
I tried with wrap but I am not able to achieve see more/see less functionality. I am attaching below a rough diagram of what want.
```
class FlightSeeMoreSeeLessWidgetState extends State<FlightSeeMoreSeeLessWidget>
with TickerProviderStateMixin {
bool isExpanded = false;
@override
Widget build(BuildContext context) {
return Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
AnimatedSize(
duration: const Duration(milliseconds: 300),
child: ConstrainedBox(
constraints: isExpanded
? const BoxConstraints()
: const BoxConstraints(maxHeight: 30),
child: Wrap(
key: const Key('Airline'),
alignment: WrapAlignment.start,
spacing: kSize16,
runSpacing: kSize8,
children: widget.widgetList,
))),
isExpanded
? InkWell(
child: const Padding(
padding: EdgeInsets.all(16),
child: Text(
'See less',
style: TextStyle(color: Colors.blue),
),
),
onTap: () => setState(() => isExpanded = false),
)
: InkWell(
child: const Padding(
padding: EdgeInsets.all(16),
child: Text('See more', style: TextStyle(color: Colors.red)),
),
onTap: () => setState(() => isExpanded = true))
]);
}
}
```
In the above widgetList is the list of tags. I achieved most of it, need to clear some code and use bloc instead of setState. But now my issue is. When see more button is activated i.e not expanded state. It is overlapping the list of tags. I tried different clip behavior in wrap still not getting desired result.
This code works fine, but my issue was with the List-->Widget was an InkWell with Ink decoration, but it wasn't wrapped in Material. Wrapping is with Material solves the issue
[](https://i.stack.imgur.com/A792P.png)
[](https://i.stack.imgur.com/suEs4.png)
| How to add "see more"/ "see less" functionality button at the end incase number of tags exceeds 3 lines | CC BY-SA 4.0 | null | 2022-07-20T09:58:48.057 | 2022-07-25T15:58:17.307 | 2022-07-25T15:58:17.307 | 9,275,386 | 9,275,386 | [
"android",
"ios",
"flutter",
"dart",
"mobile-development"
] |
73,068,341 | 1 | 73,068,876 | null | 2 | 138 | I am styling a card and have these multiple icon elements and text in it. I am having issues arranging the rows and columns to solve this problem here;
[Image 1](https://i.stack.imgur.com/nQnhd.png)
And this is what I am trying to achieve;
[Image 2](https://i.stack.imgur.com/UvvFl.png)
Here is my code for that row giving me issues;
```
Row(
children: [
ClipRect(
child: Container(
height: 11,
width: 11,
child: Image.asset('assets/info.png'),
),
),
Container(
height: 48,
child: Column(
children: [
Text(
"Now that you've finished a plan, it's essential to measure your growth. We've included assessments and activities to do just that.",
style: GoogleFonts.poppins(
textStyle: TextStyle(
color: Color(0x80484848),
fontWeight: FontWeight.w400,
fontSize: 8,
),
),
),
],
),
),
],
),
```
I thought that text always align properly if fit into a column. I want the overflowing text to go over to the next line.
| Aligning Rows and Columns in Flutter with Overflowing Long Text | CC BY-SA 4.0 | null | 2022-07-21T14:51:34.430 | 2022-07-21T16:03:55.520 | 2022-07-21T16:03:03.113 | 18,355,313 | 18,355,313 | [
"android",
"ios",
"flutter",
"mobile",
"mobile-development"
] |
73,088,651 | 1 | null | null | 18 | 4,462 | My app is not building because of this error and I am not able to understand the error. I tried 'flutter upgrade' and 'flutter get' but nothing was helpful.
```
Launching lib/main.dart on SM A127F in debug mode...
Running Gradle task 'assembleDebug'...
../../flutter/.pub-cache/hosted/pub.dartlang.org/fwfh_text_style-2.7.3+2/lib/fwfh_text_style.dart:11:7: Error: The non-abstract class 'FwfhTextStyle' is missing implementations for these members:
- TextStyle.fontVariations
Try to either
- provide an implementation,
- inherit an implementation from a superclass or mixin,
- mark the class as abstract, or
- provide a 'noSuchMethod' implementation.
class FwfhTextStyle extends _TextStyleProxy {
^^^^^^^^^^^^^
../../flutter/packages/flutter/lib/src/painting/text_style.dart:789:33: Context: 'TextStyle.fontVariations' is defined here.
final List<ui.FontVariation>? fontVariations;
^^^^^^^^^^^^^^
FAILURE: Build failed with an exception.
* Where:
Script '/home/vrs/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1159
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command '/home/vrs/flutter/bin/flutter'' finished with non-zero exit value 1
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 16s
Exception: Gradle task assembleDebug failed with exit code 1
```
| How to resolve 'FwfhTextStyle' error in Flutter? | CC BY-SA 4.0 | null | 2022-07-23T06:54:11.307 | 2022-11-27T13:23:37.500 | null | null | 16,432,742 | [
"flutter",
"android-studio",
"dart",
"gradle",
"mobile-development"
] |
73,118,891 | 1 | null | null | 1 | 46 | Is there any common convention, API/Library or Algorithm for password strength calculation in mobile/web applications for displaying the words: "Weak", "Medium" etc... or everyone is implementing this differently?
| Password Strength Calculation In Mobile/Web Applications | CC BY-SA 4.0 | null | 2022-07-26T06:52:22.100 | 2022-07-26T06:52:22.100 | null | null | 17,623,757 | [
"android",
"passwords",
"mobile-development"
] |
73,374,972 | 1 | null | null | -1 | 346 | So I'm currently making an app right now based out of react native and I'm trying to use the 'react-native-scrollable-tab-view' ([https://www.npmjs.com/package/react-native-scrollable-tab-view](https://www.npmjs.com/package/react-native-scrollable-tab-view)) RN library. It had been working previously but when I upgraded my react from 16 to 18, the ViewPropTypes (that the library was using) has been deprecated. Now, I could just downgrade my react but I was wondering if there's any other way that could somehow help me with this?
Thanks!
| Updated 'react-native-scrollable-tab-view' react native library | CC BY-SA 4.0 | null | 2022-08-16T13:41:03.057 | 2022-08-16T13:53:24.223 | null | null | 17,655,670 | [
"reactjs",
"react-native",
"mobile-development"
] |
73,390,470 | 1 | null | null | 0 | 188 | So I'm working on a Xamarin app and all was going great until yesterday.
However, since yesterday I can't log in to the web server on my app and get this error when I do:
"java.security.cert.CertPathValidatorException: Trust anchor for certification path not found"
On the iOS side of things there is no problem, log in works just fine. No code was changed on Android for this to happen, it just started happening yesterday with no changes made.
The app has it's own class replacing AndroidClientHandler and isn't using the default AndroidClientHandler.
Any help appreciated. Thanks.
| Xamarin.Android - Trust anchor for certification path not found | CC BY-SA 4.0 | null | 2022-08-17T14:44:06.960 | 2022-08-17T15:08:53.360 | 2022-08-17T15:08:53.360 | 17,262,499 | 17,262,499 | [
"c#",
"xamarin",
"xamarin.android",
"ssl-certificate",
"mobile-development"
] |
73,399,621 | 1 | null | null | 0 | 360 | I have a screen (EditActivity) with a product creating/editing form. This screen has a layout in which there is a drop-down list product category. The list of items in this drop-down is set via ArrayAdapter.createFromResource. I don't have a problem when I use this screen as a creating form. The problem appears when I use this screen as a editing form. I'm trying to set the product category initial value to the field via `setText()`. It works, and value appears in the dropdown. But other values from the ArrayAdapter disappear and I can't choose them. I also tried to set value using `setSelection()`, but I'm not sure this is correct way.
How do I insert the initial value into the dropdown so that I can see and select another values from the list?
```
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/productCategory"
android:hint="@string/ed_product_category"
...
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu">
<AutoCompleteTextView
android:id="@+id/productCategoryAutoComplete"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="none"/>
</com.google.android.material.textfield.TextInputLayout>
```
```
productCategoriesAutoCompleteView = findViewById(R.id.productCategoryAutoComplete);
ArrayAdapter<CharSequence> arrayAdapter = ArrayAdapter.createFromResource(
this,
R.array.product_categories,
R.layout.list_item
);
productCategoriesAutoCompleteView.setAdapter(arrayAdapter);
```
```
int itemPosition = arrayAdapter.getPosition("Car");
productCategoriesAutoCompleteView.setText(arrayAdapter.getItem(itemPosition));
```
```
int itemPosition = arrayAdapter.getPosition("Car");
productCategoriesAutoCompleteView.setSelection(itemPosition);
```
[](https://i.stack.imgur.com/KCANPl.png)
[](https://i.stack.imgur.com/G3Mqel.png)
[](https://i.stack.imgur.com/vGBFel.png)
| Set initial value to AutoCompleteTextView | CC BY-SA 4.0 | null | 2022-08-18T08:16:38.390 | 2022-11-23T08:57:42.840 | 2022-08-19T06:24:40.727 | 16,477,764 | 16,477,764 | [
"android",
"android-xml",
"mobile-development"
] |
73,417,406 | 1 | null | null | -1 | 230 | Myself and a team are starting a potential startup and one of the things we want to do is a mobile app. We have already identified the target audience to mainly be iPhone users. But here in the US there's still plenty of Android user so we've been considering using a cross platform framework like Flutter. I've seen a lot of praise that Flutter is easy to use and can help us deliver an MVP faster. My ideal situation is to start developing with Flutter and when the app is successful migrate it to a native iOS app using Swift. But is that possible at all? Or if we decide to go native when we already have a flutter app, do we need to start from scratch?
| Can I migrate a Flutter app to a native iOS app? | CC BY-SA 4.0 | null | 2022-08-19T13:17:24.380 | 2022-08-19T13:43:42.367 | null | null | 9,439,875 | [
"ios",
"swift",
"flutter",
"mobile",
"mobile-development"
] |
73,447,157 | 1 | null | null | 0 | 88 | I'm developing an android app that won't be downloaded via the Google Play store but instead through an APK listed on my website. I was looking for a way to update this app.
I've done some research and I think the best way would be to run an API at the start of the app that checks the downloaded app's version against the version of the APK listed on the website (at the time of app launch). If the version of the website APK is higher, then I prompt the user for an update. Ideally the API would get the APK itself without the user needing to go to the website.
I have some doubts about this that I hope someone can answer however:
First - Once I download the new APK does the old one get deleted or do I have to do that?
Second - How do I keep User Preferences?
If this isn't the right way to do it I'd appreciate any tips.
If it is the right way and you know of some good resources to build an API like this I'd appreciate those too!
| How to update android app without google play | CC BY-SA 4.0 | null | 2022-08-22T14:57:21.913 | 2022-08-22T14:57:21.913 | null | null | 16,591,356 | [
"java",
"android",
"mobile-development"
] |
73,464,386 | 1 | 73,465,076 | null | 2 | 134 | I am trying to convert a binary mask predicted with the pytorch_mobile package to an image I can show in my app.
The Prediction I receive is a 1-Dimensional list containing the predictions that my model spits out, these are negative for pixels assigned to the background and positive for pixels assigned to the area of interest. After this, I create a list that assigns the value 0 to all previously negative values, and 255 to all previously positive values yielding a 1-Dimensional list containing the values 0 or 255 depending on what the pixel was classified as.
The image prediction is a size of 512x512 pixels, and the length of the list is subsequently 262,144.
How would I be able to convert this list into an image that I could save to storage or show via the flutter UI?
Here is my current code:
```
customModel = await PyTorchMobile
.loadModel('assets/segmentation_model.pt');
result_list = [];
File image = File(filePath);
List prediction = await customModel.getImagePredictionList(image, 512, 512);
prediction.forEach((element) {
if (element >0){
result_list.add(255);
}else if(element <= 0){
result_list.add(0);
}
});
result_list_Uint8 = Uint8List.fromList(result_list);
```
| Converting grayscale 1D list of Image Pixels to Grayscale Image Dart | CC BY-SA 4.0 | null | 2022-08-23T19:48:13.810 | 2022-08-23T21:12:01.277 | 2022-08-23T21:12:01.277 | 2,828,341 | 19,042,422 | [
"flutter",
"image",
"dart",
"mobile-development"
] |
73,472,030 | 1 | null | null | 0 | 107 | So the project I'm currently working on requires a mobile app to connect with wearables ( etc..) to monitor the users data( like heart rate , oxygen levels etc..) and store it actively, it also needs to connect with other monitoring devices ().
I've tried to google about 'connecting/exchanging data with the wearable devices' but did not end up with anything helpful.
So basically I have no clue how the wearables devices integrate with the native apps, and how easy it is work with either of the cross-platform frameworks().
I have some experience with Web development (React, Node-JS, databases, HTML, CSS, Java Script) but I'm fairly new to mobile dev( so are other interns in my team) and need some advice on which framework to choose from.
Any advice or help would be really appreciated :)
| How does wearable devices integrate with mobile apps? Building an cross platform APP | CC BY-SA 4.0 | null | 2022-08-24T11:06:48.470 | 2022-08-24T11:06:48.470 | null | null | 18,759,883 | [
"flutter",
"react-native",
"mobile-development",
"wearables"
] |
73,475,692 | 1 | null | null | 0 | 10 | I want to add functionality to check phone details in an app available on the play store, however I'm having problems related to permissions and I don't know how to solve it, here's the code:
```
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(
this,
arrayOf(Manifest.permission.READ_PHONE_STATE),
111
)
} else {
getTelephonyDetail()
}
}
override fun onRequestPermissionsResult(
requestCode: Int,
permissions: Array<out String>,
grantResults: IntArray
) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
if((requestCode==111) && (grantResults[0]==PackageManager.PERMISSION_GRANTED)){
getTelephonyDetail()
}
}
private fun getTelephonyDetail() {
val tm: TelephonyManager = getSystemService(TELEPHONY_SERVICE) as TelephonyManager
if (ActivityCompat.checkSelfPermission(
this,
android.Manifest.permission.READ_PHONE_STATE
) != PackageManager.PERMISSION_GRANTED
) {
return
}
```
| Mobile Development - Permissions | CC BY-SA 4.0 | null | 2022-08-24T15:14:55.720 | 2022-08-24T15:14:55.720 | null | null | 19,719,090 | [
"mobile",
"mobile-application",
"mobile-development"
] |
73,480,894 | 1 | 73,496,237 | null | -1 | 115 | I'm making an android app that won't go on google play and I want to be able to update it. The way I would do this is by having a server hold a JSON with the newest APK version and link to the APK and on App Launch I want to check the App's version against the APK held by the JSON. If the version on the JSON is the most recent I want to prompt the user for an update. My app is a webview, not sure if that makes a difference
I'm quite new to App Development and Java so I'm not sure how to make this however. The HTTP Request for the JSON is the part I've mostly understood and I've found some good posts about the App Update code on App launch but I can't make sense of it.
I'd appreciate any tips, thank you
| How to make an app updater for android app? | CC BY-SA 4.0 | null | 2022-08-25T01:12:57.037 | 2022-08-26T04:56:49.410 | null | null | 16,591,356 | [
"java",
"android",
"webview",
"mobile-development"
] |
73,486,646 | 1 | null | null | 0 | 147 | on launching the application it goes from splash screen to main screen at their everything is all right but when i try to login or skip my login , gap appears at top of the screen. Any one facing this issue? [](https://i.stack.imgur.com/jaVCE.jpg)
| React native ios half screen on navigation | CC BY-SA 4.0 | null | 2022-08-25T11:26:09.707 | 2022-08-25T11:28:29.013 | null | null | 17,189,337 | [
"android",
"ios",
"iphone",
"react-native",
"mobile-development"
] |
73,506,356 | 1 | null | null | 1 | 614 | I'm facing a situation where some packages import the same native library:
```
> 2 files found with path 'lib/arm64-v8a/libc++_shared.so' from inputs:
- ~/.gradle/caches/transforms-3/7d9d92dc8ec1ba2e45aff2ecbb549550/transformed/jetified-react-native-0.68.2/jni/arm64-v8a/libc++_shared.so
- ~/.gradle/caches/transforms-3/e21c7f468f769020a3f8f2f5f3ed5664/transformed/jetified-libvlc-all-3.3.10/jni/arm64-v8a/libc++_shared.so
```
The standard solution is to use pickFirst:
```
packagingOptions {
pickFirst 'lib/x86/libc++_shared.so'
pickFirst 'lib/arm64-v8a/libc++_shared.so'
pickFirst 'lib/x86_64/libc++_shared.so'
pickFirst 'lib/armeabi-v7a/libc++_shared.so'
}
```
The thing is that, in my example as seen above, "first" here is the react-native file. I want to pick the libvlc file.
As far as I know, I can't exclude files based on the source package name.
How can I tell gradle to "pickLast" or "pickSomethingElseThanFirst"?
Thank you
| Gradle packagingOption, pick other than first | CC BY-SA 4.0 | null | 2022-08-26T20:50:58.070 | 2022-08-26T20:50:58.070 | null | null | 3,001,271 | [
"android",
"gradle",
"mobile-development"
] |
73,538,843 | 1 | null | null | 1 | 130 | i am uploading CSV file in flutter using FilePicker but when i open my Gallery using file picker csv file not selectable and hence i am unable to upload CSV file with csv extension. How can i resolve this issue?
```
result = await FilePicker.platform.pickFiles(
type: FileType.custom,
allowedExtensions: ['csv']
);
if(result == null) return;
///Open Single File
file = result!.files.first;
setState((){});
```
| CSV File not selecting and uploading in flutter | CC BY-SA 4.0 | null | 2022-08-30T07:45:45.250 | 2022-08-30T07:45:45.250 | null | null | 19,877,022 | [
"flutter",
"csv",
"file",
"dart",
"mobile-development"
] |
73,550,296 | 1 | null | null | 0 | 35 | I’m trying to develop a Drum Game but I’m having a problem. When the game first starts, an animation is played, each drum is played, it includes certain actions (changing each drum drawable and playing sound), these actions are already on a function but I just can’t initialize an animation where I call this action. All animations requires parameters that I don’t need. So I wonder if I can create an animation with no parameters and in startAnimation() I call my functions ? Thank you in advance
| Android Animation with certain actions | CC BY-SA 4.0 | null | 2022-08-31T02:29:49.450 | 2022-08-31T02:29:49.450 | null | null | 19,883,731 | [
"android",
"kotlin",
"mobile-development"
] |
73,585,068 | 1 | null | null | 0 | 84 | I am creating a navigation app using Mapbox's SDKs and APIs. I am trying to put my customized Map with user location app inside a class (PagePlanRoute.kt) inside my project but it is only showing properly when the code is inside the MainActivity class. Whenever I put my codes on my class (PagePlanRoute.kt), the Map is not working properly. It only shows a default Map without the user location. I am stuck with this. Please help. Used language here is Kotlin.
Manifest File:
```
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.prototype">
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Prototype"
tools:targetApi="31">
<activity
android:name=".PageRouteReviews"
android:exported="false"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>
<activity
android:name=".PageRideDetails"
android:exported="false"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
<activity
android:name=".PageOnRide"
android:exported="false"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
<activity
android:name=".PageExplore"
android:exported="false"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
<activity
android:name=".PagePlanRoute"
android:exported="false"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
<activity
android:name=".PageOverview"
android:exported="false"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
<activity
android:name=".LoginActivity"
android:exported="true"
android:theme="@style/Theme.AppCompat.Light.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".RegisterActivity"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
<activity
android:name=".MainActivity"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
<meta-data
android:name="preloaded_fonts"
android:resource="@array/preloaded_fonts" />
</application>
</manifest>
```
page_plan_route.xml:
<androidx.constraintlayout.widget.ConstraintLayout
```
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#C8C8C8"
tools:context=".PagePlanRoute">
<com.mapbox.maps.MapView
android:id="@+id/mapView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:mapbox_cameraTargetLat="15.588809484318716"
app:mapbox_cameraTargetLng="120.97635174743579"
app:mapbox_cameraZoom="12.5"
tools:layout_editor_absoluteX="118dp"
tools:layout_editor_absoluteY="345dp" />
<RelativeLayout
android:id="@+id/relativeLayout"
android:layout_width="match_parent"
android:layout_height="60dp"
android:orientation="horizontal"
android:background="#7209B7"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/backPlanRoute"
android:layout_width="48dp"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginStart="15dp"
android:layout_marginTop="16dp"
app:srcCompat="@drawable/ic_arrow_back" />
<TextView
android:id="@+id/textView7"
android:layout_width="198dp"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="20dp"
android:layout_marginRight="12dp"
android:layout_toEndOf="@+id/backPlanRoute"
android:text="Plan my route"
android:textAlignment="viewStart"
android:textColor="@android:color/white"
android:textSize="20sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent" />
</RelativeLayout>
<androidx.cardview.widget.CardView
android:id="@+id/cardView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:layout_marginRight="20dp"
android:background="#E41B1B"
android:orientation="vertical"
app:cardBackgroundColor="#FFFFFF"
app:cardCornerRadius="12dp"
app:cardElevation="2dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/relativeLayout">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="65dp"
android:background="@color/white"
app:layout_constraintTop_toTopOf="@+id/mapView">
<AutoCompleteTextView
android:id="@+id/inputRoute"
android:layout_width="280dp"
android:layout_height="48dp"
android:layout_centerVertical="true"
android:layout_marginStart="10dp"
android:layout_marginTop="7dp"
android:layout_marginEnd="13dp"
android:layout_toStartOf="@+id/directionIcon"
android:background="@drawable/border_edit_text"
android:drawableStart="@android:drawable/ic_menu_search"
android:ems="10"
android:hint="Find route"
android:inputType="textPersonName"
android:paddingStart="8dp"
android:paddingEnd="8dp" />
<ImageView
android:id="@+id/directionIcon"
android:layout_width="50dp"
android:layout_height="40dp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginTop="7dp"
android:layout_marginEnd="6dp"
android:background="#00BA5757"
android:tag="gray"
app:srcCompat="@drawable/directions_ic" />
</RelativeLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="@+id/inputLocationCard"
android:layout_width="350dp"
android:layout_height="140dp"
android:layout_marginTop="20dp"
android:background="#00803333"
app:cardCornerRadius="12dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/cardView"
tools:layout_editor_absoluteX="56dp">
<RelativeLayout
android:layout_width="50dp"
android:layout_height="match_parent"
android:background="#00FFFFFF">
<ImageView
android:id="@+id/imageView01"
android:layout_width="35dp"
android:layout_height="48dp"
android:layout_alignParentEnd="true"
android:layout_marginTop="15dp"
android:layout_marginEnd="7dp"
app:srcCompat="@drawable/ic_outline_circle" />
<ImageView
android:id="@+id/imageView02"
android:layout_width="35dp"
android:layout_height="48dp"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginTop="55dp"
android:layout_marginEnd="7dp"
android:layout_marginBottom="17dp"
app:srcCompat="@drawable/ic_baseline_my_location_24" />
<ImageView
android:id="@+id/imageView6"
android:layout_width="20dp"
android:layout_height="5dp"
android:layout_above="@+id/imageView02"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_marginStart="16dp"
android:layout_marginEnd="14dp"
android:layout_marginBottom="-55dp"
app:srcCompat="@drawable/ic_dot" />
<ImageView
android:id="@+id/imageView7"
android:layout_width="20dp"
android:layout_height="5dp"
android:layout_above="@+id/imageView6"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_marginStart="16dp"
android:layout_marginEnd="14dp"
android:layout_marginBottom="2dp"
app:srcCompat="@drawable/ic_dot" />
<ImageView
android:id="@+id/imageView8"
android:layout_width="20dp"
android:layout_height="5dp"
android:layout_above="@+id/imageView7"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_marginStart="16dp"
android:layout_marginEnd="14dp"
android:layout_marginBottom="2dp"
app:srcCompat="@drawable/ic_dot" />
</RelativeLayout>
<RelativeLayout
android:layout_width="298dp"
android:layout_height="match_parent"
android:layout_marginStart="50dp"
android:background="#00FFFFFF">
<EditText
android:id="@+id/yourLocation"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_alignParentEnd="true"
android:layout_marginTop="15dp"
android:layout_marginEnd="22dp"
android:background="@drawable/border_edit_text"
android:ems="10"
android:hint="Your Location"
android:inputType="textPersonName"
android:paddingStart="5dp" />
<EditText
android:id="@+id/targetLocation"
android:layout_width="280dp"
android:layout_height="48dp"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginEnd="23dp"
android:layout_marginBottom="17dp"
android:background="@drawable/border_edit_text"
android:ems="10"
android:hint="Destination"
android:inputType="textPersonName"
android:paddingStart="5dp" />
</RelativeLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="@+id/inputPreferenceCard"
android:layout_width="275dp"
android:layout_height="100dp"
android:layout_marginBottom="40dp"
app:cardCornerRadius="12dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textView11"
android:layout_width="68dp"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="16dp"
android:layout_marginTop="10dp"
android:text="Gradient:"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/findRouteBtn"
android:layout_width="130dp"
android:layout_height="48dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="14dp"
android:layout_marginBottom="10dp"
android:backgroundTint="#7209B7"
android:text="Find Route"
android:textColor="#FFFFFF"
android:textSize="10dp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView11" />
<SeekBar
android:id="@+id/seekBar"
android:layout_width="140dp"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="2dp"
android:valueFrom="0"
android:valueTo="100"
app:layout_constraintBottom_toBottomOf="@+id/textView11"
app:layout_constraintStart_toEndOf="@+id/textView11"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.909"
app:trackColor="#575757" />
<TextView
android:id="@+id/gradientLevel"
android:layout_width="30dp"
android:layout_height="20dp"
android:layout_alignParentBottom="true"
android:layout_marginStart="3dp"
android:layout_toEndOf="@+id/seekBar"
android:text="0"
app:layout_constraintBottom_toBottomOf="@+id/seekBar"
app:layout_constraintStart_toEndOf="@+id/seekBar"
app:layout_constraintTop_toTopOf="@+id/seekBar" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
```
PagePlanRoute.kt
class PagePlanRoute : AppCompatActivity() {
```
//mapbox map--------------------------------------------------------
private lateinit var locationPermissionHelper: LocationPermissionHelper
private val onIndicatorBearingChangedListener = OnIndicatorBearingChangedListener {
mapView.getMapboxMap().setCamera(CameraOptions.Builder().bearing(it).build())
}
private val onIndicatorPositionChangedListener = OnIndicatorPositionChangedListener {
mapView.getMapboxMap().setCamera(CameraOptions.Builder().center(it).build())
mapView.gestures.focalPoint = mapView.getMapboxMap().pixelForCoordinate(it)
}
private val onMoveListener = object : OnMoveListener {
override fun onMoveBegin(detector: MoveGestureDetector) {
onCameraTrackingDismissed()
}
override fun onMove(detector: MoveGestureDetector): Boolean {
return false
}
override fun onMoveEnd(detector: MoveGestureDetector) {}
}
private lateinit var mapView: MapView
//mapbox map---------------------------------------------
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
mapView = MapView(this)
setContentView(R.layout.page_plan_route)
locationPermissionHelper = LocationPermissionHelper(WeakReference(this))
locationPermissionHelper.checkPermissions {
onMapReady()
}
currLocation = findViewById(R.id.yourLocation)
targetLocation = findViewById(R.id.targetLocation)
back = findViewById(R.id.backPlanRoute)
// exitPopUp = findViewById(R.id.planPopUpBack)
searchText = findViewById(R.id.inputRoute)
directionButton = findViewById(R.id.directionIcon)
seekBar = findViewById(R.id.seekBar)
levelText = findViewById(R.id.gradientLevel)
findRoute = findViewById(R.id.findRouteBtn)
dialog = Dialog(this)
savePopDialog = Dialog(this)
loadingDialog = Dialog(this)
// sample user
userId = 2
// accept the passed value
val intent = intent
val userChoice = intent.getStringExtra("key")
if (userChoice == "1") { // plan route
// show input fields
directionButton.setImageResource(R.drawable.ic_direction_violet)
showInputFields("violet")
} else if (userChoice == "0") { // start journey
// hide input fields
hideInputFields("gray")
}
// on welcome page when
// PlanRoute is click - display input fields (direction icon - color violet)
// Start journey is click - hide input field (direction icon - color gray)
// back button
back.setOnClickListener(View.OnClickListener {
finish()
val toast = Toast.makeText(applicationContext, "route click", Toast.LENGTH_LONG)
toast.show()
})
// search bar input text ----- have auto complete -- map will move according to the inputed route (i guess)
// toggle button
directionButton.setOnClickListener(View.OnClickListener {
// make it toggle button
println("This is image tag: " + directionButton.getTag())
if (directionButton.getTag() === "gray") {
// change color of icon and tag
directionButton.setImageResource(R.drawable.ic_direction_violet)
showInputFields("violet")
} else if (directionButton.getTag() === "violet") {
// change color of icon and tag
directionButton.setImageResource(R.drawable.directions_ic)
hideInputFields("gray")
}
})
// slide bar
seekBar.setOnSeekBarChangeListener(object : OnSeekBarChangeListener {
override fun onProgressChanged(seekBar: SeekBar, progresValue: Int, fromUser: Boolean) {}
override fun onStartTrackingTouch(seekBar: SeekBar) {}
override fun onStopTrackingTouch(seekBar: SeekBar) {
levelText.setText(seekBar.progress.toString())
}
})
// input fields clear error
currLocation.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(charSequence: CharSequence, i: Int, i1: Int, i2: Int) {}
override fun onTextChanged(charSequence: CharSequence, i: Int, i1: Int, i2: Int) {
if (currLocation.getText().length != 0) {
currLocation.setBackgroundResource(R.drawable.border_edit_text)
}
}
override fun afterTextChanged(editable: Editable) {}
})
targetLocation.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(charSequence: CharSequence, i: Int, i1: Int, i2: Int) {}
override fun onTextChanged(charSequence: CharSequence, i: Int, i1: Int, i2: Int) {
if (targetLocation.getText().length != 0) {
targetLocation.setBackgroundResource(R.drawable.border_edit_text)
}
}
override fun afterTextChanged(editable: Editable) {}
})
// find route click
findRoute.setOnClickListener(View.OnClickListener {
var isValidInput = true
// get seek bar level
val barLevel = seekBar.getProgress()
// check input text
if (currLocation.getText().isEmpty()) {
currLocation.setBackgroundResource(R.drawable.edit_text_error)
isValidInput = false
}
if (targetLocation.getText().isEmpty()) {
targetLocation.setBackgroundResource(R.drawable.edit_text_error)
isValidInput = false
}
if (targetLocation.getText().isNotEmpty()) {
isValidInput = true
}
if (currLocation.getText().isNotEmpty()) {
isValidInput = true
}
if (isValidInput) {
// radio button not working
startLoc = currLocation.text.toString()
destination = targetLocation.text.toString()
println("Current Location: " + currLocation.text)
println("Target Location: " + targetLocation.text)
println("Level: $barLevel")
// run code to pop up the results
// showSuggestedRoutes(currLocation.getText(), targetLocation.getText(), String.valueOf(barLevel), String.valueOf(radioButton)){}
// private void showSuggestedRoutes(String curr, String target, String elevation, String bikeLane){}
// make model for routesSuggestionCard
showSuggestedRoutes()
}
})
}
private fun onMapReady() {
mapView.getMapboxMap().setCamera(
CameraOptions.Builder()
.zoom(14.0)
.build()
)
mapView.getMapboxMap().loadStyleUri("mapbox://styles/jericho00010/cl6y8iwmw003u15qfkli5qptl")
// Style.MAPBOX_STREETS
{
initLocationComponent()
setupGesturesListener()
}
}
private fun setupGesturesListener() {
mapView.gestures.addOnMoveListener(onMoveListener)
}
private fun initLocationComponent() {
val locationComponentPlugin = mapView.location
locationComponentPlugin.updateSettings {
this.enabled = true
this.pulsingEnabled = true
this.locationPuck = LocationPuck2D(
bearingImage = AppCompatResources.getDrawable(
this@PagePlanRoute,
com.mapbox.maps.R.drawable.mapbox_user_puck_icon
),
shadowImage = AppCompatResources.getDrawable(
this@PagePlanRoute,
com.mapbox.maps.R.drawable.mapbox_user_icon_shadow,
),
scaleExpression = interpolate {
linear()
zoom()
stop {
literal(0.0)
literal(0.6)
}
stop {
literal(20.0)
literal(1.0)
}
}.toJson()
)
}
locationComponentPlugin.addOnIndicatorPositionChangedListener(onIndicatorPositionChangedListener)
locationComponentPlugin.addOnIndicatorBearingChangedListener(onIndicatorBearingChangedListener)
}
private fun onCameraTrackingDismissed() {
Toast.makeText(this, "onCameraTrackingDismissed", Toast.LENGTH_SHORT).show()
mapView.location
.removeOnIndicatorPositionChangedListener(onIndicatorPositionChangedListener)
mapView.location
.removeOnIndicatorBearingChangedListener(onIndicatorBearingChangedListener)
mapView.gestures.removeOnMoveListener(onMoveListener)
}
override fun onDestroy() {
super.onDestroy()
mapView.location
.removeOnIndicatorBearingChangedListener(onIndicatorBearingChangedListener)
mapView.location
.removeOnIndicatorPositionChangedListener(onIndicatorPositionChangedListener)
mapView.gestures.removeOnMoveListener(onMoveListener)
}
override fun onRequestPermissionsResult(
requestCode: Int,
permissions: Array<String>,
grantResults: IntArray
) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
locationPermissionHelper.onRequestPermissionsResult(requestCode, permissions, grantResults)
}
private fun hideInputFields(color: String) {
directionButton.tag = color
val inputLocationCard = findViewById<CardView>(R.id.inputLocationCard)
val inputPreferenceCard = findViewById<CardView>(R.id.inputPreferenceCard)
inputLocationCard.visibility = View.INVISIBLE
inputPreferenceCard.visibility = View.INVISIBLE
}
private fun showInputFields(color: String) {
directionButton.tag = color
val inputLocationCard = findViewById<CardView>(R.id.inputLocationCard)
val inputPreferenceCard = findViewById<CardView>(R.id.inputPreferenceCard)
inputLocationCard.visibility = View.VISIBLE
inputPreferenceCard.visibility = View.VISIBLE
}
private fun sendData() {
val intent = Intent(this@PagePlanRoute, PageOnRide::class.java)
intent.putExtra("userId", userId.toString())
intent.putExtra("routeId", routeId.toString())
intent.putExtra("startLoc", startLoc)
intent.putExtra("destination", destination)
println("-----------Send On Data-----------")
println("user: $userId")
println("route: $routeId")
println("start: $startLoc")
println("destination: $destination")
println("----------------------------------")
startActivity(intent)
}
private fun showSuggestedRoutes() {
dialog.setContentView(R.layout.pop_route_suggest)
dialog.window!!.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
val goBtn = dialog.findViewById<Button>(R.id.suggestRouteGoBtn)
val exitPlanPopUp = dialog.findViewById<ImageView>(R.id.planPopUpBack)
val saveRouteBtn = dialog.findViewById<Button>(R.id.suggestRouteSaveBtn)
val seeMore = dialog.findViewById<TextView>(R.id.viewMoreText)
routeIdText = dialog.findViewById(R.id.testRouteId)
dialog.show()
// pick one of the suggested route to start
goBtn.setOnClickListener { // get user's current location
// get user's destination
// get id of selected route
// pass this to PageOnRide page
routeId = routeIdText.getText().toString().toInt()
sendData()
}
// exit pop up
exitPlanPopUp.setOnClickListener { dialog.dismiss() }
saveRouteBtn.setOnClickListener { showLoadingDialog() }
seeMore.setOnClickListener { // pass route name or Id
startActivity(Intent(this@PagePlanRoute, PageRouteReviews::class.java))
}
}
private fun showSaveSuccess() {
savePopDialog.setContentView(R.layout.pop_route_save)
savePopDialog.window!!.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
val handler = Handler()
val runnable = Runnable {
println("-----------Save Route Data-----------")
println("user: $userId")
println("route: $routeId")
println("start: $startLoc")
println("destination: $destination")
println("----------------------------------")
savePopDialog.dismiss()
}
handler.postDelayed(runnable, 2000)
savePopDialog.show()
}
private fun showLoadingDialog() {
loadingDialog.setContentView(R.layout.pop_loading)
loadingDialog.window!!.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
loadingDialog.show()
val handler = Handler()
handler.postDelayed({
loadingDialog.dismiss()
showSaveSuccess()
}, 5000)
}
```
| My android application (mapView) is not properly showing if it is not inside MainActivity | CC BY-SA 4.0 | null | 2022-09-02T15:43:39.030 | 2022-09-02T18:43:16.457 | 2022-09-02T18:43:16.457 | 12,402,724 | 12,402,724 | [
"android",
"android-studio",
"mobile-development",
"mapbox-android"
] |
73,608,733 | 1 | null | null | 0 | 45 | Hello i just got a new laotop and i am tryng to install react-native to my laptop and i have been grtting this error
```
node:internal/modules/cjs/loader:372
throw err;
Error: Cannot find module 'C:\Users\JUWON CALEB\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\denodeify\index.js'. Please verify that the package.json has
a valid "main" entry
```
Please how do i go about it ? I have reinstalled my nodejs and npm but i still get the same problem
| How do i run NPX react-native on my laptop | CC BY-SA 4.0 | 0 | 2022-09-05T11:34:42.390 | 2022-09-05T12:08:16.130 | null | null | 13,631,064 | [
"javascript",
"reactjs",
"windows",
"react-native",
"mobile-development"
] |
73,630,722 | 1 | null | null | 1 | 307 | I was developing a video call application, and I want to show incoming calls.
When The phone is in the foreground I was able to show a full screen in both android and ios.
and when the app is minimized, in android I achieved it by bringing the app to foreground and navigate to the invitation screen.
but in ios, I couldn't do that. I tried URL scheme but, URL scheme opens the app from other app. when I try to call in the app it throws the following exception.
> Runner[4647:51243] [default] Failed to open URL exampleapp://: Error Domain=FBSOpenApplicationServiceErrorDomain Code=1 "The request to open "com.exampleapp" failed." UserInfo={BSErrorCodeDescription=RequestDenied, NSUnderlyingError=0x600000acabe0 {Error Domain=FBSOpenApplicationErrorDomain Code=3 "Application com.exampleapp is neither visible nor entitled, so may not perform un-trusted user actions." UserInfo={BSErrorCodeDescription=Security, NSLocalizedFailureReason=Application com.exampleapp is neither visible nor entitled, so may not perform un-trusted user actions.}}, NSLocalizedDescription=The request to open "com.exampleapp" failed., FBSOpenApplicationRequestID=0x46fb, NSLocalizedFailureReason=The request was denied by service delegate (SBMainWorkspace) for reason: Security ("Application com.exampleapp is neither visible nor entitled, so may not perform un-trusted user actions"
I searched online but couldn't find anything helpful.
How to show a full-screen incoming call when the app is in background in ios, like WhatsUp?
| Flutter: How to display fullscreen incoming call on ios when the app is in background? | CC BY-SA 4.0 | null | 2022-09-07T05:57:58.993 | 2022-09-07T06:09:58.830 | null | null | 12,965,253 | [
"android",
"ios",
"swift",
"flutter",
"mobile-development"
] |
73,635,360 | 1 | null | null | 4 | 190 | I have been having this problem with my . Whenever I turn on wireless debugging, it turns off whenever the device goes to sleep. I have checked WiFi settings for but did not find any such option in the MIUI Wifi options. I reset my phone few months back, and the problem was gone. But now it is back, and I cant afford to reset my phone every now and then.
Edit: I am using Wireless Debugging option in Android 11 and not the `adb tcpip` method.
| Android 11 - Wireless Debugging turns off when phones' display turns off | CC BY-SA 4.0 | null | 2022-09-07T12:16:26.323 | 2022-09-07T12:30:55.537 | 2022-09-07T12:30:55.537 | 10,014,401 | 10,014,401 | [
"android",
"mobile-development",
"redmi-device"
] |
73,645,644 | 1 | 73,645,849 | null | -1 | 218 | I have made two `textView` in an `xml` file where one `textView` shows current date and another shows current time as `text`.
Now, I have used the java `Calendar.getInstance().getTime()` method to get the date & time information. But it is acting as a static view i.e. it is not changing the date & time like a digital clock.
Now I am trying to show the `textViews` to show the current date & time in synchronization with device-system's date & time. That means, suppose now it is `11:59:59 PM` in the night and the date is `7th Sep, 2022`. Just after `1s`, my time `textView` should show the time as `12:00:00 AM` and date should show as `8th Sep, 2022`. And it should continue to change the time after every `1s` like a digital clock. Last of all, there should not be any delay in between system dateTime & app dateTime i.e. perfectly synchronised.
How to do that??
```
public class MainActivity extends AppCompatActivity {
TextView textDate, textClock;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
textDate = findViewById(R.id.textDate);
textClock = findViewById(R.id.textClock);
setDateTime();
}
private void setDateTime() {
Date c = Calendar.getInstance().getTime();
SimpleDateFormat df = new SimpleDateFormat("dd MMM, yyyy", Locale.getDefault());
SimpleDateFormat df_clock = new SimpleDateFormat("hh:mm:ss a", Locale.getDefault());
String formattedDate = df.format(c);
String formattedClock = df_clock.format(c);
textDate.setText(formattedDate);
textClock.setText(formattedClock);
}
}
```
| How to show the live DateTime as a textView (Like a digital watch) in Android Studio? | CC BY-SA 4.0 | null | 2022-09-08T08:04:48.723 | 2022-09-08T08:22:09.727 | 2022-09-08T08:13:31.997 | 11,755,559 | 11,755,559 | [
"java",
"android",
"android-studio",
"mobile-development"
] |
73,647,652 | 1 | null | null | 0 | 69 | I am trying since Android 12 appeared to create an android application with a full screen WebView working with camera upload (`<input type="file">`) and I cannot get it done.
Is there anyone who can help me with an working exemple? I found so many examples/tutorials but they are old and do not work with the latest android version...
Thank you very much!
| Android 12 Webview with camera upload | CC BY-SA 4.0 | null | 2022-09-08T10:33:18.933 | 2022-09-08T10:33:18.933 | null | null | 11,707,110 | [
"android",
"webview",
"mobile-development"
] |
73,676,007 | 1 | null | null | 0 | 45 | I'm creating an App Updater for my android App and since the app can't go on the Play Store I need to get my APK from somewhere else. I'm already getting a JSON through an HTTP Request from my server that contains the version of the latest app. Is there a way to send the APK within that JSON to be downloaded after? If so I would appreciate some insight into how that is done. If there is a bette way I'm all ears too!
| What's the best way to get an APK for app update? | CC BY-SA 4.0 | null | 2022-09-11T00:17:28.480 | 2022-09-11T00:17:28.480 | null | null | 16,591,356 | [
"java",
"android",
"mobile-development"
] |
73,684,450 | 1 | null | null | 0 | 379 | [](https://i.stack.imgur.com/DdG5I.png)
How to show a constant text in textfield in Flutter along with typed data like in this picture.
| How to show a text along textfield data like this in flutter | CC BY-SA 4.0 | null | 2022-09-12T04:21:33.697 | 2022-09-12T05:23:26.393 | null | null | 5,944,241 | [
"flutter",
"dart",
"textfield",
"mobile-development"
] |
73,807,020 | 1 | null | null | 0 | 109 | can you please explain how to draw/make a mesh gradient in swiftUI similar to the attached image?
I it straightforward to use LinearGradient, RadialGradient, or Angular gradient but none of them produce something similar to the attached image as far as I know.
Can you please help me with my request?
[](https://i.stack.imgur.com/FMtYv.png)
I tried different values for the the angle degree, but still not the result I'm looking for. Below is the code I have so far:
```
struct ContentView: View {
let gradient = Gradient(colors: [Color(.systemRed),
Color(.systemBlue),
Color(.systemGray),
Color(.systemPurple),
Color(.systemYellow),
Color(.systemRed)])
var body: some View {
VStack {
Text("")
}
.frame(width: 300, height: 300)
.background(
AngularGradient(gradient: gradient,
center: .center,
angle: .degrees(180)) // (180 + 45)
)
}
```
| how to draw mesh gradient in swiftui | CC BY-SA 4.0 | null | 2022-09-21T21:16:17.697 | 2022-09-22T15:36:37.167 | 2022-09-22T15:36:37.167 | 9,751,547 | 9,751,547 | [
"ios",
"swift",
"user-interface",
"swiftui",
"mobile-development"
] |
73,816,307 | 1 | null | null | -1 | 89 | I am learning Swift and iOS development, and I am just trying to figure out how to open an URL from a button click.
I found this answer: [SwiftUI: How do I make a button open a URL in safari?](https://stackoverflow.com/questions/58643888/swiftui-how-do-i-make-a-button-open-a-url-in-safari)
So I am trying to incorporate "Link" into my code below:
```
class ViewController: UIViewController {
private let visitwebsitebutton: UIButton = {
let visitwebsitebutton = UIButton()
visitwebsitebutton.backgroundColor = .gray
visitwebsitebutton.setTitle("Visit Website", for: .normal)
visitwebsitebutton.setTitleColor(.white, for: .normal)
visitwebsitebutton.titleLabel?.font = UIFont.boldSystemFont(ofSize: 18)
visitwebsitebutton.layer.cornerRadius = 20
visitwebsitebutton.Link("Some label", destination: URL(string: "https://www.mylink.com")!) // <-- link used here
return visitwebsitebutton
}()
override func viewDidLoad() {
super.viewDidLoad()
view.addSubview(visitwebsitebutton)
}
}
```
Using Link above gives me an error that reads "Value of type 'UIButton' has no member 'Link'".
What am I doing wrong and how can I fix it?
## Edit 1
I just tried this inside private let visitwebsitebutton:
```
visitwebsitebutton(action: {"www.redacted.com"})
```
But now I'm getting the below error:
```
Cannot call value of non-function type 'UIButton'
```
## Edit 2
Within private let visitwebsitebutton, I attempted the following:
```
visitwebsitebutton.addTarget(self, action: "buttonClicked", for: UIControl.Event.touchUpInside)
```
Using the above, I am getting a few warning:
```
'self' refers to the method 'ViewController.self', which may be unexpected
Use 'ViewController.self' to silence this warning
No method declared with Objective-C selector 'buttonClicked'
Replace '"buttonClicked"' with 'Selector("buttonClicked")'
```
I tried to call the buttonClicked like this:
```
@objc func buttonClicked(sender:UIButton)
{
if(sender.tag == 5){
var abc = "argOne" //Do something for tag 5
}
print("hello")
}
```
And above, I am getting the below warning:
```
Initialization of variable 'abc' was never used; consider replacing with assignment to '_' or removing it
Replace 'var abc' with '_'
```
I just want to get the button to work.
| Swift - open URL from button click | CC BY-SA 4.0 | null | 2022-09-22T14:21:31.693 | 2022-10-01T22:18:22.803 | 2022-10-01T22:17:48.207 | 472,495 | 4,262,571 | [
"ios",
"swift",
"uibutton",
"mobile-development"
] |
73,828,031 | 1 | null | null | 0 | 84 | I am learning iOS and Swift development, and I was able to get a button click to open a URL.
Within Xcode, I am running the app by clicking the play button.
When the app opens, and I click the button on the app, it takes me to the URL.
The problem is: the screen is blank.
The address bar does show the URL.
Here is a portion of the code that I wrote that opens the URL:
```
class ViewController: UIViewController {
private lazy var visitwebsitebutton: UIButton = {
let visitwebsitebutton = UIButton()
let dtgreen = UIColor(rgb: 0x12823b)
visitwebsitebutton.backgroundColor = .green
visitwebsitebutton.setTitle("Visit Website", for: .normal)
visitwebsitebutton.setTitleColor(.white, for: .normal)
visitwebsitebutton.titleLabel?.font = UIFont.boldSystemFont(ofSize: 18)
visitwebsitebutton.layer.cornerRadius = 20
visitwebsitebutton.addTarget(self, action: #selector(visitwebsitebuttonTapped), for: .touchUpInside)
return visitwebsitebutton
}()
@objc func visitwebsitebuttonTapped() {
if let yourURL = URL(string: "https://www.somesite.com") {
UIApplication.shared.open(yourURL, options: [:], completionHandler: nil)
}
}
}
```
Using the above will successfully allow the user (which is me at the moment) to click on the button, and open the URL in another window on the Xcode emulator. But the screen is blank.
My question is: does this blank screen only occur when running the app in Xcode? Will it work properly when I publish this app to the web?
| UIButton click function opens URL in blank screen | CC BY-SA 4.0 | null | 2022-09-23T12:52:44.763 | 2022-10-01T22:16:32.163 | 2022-10-01T22:16:32.163 | 472,495 | 4,262,571 | [
"ios",
"swift",
"emulation",
"mobile-development"
] |