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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
67,242,879 | 1 | null | null | 3 | 2,338 | I am working on creating something to record call in my react native App.
For this I have used ReactNative Headless task to get the status of phone and react-native-audio-recorder-player for recording the call but at the end I am getting a file with no sound .
react-native-audio-recorder-player its working fine separetly when I am using this not on call but its saving a file with no sound during call.
Here is my index.js
```
import { AppRegistry } from 'react-native';
import App from './App';
import { name as appName } from './app.json';
import { AudioRecorder, AudioUtils } from 'react-native-audio'
import AudioRecorderPlayer from 'react-native-audio-recorder-player';
const audioRecorderPlayer = new AudioRecorderPlayer();
// const audioPath = AudioUtils.DocumentDirectoryPath + '/record.aac'
const Rec = async (data) => {
console.log(data.state)
try{
if (data.state === 'extra_state_offhook') {
const result= await audioRecorderPlayer.startRecorder().then(result=>console.log("started")).catch(err=>console.log(err))
audioRecorderPlayer.addRecordBackListener((e) => {
console.log('Recording . . . ', e.current_position);
return;
});
console.log(result);
} else if (data.state === 'extra_state_idle') {
const result = await audioRecorderPlayer.stopRecorder();
audioRecorderPlayer.removeRecordBackListener()
console.log(result);
console.log('Stopped')
}
}catch(err ){
console.log(err)
}
}
AppRegistry.registerHeadlessTask('Rec', () => Rec)
AppRegistry.registerComponent(appName, () => App);
```
Here is my AndroidManifest.xml
```
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.cadric">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.STORAGE"/>
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.READ_CALL_LOG"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<application android:requestLegacyExternalStorage="true" android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="false" android:usesCleartextTraffic="true" android:theme="@style/AppTheme">
<activity android:name=".MainActivity" android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.DOWNLOAD_COMPLETE"/>
</intent-filter>
<intent-filter>
<action android:name="com.google.android.gms.auth.api.phone.SMS_RETRIEVED" />
</intent-filter>
</activity>
<service android:name="com.cadric.service.RecService" android:enabled="true" android:exported="true" />
<receiver android:name="com.cadric.receiver.RecReceiver" android:enabled="true" android:exported="true" android:permission="android.permission.BIND_DEVICE_ADMIN">
<intent-filter android:priority="0">
<action android:name="android.intent.action.PHONE_STATE" />
<action android:name="android.intent.action.NEW_OUTGOING_CALL" />
</intent-filter>
</receiver>
</application>
</manifest>
```
Here is my RecReciever.java file
```
package com.cadric.receiver;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.telephony.TelephonyManager;
import com.cadric.service.RecService;
import com.facebook.react.HeadlessJsTaskService;
public final class RecReceiver extends BroadcastReceiver {
public final void onReceive(Context context, Intent intent) {
Boolean incomingCall=false;
Intent recIntent = new Intent(context, RecService.class);
if (intent.getAction().equals("android.intent.action.PHONE_STATE")) {
recIntent.putExtra("action", "phone_state");
String phoneState = intent.getStringExtra("state");
if (phoneState.equals(TelephonyManager.EXTRA_STATE_RINGING)) {
String phoneNumber = intent.getStringExtra("incoming_number");
System.out.println(phoneNumber);
incomingCall = true;
recIntent.putExtra("state", "extra_state_ringing");
recIntent.putExtra("incoming_call", true);
recIntent.putExtra("number", phoneNumber);
} else if (phoneState.equals(TelephonyManager.EXTRA_STATE_OFFHOOK)) {
if (incomingCall) {
incomingCall = false;
}
recIntent.putExtra("state", "extra_state_offhook");
recIntent.putExtra("incoming_call", false);
} else if (phoneState.equals(TelephonyManager.EXTRA_STATE_IDLE)) {
if (incomingCall) {
incomingCall = false;
}
recIntent.putExtra("state", "extra_state_idle");
recIntent.putExtra("incoming_call", false);
}
} else {
recIntent.putExtra("action", "new_outgoing_call");
}
context.startService(recIntent);
HeadlessJsTaskService.acquireWakeLockNow(context);
}
}
```
Here is my RecService.java file
```
package com.cadric.service;
import android.content.Intent;
import android.os.Bundle;
import com.facebook.react.HeadlessJsTaskService;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.jstasks.HeadlessJsTaskConfig;
import javax.annotation.Nullable;
public class RecService extends HeadlessJsTaskService {
@Nullable
protected HeadlessJsTaskConfig getTaskConfig(Intent intent) {
Bundle extras = intent.getExtras();
return new HeadlessJsTaskConfig(
"Rec",
extras != null ? Arguments.fromBundle(extras) : null,
5000);
}
}
```
Please help me I am stucked , invested more than 20 hours in that already.
| Implementing Call recording in React Native | CC BY-SA 4.0 | null | 2021-04-24T12:40:33.410 | 2021-12-30T13:04:15.877 | null | null | 11,851,283 | [
"android",
"react-native",
"kotlin",
"mobile-development"
] |
67,246,319 | 1 | null | null | 0 | 2,213 | I'm facing an issue when installing flutter on my macOs BigSur as I have set the flutter path the wrong way and I have messed everything up.
I just want a way to completely uninstall flutter and re-install it the right way.
```
ro:~ yahyasaleh$ which flutter
YAHYAs-MacBook-Pro:~ yahyasaleh$
YAHYAs-MacBook-Pro:~ yahyasaleh$ flutter docker
-bash: flutter: command not found
YAHYAs-MacBook-Pro:~ yahyasaleh$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:[/Users/yahyasaleh/Developer/flutter/bin]/flutter/bin
YAHYAs-MacBook-Pro:~ yahyasaleh$ git clean -xfd
fatal: not a git repository (or any of the parent directories): .git
YAHYAs-MacBook-Pro:~ yahyasaleh$ git stash save --keep-index
fatal: not a git repository (or any of the parent directories): .git
YAHYAs-MacBook-Pro:~ yahyasaleh$ git stash drop
fatal: not a git repository (or any of the parent directories): .git
YAHYAs-MacBook-Pro:~ yahyasaleh$ git pull
fatal: not a git repository (or any of the parent directories): .git
YAHYAs-MacBook-Pro:~ yahyasaleh$ flutter doctor
-bash: flutter: command not found
YAHYAs-MacBook-Pro:~ yahyasaleh$ rm -rf
YAHYAs-MacBook-Pro:~ yahyasaleh$ which flutter
YAHYAs-MacBook-Pro:~ yahyasaleh$ git clean -xfd
fatal: not a git repository (or any of the parent directories): .git
YAHYAs-MacBook-Pro:~ yahyasaleh$
```
| how to completely uninstall flutter on macos and reinstall it in the correct way? | CC BY-SA 4.0 | null | 2021-04-24T18:46:38.827 | 2021-04-24T19:54:30.770 | 2021-04-24T19:54:30.770 | 9,223,839 | 13,526,088 | [
"flutter",
"mobile",
"mobile-development"
] |
67,252,771 | 1 | null | null | 0 | 519 | I would prefer to disable icon buttons in a screen depending on a certain condition from Firestore data.
I want to check flag's condition and disable the buttons if flag is 1.
I wrote the `onPressed` as told, but all the 'Join' buttons are disabled irrespective of the condition. Is there a logical problem here ?
| Disable icon button in Flutter based on condition | CC BY-SA 4.0 | null | 2021-04-25T11:18:41.113 | 2021-05-10T05:34:42.600 | 2021-05-10T05:34:42.600 | null | null | [
"flutter",
"google-cloud-firestore",
"flutter-animation",
"mobile-development"
] |
67,378,702 | 1 | null | null | 0 | 413 | I'm trying to make a very barebones mobile browser to practice swiftui and wkwebview (WKwebview is wrapped in a UIViewRepresentable). However, when trying to implement multiple tabs for the browser I hit an odd error. The default webview works but when pressing the button to add new tabs, I notice that the new webview never actually has it's makeuiview() function run. The new tab just displays the last page that was loaded by the first webview but remains static and can't receive navigation. I'm not sure what would cause a uiviewrepresentable to not run it's makeuiview method. There's more code to this but I posted what I thought mattered most.
Content View
(Where the logic for adding the new tab resides) Refer to Tablist.newTab() function
```
import SwiftUI
import CoreData
class TabList: ObservableObject {
@Published var tabs: [BrowserPage] = [BrowserPage()]
func newTab(){
tabs.append(BrowserPage())
}
}
struct ContentView: View {
@Environment(\.managedObjectContext) private var viewContext
@StateObject var tablist: TabList = TabList()
@State var selection = 0
@State var showTabs: Bool = false
var body: some View {
VStack {
tablist.tabs[selection]
Button("next") {
withAnimation {
selection = (selection + 1) % tablist.tabs.count
}
}
Divider()
Button("add") {
withAnimation {
tablist.newTab()
selection = tablist.tabs.count - 1
}
}
Divider()
Text("\(selection)")
Text("\(tablist.tabs.count)")
}
.frame( maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
.sheet(isPresented: $showTabs, content: {
})
}
}
```
WebviewModel Class
```
import Foundation
import Combine
class WebViewModel: ObservableObject{
var webViewNavigationPublisher = PassthroughSubject<WebViewNavigation, Never>()
var showWebTitle = PassthroughSubject<String, Never>()
var showLoader = PassthroughSubject<Bool, Never>()
var valuePublisher = PassthroughSubject<String, Never>()
var url: String = "https://www.google.com"
@Published var urltoEdit: String = "https://www.google.com"
}
enum WebViewNavigation {
case backward, forward, reload, load
}
```
WebsiteView (UIViewRepresentable for WKWebview)
```
import Foundation
import UIKit
import SwiftUI
import Combine
import WebKit
protocol WebViewHandlerDelegate {
func receivedJsonValueFromWebView(value: [String: Any?])
func receivedStringValueFromWebView(value: String)
}
struct WebView: UIViewRepresentable, WebViewHandlerDelegate {
func receivedJsonValueFromWebView(value: [String : Any?]) {
print("JSON value received from web is: \(value)")
}
func receivedStringValueFromWebView(value: String) {
print("String value received from web is: \(value)")
}
@ObservedObject var viewModel: WebViewModel
func makeCoordinator() -> Coordinator {
Coordinator(self)
}
func makeUIView(context: Context) -> WKWebView {
let preferences = WKPreferences()
let configuration = WKWebViewConfiguration()
configuration.userContentController.add(self.makeCoordinator(), name: "iOSNative")
configuration.preferences = preferences
let webView = WKWebView(frame: CGRect.zero, configuration: configuration)
webView.navigationDelegate = context.coordinator
//remove after debugging...
webView.allowsBackForwardNavigationGestures = true
webView.scrollView.isScrollEnabled = true
webView.load(URLRequest(url: URL(string: viewModel.url)!))
print("UUUUUUUUUUUUUUUUUUUUU " + viewModel.url)
return webView
}
func updateUIView(_ webView: WKWebView, context: Context) {
}
class Coordinator : NSObject, WKNavigationDelegate {
var parent: WebView
var valueSubscriber: AnyCancellable? = nil
var webViewNavigationSubscriber: AnyCancellable? = nil
var delegate: WebViewHandlerDelegate?
init(_ uiWebView: WebView) {
self.parent = uiWebView
}
deinit {
valueSubscriber?.cancel()
webViewNavigationSubscriber?.cancel()
}
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
// Get the title of loaded webcontent
webView.evaluateJavaScript("document.title") { (response, error) in
if let error = error {
print("Error getting title")
print(error.localizedDescription)
}
guard let title = response as? String else {
return
}
self.parent.viewModel.showWebTitle.send(title)
}
valueSubscriber = parent.viewModel.valuePublisher.receive(on: RunLoop.main).sink(receiveValue: { value in
let javascriptFunction = "valueGotFromIOS(\(value));"
webView.evaluateJavaScript(javascriptFunction) { (response, error) in
if let error = error {
print("Error calling javascript:valueGotFromIOS()")
print(error.localizedDescription)
} else {
print("Called javascript:valueGotFromIOS()")
}
}
})
// Page loaded so no need to show loader anymore
self.parent.viewModel.showLoader.send(false)
}
/* Here I implemented most of the WKWebView's delegate functions so that you can know them and
can use them in different necessary purposes */
func webViewWebContentProcessDidTerminate(_ webView: WKWebView) {
// Hides loader
parent.viewModel.showLoader.send(false)
}
func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) {
// Hides loader
parent.viewModel.showLoader.send(false)
}
func webView(_ webView: WKWebView, didCommit navigation: WKNavigation!) {
self.parent.viewModel.urltoEdit = webView.url!.absoluteString
// Shows loader
parent.viewModel.showLoader.send(true)
}
func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) {
// Shows loader
parent.viewModel.showLoader.send(true)
self.webViewNavigationSubscriber = self.parent.viewModel.webViewNavigationPublisher.receive(on: RunLoop.main).sink(receiveValue: { navigation in
switch navigation {
case .backward:
if webView.canGoBack {
webView.goBack()
}
case .forward:
if webView.canGoForward {
webView.goForward()
}
case .reload:
webView.reload()
case .load:
webView.load(URLRequest(url: URL(string: self.parent.viewModel.url)!))
print("IIIIIIIIIIIIIIIIIIIII " + self.parent.viewModel.url)
}
})
}
// This function is essential for intercepting every navigation in the webview
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
// Suppose you don't want your user to go a restricted site
// Here you can get many information about new url from 'navigationAction.request.description'
decisionHandler(.allow)
}
}
}
// MARK: - Extensions
extension WebView.Coordinator: WKScriptMessageHandler {
func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
// Make sure that your passed delegate is called
if message.name == "iOSNative" {
if let body = message.body as? [String: Any?] {
delegate?.receivedJsonValueFromWebView(value: body)
} else if let body = message.body as? String {
delegate?.receivedStringValueFromWebView(value: body)
}
}
}
}
```
BrowserPage View
```
import SwiftUI
struct BrowserPage: View, Identifiable{
let id: UUID = UUID()
@ObservedObject var viewModel = WebViewModel()
var body: some View {
VStack{
URLBarView(viewModel: viewModel)
HStack{
WebView(viewModel: viewModel)
}
BottomNavBarView(viewModel: viewModel)
.padding(.bottom, 25)
}
}
}
```
| Trying to implement the ability to launch multiple wkwebview instances to emulate tabbing on a browser | CC BY-SA 4.0 | null | 2021-05-04T04:12:12.230 | 2021-05-04T04:12:12.230 | null | null | 15,828,062 | [
"ios",
"swift",
"swiftui",
"mobile-development",
"uiviewrepresentable"
] |
67,389,347 | 1 | null | null | 2 | 477 | I am building a mobile app using flutter.
. The stream provides the phone location.
Right now , when I load the application it asks me right away if I want to enable the location service then when I enable it , it starts updating the phone location.
here is my code:
main.dart
```
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MultiProvider(
providers: [
ChangeNotifierProvider.value(
value: Auth(),
),
StreamProvider.value(
value: LocationService().locationStream,
),
],
child: Consumer<Auth>(
builder: (ctx, auth, _) => MaterialApp(
title: 'deee',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: auth.isAuth ? TabsScreen() : LoginPage(),
initialRoute: "/",
// onGenerate routes and unknown routes "/": (ctx) => TabsScreen(),
routes: {
},
),
),
);
}
}
```
location_service.dart
```
import 'dart:async';
import 'dart:convert';
import 'package:location/location.dart';
import '../models/user_location.dart';
import '../providers/auth.dart';
import 'package:http/http.dart' as http;
class LocationService {
// Keep track of current Location
UserLocation _currentLocation;
Location location = Location();
Auth auth = Auth();
int counter = 1;
// Continuously emit location updates
StreamController<UserLocation> _locationController =
StreamController<UserLocation>.broadcast();
LocationService() {
location.requestPermission().then((granted) {
if (granted == PermissionStatus.granted) {
location.onLocationChanged.listen((locationData) async {
if (locationData != null) {
var firebaseId = auth.firebaseId;
if (firebaseId != null) {
try {
final url =
'https://delivery-system-default-rtdb.firebaseio.com/Drivers/${firebaseId}.json';
await http.patch(url,
body: jsonEncode({
'lat': locationData.latitude,
'lng': locationData.longitude,
'status': true
}));
} catch (error) {
print("error");
print(error);
}
}
counter++;
_locationController.add(UserLocation(
latitude: locationData.latitude,
longitude: locationData.longitude,
));
}
});
}
});
}
Stream<UserLocation> get locationStream => _locationController.stream;
```
Thank you for your time and effort
| how to stop stream provider in flutter when I log out? | CC BY-SA 4.0 | 0 | 2021-05-04T17:21:12.673 | 2021-05-04T17:21:12.673 | null | null | 11,902,193 | [
"flutter",
"dart",
"mobile",
"mobile-development",
"flutter-state"
] |
67,406,829 | 1 | 67,408,335 | null | 0 | 902 | I've trying to show my int state of Cubit using BlockBuilder, that's my code:
```
class CounterCubit extends Cubit<int> {
CounterCubit() : super(0);
void increment() => emit(state + 1);
void decrement() => emit(state - 1);
}
```
```
class CounterContainer extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BlocProvider(create: (_) => CounterCubit(), child: CounterView());
}
}
```
```
void main() {
runApp(MaterialApp(
theme: myTheme,
home: CounterView(),
));
}
```
```
class CounterView extends StatelessWidget {
@override
Widget build(BuildContext context) {
final textTheme = Theme.of(context).textTheme;
return Scaffold(
appBar: AppBar(
title: const Text("Example"),
),
body: Center( //I guess the problem is here
child: BlocBuilder<CounterCubit, int>(builder: (context, state) {
return Text("$state", style: textTheme.headline2);
})),
//Increment and decrement button
floatingActionButton: Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
FloatingActionButton(
child: const Icon(Icons.add),
onPressed: () => context.read<CounterCubit>().increment(),
),
const SizedBox(
height: 8,
),
FloatingActionButton(
child: const Icon(Icons.remove),
onPressed: () => context.read<CounterCubit>().decrement(),
)
],
),
);
}
}
```
The console error is
> Error: Could not find the correct Provider above this BlocBuilder<CounterCubit, int> Widget
I already tried use Provider but it not resolve the problem
| Flutter, a little Cubit BlocBuilder problem | CC BY-SA 4.0 | null | 2021-05-05T18:25:19.290 | 2021-05-05T20:27:54.503 | 2021-05-05T20:00:05.700 | 15,540,434 | 15,540,434 | [
"flutter",
"dart",
"bloc",
"mobile-development",
"flutter-bloc"
] |
67,412,073 | 1 | null | null | 1 | 150 | While working on sync api implementation, data was not getting synced with the backend server. As I debug the issue using `react-native log-android` for android apk it is giving the below error:
```
{ [Diagnostic error: Record ID customEvent#eeqpmwlxhbfspqje was sent over the bridge, but it's not cached]
│ framesToPop: 2,
│ name: 'Diagnostic error',
│ line: 686,
│ column: 197,
└ sourceURL: 'index.android.bundle' }
```
| RecordId was sent over the bridge, but it's not cached in watermelondb | CC BY-SA 4.0 | null | 2021-05-06T04:58:30.893 | 2021-05-06T04:58:30.893 | null | null | 9,294,908 | [
"android",
"react-native",
"mobile-development",
"watermelondb"
] |
67,421,740 | 1 | null | null | 1 | 411 | I use fontawesome to add icon to tab button but the only label shows up, NOT icon:
```
<Tab.Screen
name="Home"
component={Home}
options={{
tabBarLabel: "Home",
tabBarAccessibilityLabel: "Home",
tabBarTestID: "tabbar-Home",
tabBarIcon: () => (
<FontAwesomeIcon icon={faInfoCircle} color={'white'} size={30} />
),
}}
```
I use ReactNative, NOT expo!
| icon does not show up on tabBar | CC BY-SA 4.0 | null | 2021-05-06T15:54:02.170 | 2021-05-06T16:06:48.897 | 2021-05-06T16:05:01.360 | 13,224,113 | 13,224,113 | [
"reactjs",
"react-native",
"font-awesome",
"mobile-development"
] |
67,447,037 | 1 | null | null | 1 | 206 | Because no versions of shared_preferences match >2.0.5 <3.0.0 and shared_preferences 2.0.5 depends on shared_preferences_windows ^2.0.0, shared_preferences ^2.0.5 requires shared_preferences_windows ^2.0.0.
And because no versions of shared_preferences_windows match >2.0.0 <3.0.0 and shared_preferences_windows 2.0.0 depends on path_provider_windows ^2.0.0, shared_preferences ^2.0.5 requires path_provider_windows ^2.0.0.
Because stream_chat_flutter >=1.0.0-beta <2.0.0-nullsafety.0 depends on path_provider ^1.6.27 which depends on path_provider_windows ^0.0.4, stream_chat_flutter >=1.0.0-beta <2.0.0-nullsafety.0 requires path_provider_windows ^0.0.4.
Thus, shared_preferences ^2.0.5 is incompatible with stream_chat_flutter >=1.0.0-beta <2.0.0-nullsafety.0.
So, because jitsist depends on both shared_preferences ^2.0.5 and stream_chat_flutter ^1.0.0, version solving failed.
pub get failed (1; So, because jitsist depends on both shared_preferences ^2.0.5 and stream_chat_flutter ^1.0.0, version solving failed.)
```
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
jitsi_meet: ^0.1.0
form_field_validator: ^1.0.1
cupertino_icons: ^1.0.3
firebase_auth:
pin_code_fields: ^6.0.1
cloud_firestore:
firebase_core:
table_calendar: ^3.0.0
page_transition: "^1.1.7+6"
shared_preferences: ^2.0.5
stream_chat_flutter: ^1.0.0
dependency_overrides:
intl: ^0.17.0-nullsafety.2
dev_dependencies:
flutter_test:
sdk: flutter
```
| flutter stream_chat version solving failed | CC BY-SA 4.0 | null | 2021-05-08T11:31:23.997 | 2022-11-02T03:33:54.263 | null | null | 11,522,415 | [
"android",
"flutter",
"dart",
"visual-studio-code",
"mobile-development"
] |
67,457,301 | 1 | 67,457,426 | null | 0 | 317 | I get the data from http request, then i load it using futureBuilder, the problem is that it keeps calling the future method even if i set a variable with the future method in 'initState ()', but it still keeps calling it multiple times, i also tried the AsyncMemoizer too but no good, here is the code:
[my FutureBuilder](https://i.stack.imgur.com/pb9Vp.jpg)
[future method and iniState](https://i.stack.imgur.com/VZtCj.jpg)
[Http request method](https://i.stack.imgur.com/iNQmJ.jpg)
[home screen build](https://i.stack.imgur.com/S7Q7b.jpg)
I hope someone help me with the solution.
here is the rest of the code:
[launcher screen build](https://i.stack.imgur.com/gS9oe.jpg)
[connection method](https://i.stack.imgur.com/ls7Zr.jpg)
| FutureBuilder keeps Firing the Future method | CC BY-SA 4.0 | null | 2021-05-09T11:43:28.523 | 2021-05-09T13:36:48.347 | 2021-05-09T13:36:48.347 | 5,277,045 | 5,277,045 | [
"flutter",
"httprequest",
"mobile-development",
"flutter-futurebuilder"
] |
67,546,811 | 1 | 67,546,899 | null | 1 | 8,851 | I was following tutorial and I get this error
> ' The argument type 'Object?' can't be assigned to the parameter type 'Widget?'.dartargument_type_not_assignable'.
I tried to look on the documentation but I did know hoe to solve the error
```
import 'package:flutter/material.dart';
import 'search.dart';
import 'user_info.dart';
import 'cart.dart';
import 'feed.dart';
import 'home.dart';
class BottomBarScreen extends StatefulWidget {
@override
_BottomBarScreenState createState() => _BottomBarScreenState();
}
class _BottomBarScreenState extends State<BottomBarScreen> {
List<Map<String, Object>> _pages;
int _selectedPageIndex = 0;
@override
void initState() {
_pages = [
{
'page': home(),
},
{
'page': feed(),
},
{
'page': search(),
},
{
'page': cart(),
},
{
'page': user_info(),
},
];
super.initState();
}
void _selectPage(int index) {
setState(() {
_selectedPageIndex = index;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: _pages[_selectedPageIndex]['page'],
```
| The argument type 'Object?' can't be assigned to the parameter type 'Widget?' | CC BY-SA 4.0 | 0 | 2021-05-15T12:37:54.133 | 2021-11-25T22:06:00.030 | 2021-06-22T23:20:35.313 | 12,788,110 | 13,675,063 | [
"flutter",
"mobile-development"
] |
67,660,054 | 1 | 67,660,236 | null | -2 | 52 | im getting this error while parsing my String data from foreach to integer. Any ways to solve this? Thanks in advance.
[](https://i.stack.imgur.com/JD7sj.png)
[](https://i.stack.imgur.com/AZuPf.png)
| Parsing String data to int (Failed assertion: line 32 pos 14: 'prevReading is int': is not true.) | CC BY-SA 4.0 | null | 2021-05-23T13:03:37.540 | 2021-05-23T13:21:25.620 | null | null | 4,723,730 | [
"flutter",
"dart",
"mobile-development"
] |
67,715,885 | 1 | null | null | 0 | 83 | When I was having an Api Key then I used the following below code to extract the Json data from it.
Now I want to fetch Json data from [https://api.coingecko.com/api/v3/exchanges](https://api.coingecko.com/api/v3/exchanges) and I don't have any Api Key or query to pass.How can I do it using RetroFit?
```
import retrofit2.Call
import retrofit2.Retrofit
import retrofit2.http.GET
import retrofit2.create
import retrofit2.converter.gson.GsonConverterFactory
import retrofit2.http.Query
const val BASE_URL = "https://newsapi.org/"
const val API_KEY = "5f60ae62gcbc4bdaa0d15164d7f1275b"
interface NewsInterface {
@GET("v2/top-headlines?apiKey=$API_KEY")
fun getHeadLines(@Query("country")country:String): Call<News>
}
object NewsService {
val newsInstance :NewsInterface
init {
val retrofit: Retrofit= Retrofit.Builder()
.baseUrl(BASE_URL).addConverterFactory(GsonConverterFactory.create()).build()
newsInstance = retrofit.create(NewsInterface::class.java)
}
}
```
| how to extract Json data without having a query in Retrofit | CC BY-SA 4.0 | null | 2021-05-27T04:55:54.873 | 2021-05-27T05:00:43.157 | null | null | 15,892,733 | [
"android",
"json",
"android-studio",
"kotlin",
"mobile-development"
] |
67,740,356 | 1 | 67,741,823 | null | 0 | 60 | I have an issue with my Bootstrap Navbar. When I use the navbar on a mobile device, it disappears after the toggledown.
Here is my code for the navbar:
```
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css" integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-Piv4xVNRyMGpqkS2by6br4gNJ7DXjqk09RmUpJ8jgGtD7zP9yug3goQfGII0yAns" crossorigin="anonymous"></script>
<!--Navbar-->
<nav class="navbar navbar-expand-lg navbar-light fixed-top" id="navbarSupportedContent">
<a class="navbar-brand" href="#">Ewert Loitz Personenberförderung</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="true" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ml-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Startseite <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#ÜberUns">Über uns</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#Fuhrpark">Fuhrpark</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Kontakt</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Karriere</a>
</li>
</ul>
</div>
</nav>
```
[](https://i.stack.imgur.com/5ZLa4.png)
| Bootstrap Navbar disappears on mobile after using it once | CC BY-SA 4.0 | null | 2021-05-28T14:04:11.380 | 2021-05-31T10:42:18.280 | 2021-05-31T10:42:18.280 | 11,073,264 | 16,060,363 | [
"html",
"bootstrap-4",
"navbar",
"mobile-development"
] |
67,741,128 | 1 | 67,746,566 | null | 0 | 66 | i'm new to android development.
i'm trying to make a notification menu so i made a fragment class:
```
class NotificationFragment {
private String name;
public NotificationFragment() {}
public NotificationFragment(String name) {
this.name = name;
}
public String getName() {return this.name;}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.notification_fragment, container, false);
}
}
```
and now i want to load a notification to my screen:
```
private List<int> notifications = new ArrayList<>();
private ConstraintLayer notification_layout = findViewById(R.id.aConstraintLayoutToHoldNotifications);
public load_notification(int i) {
NotificationFragment cn = new NotificationFragment("TestName"+i);
FragmentFrame ff = new FragmentFrame(this);
int last_id = (notifications.size() >= 1 ? notifications.get(notifications.size() - 1) : ConstraintSet.PARENT_ID);
int toObjectSide = (last_id == ConstraintSet.PARENT_ID? ConstraintSet.TOP : ConstraintSet.BOTTOM);
int ff_id = View.generateViewId();
ff.setId(ff_id);
notification_layout.add(ff);
ConstraintSet cs = new ConstraintSet();
cs.clone(notification_layout);
cs.connect(
ff_id,
ConstraintSet.TOP,
last_id,
toObjectSide
);
cs.applyTo(notification_layout);
getSupportFragmentManager()
.beginTransaction()
.add(notificationLayerID, cn, "UIFragment")
.commit();
notifications.add(ff_id);
}
```
now that works fine.
however if i call it again it throws an error `java.lang.RuntimeException: All children of ConstraintLayout must have ids to use ConstraintSet` so i tried to do a bit of debugging and i think that the fragment is what needs an id, but there is no setId() for a fragment class.
```
1) is there a way to set the id of a programmatically generated Fragment?
2) if not, is there a "hack" around this?
3) is there something that i am missing and i don't need an id on the Fragment?
```
i tried to cut as much code as possible, what is on the post should be the Minimal Executable Example
| setId() for programmatically generated Fragment | CC BY-SA 4.0 | null | 2021-05-28T14:54:31.430 | 2021-05-28T23:49:49.733 | null | null | 15,926,969 | [
"java",
"android",
"android-fragments",
"mobile-development"
] |
67,770,092 | 1 | null | null | 0 | 804 | Hello I am new to Flutter, I am fetching array from JSON like below and I would like to check if every "value" = "";
```
"food_table": [
{
"name": "aaa",
"key": "aaa",
"value": ""
},
{
"name": "bbb",
"key": "bbb",
"value": ""
},
{
"name": "cccc",
"key": "cccc",
"value": ""
},
{
"name": "dddd",
"key": "dddd",
"value": ""
}
]
```
| How to check all variable are same in multi lined Array in Flutter? | CC BY-SA 4.0 | 0 | 2021-05-31T08:13:49.813 | 2021-05-31T08:22:33.230 | null | null | 14,221,638 | [
"arrays",
"flutter",
"dart",
"mobile-development"
] |
67,874,896 | 1 | 67,875,089 | null | 1 | 1,773 | I have read dozens of stack overflow posts about `TextOverflow.ellipsis` not working, and pretty much every single one just said "Wrap it in an Expanded widget"
That is not working. I have tried putting the Expanded widget around the Text widget, the Row Widget, the Container Widget...nothing is working. As soon as I add the Expanded Widget, I get an error because there is already an Expanded Widget for the
PLEASE HELP. I'm gonna lose my mind. The only "solution" I've found is to do a set width on a Container right around the Text Widget, which is not what I want since I want the Text Container to be flexible to the screen size.
Error:
```
RenderBox was not laid out: RenderConstrainedBox#96e5e relayoutBoundary=up3 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart': Failed assertion: line 1930 pos 12: 'hasSize'
```
Code:
```
Expanded(
child: Container(
padding: EdgeInsets.fromLTRB(_centeredPadding, _paddingTop, 0, 24),
child: Row(
mainAxisAlignment: center ? MainAxisAlignment.center : MainAxisAlignment.spaceBetween,
crossAxisAlignment: size == 'mobile' ? CrossAxisAlignment.start : CrossAxisAlignment.center,
children: [
Row(
children: [
Container(
margin: EdgeInsets.only(right: 15),
child: ClipRRect(
borderRadius: BorderRadius.circular(100),
child: Image(
width: _iconSize,
image: AssetImage('assets/images/users/user-3.png'),
),
),
),
Text(
'Really long name does not fit',
overflow: TextOverflow.ellipsis,
style: textStyle,
),
],
),
IconButton(
icon: Icon(Icons.settings),
padding: EdgeInsets.only(left: 14, right: 16),
onPressed: () {
Navigator.pushNamed(context, 'home/settings');
},
),
],
),
),
);
```
And just to reiterate, this is not the solution:
```
Expanded(
child: Text(
'Really long name does not fit',
overflow: TextOverflow.ellipsis,
style: textStyle,
),
),
```
[Picture of the non-working code](https://i.stack.imgur.com/XAajw.png)
[What I wish it looked like](https://i.stack.imgur.com/P4AzU.png)
| TextOverflow.ellipsis not working even inside expanded | CC BY-SA 4.0 | null | 2021-06-07T15:56:05.967 | 2021-06-07T16:08:36.027 | 2021-06-07T16:06:58.917 | 11,963,418 | 11,963,418 | [
"flutter",
"dart",
"widget",
"mobile-development"
] |
67,888,738 | 1 | null | null | 0 | 108 |
rv = (RecyclerView) findViewById (R.id.recyclerview);
```
LinearLayoutManager linearLayoutManager = new LinearLayoutManager (this, LinearLayoutManager.VERTICAL ,false);
CustomRVAdapter customRVAdapter = new CustomRVAdapter (getApplicationContext (),R.layout.custom_rv_row,new StudentList ().getDefaultStudentList ());
rv.setAdapter (customRVAdapter);
```
Accessing hidden method Landroid/os/Trace;->traceCounter(JLjava/lang/String;I)V (light greylist, reflection)
E/RecyclerView: No layout manager attached; skipping layout
I/le.assignment_: ProcessProfilingInfo new_methods=1577 is saved saved_to_disk=1 resolve_classes_delay=8000
| No layout manager attached; Skipping layout | CC BY-SA 4.0 | null | 2021-06-08T14:11:01.407 | 2021-06-08T14:14:04.380 | null | null | 9,557,169 | [
"java",
"android",
"mobile-application",
"mobile-development"
] |
67,948,246 | 1 | null | null | 0 | 201 | I currently learn React and I want to learn Mobile Development too. I do not want to learn Swift,Java or Kotlin. I want Flutter or React Native. Which one to choose and why?
| React Native or Flutter? | CC BY-SA 4.0 | null | 2021-06-12T11:08:49.570 | 2021-06-12T11:17:44.490 | null | null | 15,160,607 | [
"react-native",
"flutter",
"mobile-development"
] |
67,964,605 | 1 | null | null | 0 | 52 | It is my first time learning how to use android studio and I get this Installation error.
[Error Image](https://i.stack.imgur.com/n5yzy.png)
components are not installed.
I have tried installing it manually and have the files extracted on google_apis but it is not working, I have also tried deleting the folders wherein the installation takes place but no luck for me, can someone help.
| Android Studio Component Installation Failed | CC BY-SA 4.0 | null | 2021-06-14T03:52:45.410 | 2021-06-15T01:10:44.980 | null | null | 16,195,156 | [
"android",
"android-studio",
"mobile",
"sdk",
"mobile-development"
] |
67,991,022 | 1 | null | null | 5 | 22,914 | I am currently learning android development via the course provided by MeiCode. So far the course has been excellent and I am really getting it. However, I have come to a point where the course is a little outdated. I following a tutorial where he shows how to request camera permissions and then use the camera to snap a photo. However, when I type the code to open the camera via an intent and the startActivityForResult method, Android Studio informs me that it is deprecated and that I should use registerForActivityResult. This wouldnt be a big deal if not for the fact that I am a newbie and the documentation for the method isn't exactly newbie friendly imo. And I couldnt find any videos covering the method in Java (all of them show how to use it in Kotlin). So I am here asking if someone can refer to me an easy to follow guide or video, or do an ELI5 explanation of how to use the method for my purpose. Here is the code I have written so far:
```
package com.example.myapplication;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.provider.MediaStore;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
private static final int CAMERA_PERMISSION_CODE = 101;
private static final int CAMERA_INTENT_RESULT_CODE = 102;
private Button button;
private ImageView image;
private RelativeLayout parent;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
button = findViewById(R.id.button);
image = findViewById(R.id.image);
parent = findViewById(R.id.parent);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
handlePermission();
}
});
}
private void handlePermission() {
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) {
// openCamera();
Toast.makeText(this, "You have permission to use the camera!", Toast.LENGTH_SHORT).show();
} else {
if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.CAMERA)) {
showSnackBar();
} else {
ActivityCompat.requestPermissions(this, new String[] {Manifest.permission.CAMERA}, CAMERA_PERMISSION_CODE);
}
}
}
private void showSnackBar() {
}
private void openCamera() {
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent, CAMERA_INTENT_RESULT_CODE);
}
}
```
How can I use the new method to accomplish this task instead of the deprecated method? All help is much appreciated.
| startActivityForResult() is deprecated, use registerForActivityResult() | CC BY-SA 4.0 | 0 | 2021-06-15T17:33:15.063 | 2021-06-28T16:53:28.363 | 2021-06-15T21:10:44.160 | 9,851,608 | 13,936,354 | [
"java",
"android",
"mobile-development"
] |
67,996,616 | 1 | 67,997,126 | null | 0 | 220 | I'm trying to put an image on that press location when I click somewhere, but I'm running into an error. When I click an already existing sticker, it gets the coordinates of the on press relative to the sticker, so if I clicked on the top left of my already existing sticker, it would just be in the top left of the screen. why is this happening? Here is my code
```
<TouchableOpacity
activeOpacity={1}
onPress={(event: GestureResponderEvent) => {
const { locationX: x, locationY: y } = event.nativeEvent;
setStickers(stickers.concat({ x, y }));
console.log("X: " + x);
console.log("Y: " + y);
}}
style={styles.imageButton}>
<Image style={styles.fullImage} source={{ uri }} />
{stickers.map((sticker, index) => {
return (
<Image
source={stickerImage}
style={{
width: 100,
height: 100,
position: "absolute",
top: sticker.y,
left: sticker.x,
}}
key={index}
/>
);
})}
</TouchableOpacity>
```
| React Native On Press Not Working As Expected | CC BY-SA 4.0 | null | 2021-06-16T05:01:31.817 | 2021-06-16T05:59:02.873 | 2021-06-16T05:15:42.990 | 4,423,695 | 13,691,066 | [
"javascript",
"reactjs",
"react-native",
"mobile-development",
"onpress"
] |
68,006,284 | 1 | null | null | 0 | 786 | I install this react-native-instagram-login package which contain react-native-webview this package so I want to uninstall react-native-webview this one because I already installed it in my react native project and its give me error -> Tried to register two views with the same name RNCWebView.
| How to uninstall npm package which is inside onother npm package | CC BY-SA 4.0 | null | 2021-06-16T16:02:34.070 | 2021-06-16T16:21:42.350 | null | null | 14,389,621 | [
"javascript",
"react-native",
"mobile-development",
"react-native-instagram-login"
] |
68,118,315 | 1 | null | null | 1 | 130 | I'm very new to mobile app development, and though I've settled on using Svelte-Native at this point, I was considering various frameworks a couple of weeks ago (React Native and Kivy). Svelte-Native's, [Your First App](https://svelte-native.technology/tutorial), was the first tutorial I tried, and at that time everything worked just fine. I then looked at React Native and finally considered [Kivy](https://kivy.org/#home). I never ended up getting Kivy to work, but that in it of itself is fine – I'm not going to use it for the time being. However, while I was trying to get Kivy to work, I had to tinker around a lot in Xcode's settings. My suspicion is that it threw some sort of configuration on such a low level, that it's affecting NS Preview and NS Playground.
When I run, `ns preview`, the QR code displays just fine, but then when I scan my it with my iPhone 12, and I get an error log both in my terminal and on my phone.
```
LOG from device Peter’s iPhone: CONSOLE WARN file:///app/tns_modules/@nativescript/core/ui/tab-view/tab-view.js:17:14: Objective-C class name "UITabBarControllerImpl" is already in use - using "UITabBarControllerImpl1" instead.
CONSOLE WARN file:///app/tns_modules/@nativescript/core/ui/tab-view/tab-view.js:78:14: Objective-C class name "UITabBarControllerDelegateImpl" is already in use - using "UITabBarControllerDelegateImpl1" instead.
CONSOLE WARN file:///app/tns_modules/@nativescript/core/ui/tab-view/tab-view.js:116:14: Objective-C class name "UINavigationControllerDelegateImpl" is already in use - using "UINavigationControllerDelegateImpl1" instead.
CONSOLE INFO file:///app/vendor.js:38:36: HMR: Hot Module Replacement Enabled. Waiting for signal.
2021-06-24 10:46:32.720 nsplaydev[20450:7282202] PlayLiveSync: applicationDidFinishLaunching
CONSOLE LOG file:///app/vendor.js:5722:24: Application Launched
CONSOLE ERROR file:///app/vendor.js:3057:16: [HMR][Svelte] Unrecoverable error in <App>: next update will trigger a full reload
2021-06-24 10:46:32.729 nsplaydev[20450:7282202] ***** Fatal JavaScript exception - application has been terminated. *****
2021-06-24 10:46:32.729 nsplaydev[20450:7282202] Native stack trace:
1 0x105916348 NativeScript::reportFatalErrorBeforeShutdown(JSC::ExecState*, JSC::Exception*, bool)
2 0x105950434 NativeScript::FFICallback<NativeScript::ObjCMethodCallback>::ffiClosureCallback(ffi_cif*, void*, void**, void*)
3 0x1064bb388 ffi_closure_SYSV_inner
4 0x1064bc1b4 .Ldo_closure
5 0x1963ad6d4 <redacted>
6 0x1963ad67c <redacted>
7 0x1963acbe8 <redacted>
8 0x1963ac5a8 _CFXNotificationPost
9 0x1976b16ac <redacted>
10 0x198e3e370 <redacted>
11 0x198e44388 <redacted>
12 0x198497c98 <redacted>
13 0x198a00f58 _UIScenePerformActionsWithLifecycleActionMask
14 0x198498830 <redacted>
15 0x1984982f0 <redacted>
16 0x198498640 <redacted>
17 0x198497e7c <redacted>
18 0x1984a03c0 <redacted>
19 0x19890e970 <redacted>
20 0x198a19d68 _UISceneSettingsDiffActionPerformChangesWithTransitionContext
21 0x1984a00b8 <redacted>
22 0x1982c7fa0 <redacted>
23 0x1982c6920 <redacted>
24 0x1982c7bc8 <redacted>
25 0x198e42528 <redacted>
26 0x198937fd0 <redacted>
27 0x1a59e45d8 <redacted>
28 0x1a5a0fd44 <redacted>
29 0x1a59f36a4 <redacted>
30 0x1a5a0fa0c <redacted>
31 0x19603f81c <redacted>
2021-06-24 10:46:32.731 nsplaydev[20450:7282202] JavaScript stack trace:
2021-06-24 10:46:32.731 nsplaydev[20450:7282202] create_fragment(file:///app/bundle.js:290:17)
at init(file:///app/vendor.js:7356:52)
at App(file:///app/bundle.js:373:63)
at createProxiedComponent(file:///app/vendor.js:3622:22)
at ProxyComponent(file:///app/vendor.js:3239:92)
at file:///app/vendor.js:3298:16
at resolveComponentElement(file:///app/vendor.js:5529:36)
at navigate(file:///app/vendor.js:5542:60)
at create(file:///app/vendor.js:5729:89)
at file:///app/tns_modules/@nativescript/core/ui/builder/builder.js:18:36
at createRootView(file:///app/tns_modules/@nativescript/core/application/application.js:292:61)
at file:///app/tns_modules/@nativescript/core/application/application.js:243:38
at file:///app/tns_modules/@nativescript/core/application/application.js:174:34
at file:///app/tns_modules/@nativescript/core/application/application.js:163:30
at [native code]
at file:///app/tns_modules/@nativescript/core/application/application.js:36:32
at UIApplicationMain([native code])
at run(file:///app/tns_modules/@nativescript/core/application/application.js:312:26)
at file:///app/vendor.js:5726:87
at initializePromise([native code])
at Promise([native code])
at svelteNative(file:///app/vendor.js:5719:23)
at file:///app/bundle.js:459:67
at ./app.ts(file:///app/bundle.js:472:34)
at __webpack_require__(file:///app/runtime.js:817:34)
at checkDeferredModules(file:///app/runtime.js:44:42)
at webpackJsonpCallback(file:///app/runtime.js:31:39)
at anonymous(file:///app/bundle.js:2:61)
at evaluate([native code])
at moduleEvaluation([native code])
at [native code]
at asyncFunctionResume([native code])
at [native code]
at promiseReactionJob([native code])
2021-06-24 10:46:32.731 nsplaydev[20450:7282202] JavaScript error:
file:///app/bundle.js:290:17: JS ERROR ReferenceError: Can't find variable: Page
2021-06-24 10:46:32.732 nsplaydev[20450:7282202] PlayLiveSync: Uncaught Exception
2021-06-24 10:46:32.732 nsplaydev[20450:7282202] *** JavaScript call stack:
(
0 UIApplicationMain@[native code]
1 run@file:///app/tns_modules/@nativescript/core/application/application.js:312:26
2 @file:///app/vendor.js:5726:87
3 initializePromise@:1:11
4 Promise@[native code]
5 svelteNative@file:///app/vendor.js:5719:23
6 @file:///app/bundle.js:459:67
7 ./app.ts@file:///app/bundle.js:472:34
8 __webpack_require__@file:///app/runtime.js:817:34
9 checkDeferredModules@file:///app/runtime.js:44:42
10 webpackJsonpCallback@file:///app/runtime.js:31:39
11 anonymous@file:///app/bundle.js:2:61
12 evaluate@[native code]
13 moduleEvaluation@:1:11
14 @:2:1
15 asyncFunctionResume@:1:11
16 @:24:9
17 promiseReactionJob@:1:11
)
2021-06-24 10:46:32.732 nsplaydev[20450:7282202] *** Terminating app due to uncaught exception 'NativeScript encountered a fatal error: ReferenceError: Can't find variable: Page
at
create_fragment(file:///app/bundle.js:290:17)
at init(file:///app/vendor.js:7356:52)
at App(file:///app/bundle.js:373:63)
at createProxiedComponent(file:///app/vendor.js:3622:22)
at ProxyComponent(file:///app/vendor.js:3239:92)
at file:///app/vendor.js:3298:16
at resolveComponentElement(file:///app/vendor.js:5529:36)
at navigate(file:///app/vendor.js:5542:60)
at create(file:///app/vendor.js:5729:89)
at file:///app/tns_modules/@nativescript/core/ui/builder/builder.js:18:36
at createRootView(file:///app/tns_modules/@nativescript/core/application/application.js:292:61)
at file:///app/tns_modules/@nativescript/core/application/application.js:243:38
at file:///app/tns_modules/@nativescript/core/application/application.js:174:34
at file:///app/tns_modules/@nativescript/core/application/application.js:163:30
at [native code]
at file:///app/tns_modules/@nativescript/core/application/application.js:36:32
at UIApplicationMain([native code])
at run(file:///app/tns_modules/@nativescript/core/application/application.js:312:26)
at file:///app/vendor.js:5726:87
at initializePromise([native code])
at Promise([native code])
at svelteNative(file:///app/vendor.js:5719:23)
at file:///app/bundle.js:459:67
at ./app.ts(file:///app/bundle.js:472:34)
at __webpack_require__(file:///app/runtime.js:817:34)
at checkDeferredModules(file:///app/runtime.js:44:42)
at webpackJsonpCallback(file:///app/runtime.js:31:39)
at anonymous(file:///app/bundle.js:2:61)
at evaluate([native code])
at moduleEvaluation([native code])
at [native code]
at asyncFunctionResume([native code])
at [native code]
at promiseReactionJob([native code])
', reason: '(null)'
*** First throw call stack:
(0x196452754 0x1aaf197a8 0x105916820 0x105950434 0x1064bb388 0x1064bc1b4 0x1963ad6d4 0x1963ad67c 0x1963acbe8 0x1963ac5a8 0x1976b16ac 0x198e3e370 0x198e44388 0x198497c98 0x198a00f58 0x198498830 0x1984982f0 0x198498640 0x198497e7c 0x1984a03c0 0x19890e970 0x198a19d68 0x1984a00b8 0x1982c7fa0 0x1982c6920 0x1982c7bc8 0x198e42528 0x198937fd0 0x1a59e45d8 0x1a5a0fd44 0x1a59f36a4 0x1a5a0fa0c 0x19603f81c 0x19604330c 0x1a5a37fa0 0x1a5a37c30 0x1a5a38184 0x1963cc9e8 0x1963cc8e4 0x1963cbbe8 0x1963c5bc8 0x1963c5360 0x1ada03734 0x198e40584 0x198e45df4 0x1064bc044 0x1064baae8 0x1064ba648 0x1058d93d8 0x106487b10 0x106484f28 0x106484f28 0x106484f28 0x1064665e8 0x105a14e48 0x1061c0df0 0x1061c1478 0x106487ca8 0x106485ed4 0x106484f28 0x106484f28 0x106484f28 0x106484f28 0x106484e80 0x106484f28 0x1064665e8 0x105a14e48 0x1062b8cb4 0x1058f18f4 0x1061899d0 0x1064877cc 0x106484f28 0x106484f28 0x106484f28 0x106484e80 0x106484f28 0x1064665e8 0x105a14e48 0x1062b8e50 0x106182d9c 0x1058e7304 0x105960350 0x1069b225c 0x104dff524 0x196081cf8)
libc++abi: terminating with uncaught exception of type NSException
2021-06-24 10:46:32.732 nsplaydev[20450:7282202] PlayLiveSync: Uncaught Exception
```
How can I resolve this?
Any help would be very appreciated. Thank you in advance.
| How do I resolve a CONSOLE WARN with "UITabBarControllerImpl" in NS Preview after tweaking Xcode settings? | CC BY-SA 4.0 | null | 2021-06-24T15:06:52.947 | 2021-06-28T01:33:11.253 | 2021-06-28T01:33:11.253 | 1,712,343 | 4,615,162 | [
"nativescript",
"hybrid-mobile-app",
"mobile-development",
"svelte-native"
] |
68,147,223 | 1 | null | null | 0 | 315 | I am trying to find my connected devices via the BluetoothManager class as I read on developer.android.com. I used the line below to obtain a list of connected devices:
```
System.out.println(bluetoothManager.getConnectedDevices(BluetoothGatt.GATT).toString());
```
However, it is just returning an empty array. I gave my app Bluetooth and Bluetooth_Admin permissions in the manifest file, so I dont think there are any problems with permissions.
How can I get this to work?
| BluetoothManager.getConnectedDevices is not finding any devices | CC BY-SA 4.0 | null | 2021-06-27T00:56:52.970 | 2021-11-13T11:11:57.670 | null | null | 13,936,354 | [
"java",
"android",
"android-studio",
"mobile-development"
] |
68,191,570 | 1 | null | null | 0 | 1,307 | ```
import React, { useState } from 'react'
import { Text, View, StyleSheet, Image, TouchableOpacity, Platform } from 'react-native'
import HeaderComponent from '../../components/HeaderComponent'
import NavigationFooter from '../../components/NavigationFooter'
const ReportScreen = () => {
return (
<View style={styles.viewcontainer}>
<HeaderComponent title="Taak" />
<Text style={styles.subtext}>Selecteer het taak type</Text>
```
I want to change the image `onPress` in the `TouchableOpacity` below, but I don't know how to do that with `useState`
```
<TouchableOpacity>
<View style={styles.graycontainer}>
<Image style={styles.grayimg} source={require('../../../assets/report/gray.png')} />
<Text style={styles.graytext}>Grijs</Text>)
</View>
</TouchableOpacity>
</View>
)
}
```
| Image change onPress in React native | CC BY-SA 4.0 | null | 2021-06-30T08:56:36.873 | 2021-07-01T11:06:42.903 | 2021-07-01T11:06:42.903 | 2,753,501 | 15,536,752 | [
"javascript",
"reactjs",
"react-native",
"react-hooks",
"mobile-development"
] |
68,206,219 | 1 | null | null | 0 | 478 | I'm new to Flutter and learning it continuously.
I'm currently imitating a counter app for learning and I'm almost done with it, but there is something I tried to do it through many solutions I found on other posts here but they all did not work.
I'm trying to make a pop up dialog box that pops up after tapping on the yellow circle in the follwoing screenshot:
[](https://i.stack.imgur.com/wQkbM.jpg)
And the dialog box should be similar to this:
[](https://i.stack.imgur.com/hQe5j.jpg)
Hope someone can help in this.
Here is the code that I'm working on it:
```
import 'package:floating_counter/constants.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:page_transition/page_transition.dart';
import 'main.dart';
void main() => runApp(NewCounter());
class NewCounter extends StatefulWidget {
@override
_NewCounterState createState() => _NewCounterState();
}
class _NewCounterState extends State<NewCounter> {
final FocusNode textNode = FocusNode();
final FocusNode numberNode = FocusNode();
TextStyle labelStyle;
TextStyle numberStyle;
@override
void initState() {
super.initState();
textNode.addListener(onFocusChange);
}
void onFocusChange() {
setState(() {
labelStyle = textNode.hasFocus ? TextStyle(color: kMainColor) : null;
});
setState(() {
numberStyle = numberNode.hasFocus ? TextStyle(color: kMainColor) : null;
});
}
@override
void dispose() {
textNode.removeListener(onFocusChange);
super.dispose();
}
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
appBar: AppBar(
backgroundColor: kMainColor,
leading: IconButton(
icon: Icon(
Icons.close,
color: Colors.black,
),
onPressed: () {
setState(() {
Navigator.push(
context,
PageTransition(
type: PageTransitionType.rightToLeft,
duration: Duration(milliseconds: 500),
child: CountNumbering(),
),
);
});
}),
title: Text(
'New Counter',
style: TextStyle(
color: Colors.black,
),
),
actions: [
IconButton(
icon: Image.asset(
'assets/images/floppy-disk.png',
width: 20.0,
height: 20.0,
),
onPressed: () {
setState(() {
Navigator.pop(context);
});
}),
],
),
body: Container(
child: Column(
children: [
Column(
children: [
Padding(
padding: const EdgeInsets.only(
left: 15.0, top: 15.0, right: 15.0, bottom: 0.0),
child: TextFormField(
focusNode: textNode,
cursorColor: kMainColor,
decoration: InputDecoration(
filled: true,
fillColor: Color(0xFFE0E0E0),
labelText: 'Name',
labelStyle: labelStyle,
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Color(0xFF5A5A5A),
),
),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: kMainColor,
),
),
),
),
),
Padding(
padding: const EdgeInsets.only(
left: 15.0, top: 0.0, right: 15.0, bottom: 15.0),
child: TextFormField(
focusNode: numberNode,
keyboardType: TextInputType.number,
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.digitsOnly
],
cursorColor: kMainColor,
decoration: InputDecoration(
filled: true,
fillColor: Color(0xFFE0E0E0),
labelText: 'Start value',
labelStyle: numberStyle,
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Color(0xFF5A5A5A),
),
),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: kMainColor,
),
),
),
),
),
],
),
SizedBox(
height: 10.0,
),
Row(
children: [
SizedBox(
width: 33.0,
),
Text(
'Select a Color',
style: TextStyle(
fontSize: 16.0,
),
),
SizedBox(
width: 10.0,
),
Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
boxShadow: [
BoxShadow(
color: Colors.black54,
spreadRadius: 2,
blurRadius: 2,
// changes position of shadow
),
],
),
child: RaisedButton(
child: Padding(
padding: EdgeInsets.all(40.0),
),
onPressed: () {},
shape: CircleBorder(),
color: kMainColor,
),
),
],
),
],
),
),
),
);
}
}
```
| Need to make a pop up dialog box in Flutter | CC BY-SA 4.0 | null | 2021-07-01T07:44:33.053 | 2021-07-01T09:18:34.463 | null | null | 11,878,615 | [
"android",
"flutter",
"dart",
"mobile",
"mobile-development"
] |
68,246,239 | 1 | null | null | 0 | 615 | I am making an app that communicates with a PC via Bluetooth. Right now I am working on a worker class entitled BluetoothCommWorker that is contained within my class for Connect PC's entitled ConnectedPC. I created the worker and enqueued it according to the Android documentation. However, when I try to enqueue it, I get the output and error:
```
W/WM-WorkSpec: Interval duration lesser than minimum allowed value; Changed to 900000
E/WM-WorkerFactory: Could not instantiate com.example.app.ConnectedPC$BluetoothCommWorker
java.lang.NoSuchMethodException: com.example.app.ConnectedPC$BluetoothCommWorker.<init> [class android.content.Context, class androidx.work.WorkerParameters]
at java.lang.Class.getConstructor0(Class.java:2332)
at java.lang.Class.getDeclaredConstructor(Class.java:2170)
at androidx.work.WorkerFactory.createWorkerWithDefaultFallback(WorkerFactory.java:95)
at androidx.work.impl.WorkerWrapper.runWorker(WorkerWrapper.java:244)
at androidx.work.impl.WorkerWrapper.run(WorkerWrapper.java:136)
at androidx.work.impl.utils.SerialExecutor$Task.run(SerialExecutor.java:91)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
E/WM-WorkerWrapper: Could not create Worker com.example.app.ConnectedPC$BluetoothCommWorker
```
Here is my code:
```
package com.example.app;
import android.bluetooth.BluetoothDevice;
import android.content.Context;
import android.os.SystemClock;
import androidx.annotation.NonNull;
import androidx.work.Constraints;
import androidx.work.Data;
import androidx.work.PeriodicWorkRequest;
import androidx.work.WorkManager;
import androidx.work.Worker;
import androidx.work.WorkerParameters;
import java.util.concurrent.TimeUnit;
public class ConnectedPC {
private final BluetoothDevice BLUETOOTH_DEVICE;
private boolean isActivePC;
private PeriodicWorkRequest periodicWorkRequest;
public ConnectedPC(BluetoothDevice bluetoothDevice) {
this.BLUETOOTH_DEVICE = bluetoothDevice;
}
public String getName() {
return BLUETOOTH_DEVICE.getName();
}
public boolean isActivePC() {
return isActivePC;
}
public void setActivePC(boolean activeDevice) {
isActivePC = activeDevice;
}
public String getAddress() {
return BLUETOOTH_DEVICE.getAddress();
}
public void initWork(Context context) {
Constraints constraints = new Constraints.Builder().build();
periodicWorkRequest = new PeriodicWorkRequest.Builder(
BluetoothCommWorker.class,
5,
TimeUnit.SECONDS
).setConstraints(constraints)
.setInitialDelay(2, TimeUnit.SECONDS)
.addTag(String.format("%s: BluetoothCommWorker", BLUETOOTH_DEVICE.getName()))
.build();
WorkManager.getInstance(context).enqueue(periodicWorkRequest);
}
public class BluetoothCommWorker extends Worker {
public BluetoothCommWorker(@NonNull Context context,
@NonNull WorkerParameters workerParams) {
super(context, workerParams);
}
@NonNull
@Override
public Result doWork() {
try {
for (int i = 0; i < 10; i++) {
System.out.println(BLUETOOTH_DEVICE.getName() + ": " + i);
SystemClock.sleep(1000);
}
} catch (Exception e) {
e.printStackTrace();
return Result.failure();
}
return Result.retry();
}
}
}
```
The doWork function just contains a dummy for-loop because I am wanting to get the worker code working first before I actually work on the work code. Any ideas on a fix?
| Could not instantiate Worker | CC BY-SA 4.0 | null | 2021-07-04T15:28:54.460 | 2021-07-05T09:37:23.513 | null | null | 13,936,354 | [
"java",
"android",
"android-studio",
"mobile",
"mobile-development"
] |
68,327,205 | 1 | 68,327,489 | null | 1 | 570 | I'm new to swift programming and I'm trying to disable the save button until all other required buttons are selected, but when I try to do that with the button.isEnabled = false, it doesn't change even when all the buttons are selected. here is a sample code:
```
func disableButton () {
if firstButton.isSelected && rightButton.isSelected {
saveButton.isEnabled = true
} else {
saveButton.isEnabled = false
}
}
```
when I remove the last line the save button works but when I put it back it's disabled even when the two other buttons are selected.
| UIButton is disabled - Swift | CC BY-SA 4.0 | null | 2021-07-10T11:18:54.190 | 2021-07-10T12:05:09.800 | 2021-07-10T11:31:52.967 | 8,160,613 | 16,419,838 | [
"ios",
"swift",
"xcode",
"mobile-development"
] |
68,334,638 | 1 | null | null | 1 | 340 | I am new with flutter.
I would like to custom a search widget on SliverAppBar.
On scroll up, I would like it show this search widget with a flexible to nearly cart button as show in pictures.
```
final expandedHeight = 150.0;
@override
Widget build(BuildContext context) {
final products = Provider.of<ProductProvider>(context).products;
return Scaffold(
key: _scaffoldKey,
drawer: CuzAppDrawer(),
body: NestedScrollView(
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
return <Widget>[
SliverAppBar(
expandedHeight: expandedHeight,
floating: false,
pinned: true,
flexibleSpace: FlexibleSpaceBar(
centerTitle: true,
title: GestureDetector(
onTap: () => null,
child: Padding(
padding:
EdgeInsets.symmetric(horizontal: paddingThemeScreen()),
child: Container(
height: 30,
decoration: BoxDecoration(
color: nearlyWhite,
borderRadius: BorderRadius.circular(24),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const SizedBox(width: 10),
const Icon(Feather.search,
color: Colors.grey, size: 15),
const SizedBox(width: 5),
Text("Search product",
style: TextStyle(
color: Colors.grey,
fontSize: 12,
fontWeight: FontWeight.w200))
],
)),
),
),
background: Image.network(
"image-url",
fit: BoxFit.cover,
),
),
),
];
},
```
Result
[](https://i.stack.imgur.com/Hyo3j.jpg)
Expected result
[](https://i.stack.imgur.com/Gsw9z.jpg)
| How to custom search bar on SliverAppBar flutter | CC BY-SA 4.0 | null | 2021-07-11T08:48:24.553 | 2022-11-01T13:16:39.903 | 2021-07-11T09:12:20.563 | 4,420,967 | 16,421,353 | [
"flutter-layout",
"flutter-animation",
"mobile-development",
"sliverappbar",
"flutter-sliverappbar"
] |
68,342,355 | 1 | 68,342,581 | null | 0 | 72 | It's a weird issue, I still cannot understand the issue,
Basically have a node like this
```
+ likes
+ posts
... (etc.)
```
Did a simple firebase update on likes node
```
DatabaseReference postNode = _rootNode.GetChild("likes").GetChildByAutoId();
var dict = new NSDictionary("examplekey" : "exampledata");
postNode.SetValue<NSDictionary>(dict);
```
The firebase realtime database behaved weirdly as I observed, just immediately after the SetValue called, the NOSQL nodes lights up with green updates, and then it lights up with red updates and deleted all datas inside node.
No where else I have seen discussed about this issue.
After I changed the node key from "likes" to "Likes", it behaves normally.
What is going wrong with Firebase? I don't think I made any mistake elsewhere.
| Firebase node unexpectedly delete itself after a update value on node in iOS | CC BY-SA 4.0 | null | 2021-07-12T05:37:32.283 | 2021-07-12T06:04:32.453 | null | null | 13,283,744 | [
"firebase-realtime-database",
"xamarin.ios",
"mobile-development"
] |
68,353,983 | 1 | null | null | 1 | 517 | I am developing an android app that requires a foreground service to sync data over bluetooth with computers. The foreground service works perfectly during the session where it is first run by the app. However, if I restart my phone, the service will not restart upon reboot, despite me returning START_STICKY within the onStartCommand function. I want it to start as soon as possible upon reboot just like my VPN does. How can I achieve this functionality?
Here is the code in question:
```
package com.example.app;
import android.app.Service;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothClass;
import android.bluetooth.BluetoothDevice;
import android.content.Intent;
import android.os.IBinder;
import androidx.annotation.Nullable;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Set;
import static com.example.app.App.CONNECTED_DEVICES_CHANNEL_ID;
public class BluetoothSyncService extends Service {
private Utils utils;
private final BluetoothAdapter BLUETOOTH_ADAPTER = BluetoothAdapter.getDefaultAdapter();
private final String CONNECTED_PC_GROUP = "connectedPCS";
private final ArrayList<String> NOTIFIED_PC_ADDRESSES = new ArrayList<>();
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
utils = Utils.getInstance(this);
NotificationCompat.Builder summaryNotificationBuilder =
new NotificationCompat.Builder(this,
CONNECTED_DEVICES_CHANNEL_ID)
.setSmallIcon(R.drawable.ic_placeholder_logo)
.setContentTitle("Sync Service Background")
.setGroup(CONNECTED_PC_GROUP)
.setGroupSummary(true)
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setOngoing(true);
int SUMMARY_NOTIFICATION_ID = 69;
startForeground(SUMMARY_NOTIFICATION_ID, summaryNotificationBuilder.build());
Thread serviceThread = new Thread(() -> {
while (true) {
handleConnectedDevices();
handleNotifications();
}
});
serviceThread.start();
return START_STICKY;
}
@Nullable
@Override
public IBinder onBind(Intent intent) {
return null;
}
private void handleConnectedDevices() {
Set<BluetoothDevice> pairedDevices = BLUETOOTH_ADAPTER.getBondedDevices();
// Handle connected PCS
for (BluetoothDevice device : pairedDevices) {
if (isConnected(device.getAddress())) {
int deviceClass = device.getBluetoothClass().getDeviceClass();
if (deviceClass == BluetoothClass.Device.COMPUTER_LAPTOP |
deviceClass == BluetoothClass.Device.COMPUTER_DESKTOP) {
if (!utils.inPairedPCS(device.getAddress())) {
utils.addToPairedPCS(new PairedPC(device.getName(),
device.getAddress(), true));
} else {
if (utils.getPairedPCByAddress(device.getAddress()) != null) {
utils.getPairedPCByAddress(device.getAddress()).setConnected(true);
utils.savePairedPCSToDevice();
}
}
}
} else {
if (utils.inPairedPCS(device.getAddress())) {
if (utils.getPairedPCByAddress(device.getAddress()) != null) {
utils.getPairedPCByAddress(device.getAddress()).setConnected(false);
utils.savePairedPCSToDevice();
}
}
}
}
}
private void handleNotifications() {
NotificationManagerCompat notificationManager = NotificationManagerCompat
.from(this);
for (PairedPC pairedPC : utils.getPairedPCS()) {
int CONNECTION_NOTIFICATION_ID = 420;
if (pairedPC.isConnected()) {
if (pairedPC.isActive() && !NOTIFIED_PC_ADDRESSES.contains(pairedPC.getAddress())) {
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(
this, CONNECTED_DEVICES_CHANNEL_ID)
.setSmallIcon(R.drawable.ic_pc)
.setContentTitle("Syncing PC")
.setContentText(pairedPC.getName())
.setGroup(CONNECTED_PC_GROUP)
.setPriority(NotificationCompat.PRIORITY_MIN)
.setOngoing(true);
notificationManager.notify(pairedPC.getAddress(),
CONNECTION_NOTIFICATION_ID, notificationBuilder.build());
NOTIFIED_PC_ADDRESSES.add(pairedPC.getAddress());
} else if (!pairedPC.isActive()) {
notificationManager.cancel(pairedPC.getAddress(), CONNECTION_NOTIFICATION_ID);
NOTIFIED_PC_ADDRESSES.remove(pairedPC.getAddress());
}
} else {
if (NOTIFIED_PC_ADDRESSES.contains(pairedPC.getAddress())) {
notificationManager.cancel(pairedPC.getAddress(), CONNECTION_NOTIFICATION_ID);
NOTIFIED_PC_ADDRESSES.remove(pairedPC.getAddress());
}
}
}
}
private boolean isConnected(String address) {
Set<BluetoothDevice> pairedDevices = BLUETOOTH_ADAPTER.getBondedDevices();
for (BluetoothDevice device : pairedDevices) {
if (device.getAddress().equals(address)) {
Method method = null;
try {
method = device.getClass().getMethod("isConnected", (Class[]) null);
} catch (NoSuchMethodException e) {
e.printStackTrace();
}
boolean connected = false;
try {
assert method != null;
Object methodInvocation = method.invoke(device, (Object[]) null);
if (methodInvocation != null) {
connected = (boolean) methodInvocation;
} else {
connected = false;
}
} catch (IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}
return connected;
}
}
return false;
}
}
```
EDIT:
So I have tried using a broadcast receiver as suggested. Yet it is still not working. Here is the code for the receiver:
```
package com.example.app;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
public class BootReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
Intent syncServiceIntent = new Intent(context, BluetoothSyncService.class);
context.startService(syncServiceIntent);
}
}
}
```
And here is my manifest:
```
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.app">
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.READ_CALL_LOG" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<application
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:name=".App"
android:theme="@style/Theme.App">
<receiver android:name=".BootReceiver" android:enabled="true" android:exported="true">
<intent-filter>
<category android:name="android.intent.category.DEFAULT"/>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<action android:name="android.intent.action.QUICKBOOT_POWERON"/>
<action android:name="com.htc.intent.action.QUICKBOOT_POWERON"/>
</intent-filter>
</receiver>
<activity android:name=".PermissionsActivity" />
<activity android:name=".MainActivity" />
<activity android:name=".StartupActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name=".BluetoothSyncService"/>
</application>
</manifest>
```
EDIT 2:
SOLVED! Had to change context.startService(syncServiceIntent); to context.startForegroundService(syncServiceIntent);
| Foreground Service not being started on reboot | CC BY-SA 4.0 | null | 2021-07-12T21:19:02.343 | 2021-07-13T00:00:09.173 | 2021-07-13T00:00:09.173 | 13,936,354 | 13,936,354 | [
"java",
"android",
"android-studio",
"mobile",
"mobile-development"
] |
68,363,755 | 1 | 68,364,291 | null | 0 | 343 | I'm trying to parse an array of JSON Objects to populate a in Flutter.
So far, I can only get a single object, but can't traverse the whole array of objects.
JSON String: [A list of Beef recipe objects within 'beef' array.](https://www.themealdb.com/api/json/v1/1/filter.php?c=Beef)
My code:
```
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
class SpecificCategoryPage extends StatefulWidget {
late final String category;
SpecificCategoryPage({Key? key, required this.category}) : super(key: key);
@override
_SpecificCategoryPageState createState() => _SpecificCategoryPageState();
}
class _SpecificCategoryPageState extends State<SpecificCategoryPage> {
late Future<Meal> meals;
late List<Widget> mealCards;
@override
Widget build(BuildContext context) {
return Scaffold(
body: FutureBuilder<Meal>(
builder: (context, snapshot) {
if (snapshot.hasData) {
return Text(
'Truest\nId: ${snapshot.data!.id}. ${snapshot.data!.meal}');
} else {
return Text('${snapshot.error}');
}
// Be default, show a loading spinner.
return CircularProgressIndicator();
},
future: meals,
),
);
}
@override
void initState() {
super.initState();
meals = _fetchMeals();
}
Future<Meal> _fetchMeals() async {
final http.Response mealsData = await http.get(
Uri.parse('https://www.themealdb.com/api/json/v1/1/filter.php?c=Beef'));
if (mealsData.statusCode == 200)
return Meal.fromJson(jsonDecode(mealsData.body));
else
throw Exception('Failed to load meals');
}
class Meal {
final String? id, meal;
Meal({required this.id, required this.meal});
factory Meal.fromJson(Map<String, dynamic> json) {
return Meal(
id: json['meals'][0]['idMeal'], meal: json['meals'][0]['strMeal']);
}
}
```
Sample object traversal path:
> `{"meals":[{"strMeal":"Beef and Mustard Pie","strMealThumb":"https:\/\/www.themealdb.com\/images\/media\/meals\/sytuqu1511553755.jpg","idMeal":"52874"}, {object1}, {object2}]}`
What I'm getting:
> {"strMeal":"Beef and Mustard
Pie","strMealThumb":"https://www.themealdb.com/images/media/meals/sytuqu1511553755.jpg","idMeal":"52874"}
| How do I populate a GridView by traversing a JSON array in Flutter the JSON_Serializable way? | CC BY-SA 4.0 | null | 2021-07-13T13:51:43.223 | 2021-07-13T14:26:10.853 | null | null | 12,865,343 | [
"json",
"flutter",
"dart",
"serializable",
"mobile-development"
] |
68,370,141 | 1 | 68,380,491 | null | 0 | 763 | I am making an app where I need to have my PC and phone communicate via Bluetooth. I have gotten the app and my PC to successfully connect, and my app is receiving an input stream when I send "Hello World" from my PC. However, I cannot seem to figure out how to get a readable string from my input stream. Here is the code I have so far:
```
private static class BluetoothAcceptThread extends Thread {
private final Context CONTEXT;
private final BluetoothAdapter BLUETOOTH_ADAPTER = BluetoothAdapter.getDefaultAdapter();
private final BluetoothServerSocket BLUETOOTH_SERVER_SOCKET;
private final java.util.UUID UUID;
public BluetoothAcceptThread(Context context, java.util.UUID uuid) {
this.CONTEXT = context;
this.UUID = uuid;
BluetoothServerSocket tmp = null;
try {
tmp = BLUETOOTH_ADAPTER.listenUsingRfcommWithServiceRecord(
CONTEXT.getString(R.string.app_name), UUID);
} catch (IOException e) {
e.printStackTrace();
}
BLUETOOTH_SERVER_SOCKET = tmp;
}
@Override
public void run() {
while (true) {
BluetoothSocket socket = null;
try {
System.out.println("Accepting incoming connections");
socket = BLUETOOTH_SERVER_SOCKET.accept();
System.out.println("Found connection!");
} catch (IOException e) {
System.out.println(1);
e.printStackTrace();
}
if (socket != null) {
manageConnectedSocket(socket);
}
try {
assert socket != null;
socket.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
public void cancel() {
try {
BLUETOOTH_SERVER_SOCKET.close();
} catch (IOException e) {
e.printStackTrace();
}
}
public void manageConnectedSocket(BluetoothSocket socket) {
try {
InputStream inputStream = socket.getInputStream();
while(inputStream.read() == -1) {
inputStream = socket.getInputStream();
}
String string = CharStreams.toString( new InputStreamReader(inputStream, "UTF-8"));
System.out.println(string);
} catch (IOException e) {
e.printStackTrace();
}
}
}
```
In case it is relevant, here is the test code I am running from my PC:
```
import bluetooth
import pydbus
def list_connected_devices():
bus = pydbus.SystemBus()
mngr = bus.get('org.bluez', '/')
mngd_objs = mngr.GetManagedObjects()
connected_devices = []
for path in mngd_objs:
con_state = mngd_objs[path].get('org.bluez.Device1', {}).get('Connected', False)
if con_state:
addr = mngd_objs[path].get('org.bluez.Device1', {}).get('Address')
name = mngd_objs[path].get('org.bluez.Device1', {}).get('Name')
connected_devices.append({'name': name, 'address': addr})
return connected_devices
def main():
address = list_connected_devices()[0]["address"]
uuid = "38b9093c-ff2b-413b-839d-c179b37d8528"
service_matches = bluetooth.find_service(uuid=uuid, address=address)
first_match = service_matches[0]
port = first_match["port"]
host = first_match["host"]
sock = bluetooth.BluetoothSocket(bluetooth.RFCOMM)
sock.connect((host, port))
message = input("Enter message to send: ")
sock.send(message)
if __name__ == '__main__':
main()
```
EDIT:
Tried using the solution suggested by Sajeel by using IO utils, and I am getting the error:
```
W/System.err: java.io.IOException: bt socket closed, read return: -1
W/System.err: at android.bluetooth.BluetoothSocket.read(BluetoothSocket.java:550)
at android.bluetooth.BluetoothInputStream.read(BluetoothInputStream.java:88)
at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:291)
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:355)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:181)
at java.io.InputStreamReader.read(InputStreamReader.java:184)
at java.io.Reader.read(Reader.java:140)
at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:2369)
W/System.err: at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:2348)
at org.apache.commons.io.IOUtils.copy(IOUtils.java:2325)
at org.apache.commons.io.IOUtils.copy(IOUtils.java:2273)
at org.apache.commons.io.IOUtils.toString(IOUtils.java:1041)
at com.example.app.BluetoothSyncService$BluetoothAcceptThread.manageConnectedSocket(BluetoothSyncService.java:278)
at com.example.app.BluetoothSyncService$BluetoothAcceptThread.run(BluetoothSyncService.java:251)
```
EDIT 2:
I motherflipping got it! Here is the code that got it to work:
```
public void manageConnectedSocket(BluetoothSocket socket) {
try {
InputStream inputStream = socket.getInputStream();
while(inputStream.available() == 0) {
inputStream = socket.getInputStream();
}
int available = inputStream.available();
byte[] bytes = new byte[available];
inputStream.read(bytes, 0, available);
String string = new String(bytes);
System.out.println(string);
} catch (IOException e) {
e.printStackTrace();
}
```
| Android: How to read a string from input stream via bluetooth connection? | CC BY-SA 4.0 | null | 2021-07-13T22:57:08.243 | 2021-07-14T15:00:13.310 | 2021-07-14T01:21:23.990 | 13,936,354 | 13,936,354 | [
"java",
"android",
"android-studio",
"mobile",
"mobile-development"
] |
68,376,276 | 1 | null | null | 5 | 1,578 | does someone know how can I disable this serial console thing? I am new to mobile development so I'm not really sure what is this. When this was not there, the emulator was working super fast but after it popped up now the emulator is slow and laggy. Please help! Your help will be greatly appreciated.
[](https://i.stack.imgur.com/9JMHN.png)
| How to disable serial console in emulator? | CC BY-SA 4.0 | null | 2021-07-14T10:22:02.350 | 2021-07-15T02:29:47.177 | null | null | 11,283,915 | [
"android",
"mobile",
"emulation",
"mobile-development"
] |
68,424,387 | 1 | null | null | 0 | 588 | New to this. Is there a way to limit simultaneous logins for cognito using Aws Lambda Post-Authentication trigger?
Basically I want my app to only have 1 user account logged in at a time, if at any point the user logs into the account via another (new device) the app either stops them, or logs them out of previous sessions.
What would a function for this look like?
| Aws Lambda Post-Authentication Trigger Function to limit simultaneous logins | CC BY-SA 4.0 | null | 2021-07-17T21:26:03.767 | 2021-07-21T20:37:03.427 | 2021-07-21T20:37:03.427 | 11,832,989 | 11,832,989 | [
"amazon-web-services",
"aws-lambda",
"amazon-cognito",
"mobile-development"
] |
68,431,092 | 1 | null | null | 0 | 166 | when i am making a fetch call to backend route running in my local i am getting back response in catch block.
> TypeError: Network request failed
```
let testLocal = 'http://127.0.0.1:5000/test-817a8/us-central1/app/heartbeat'
fetch(testLocal, {
method: 'GET',
}).then(res => {
console.log("success")
console.log("Form submitted:", res)
}).catch(err => {
console.log("error occured:" + err)
})
```
| not able to call backend running on localhost in react native | CC BY-SA 4.0 | null | 2021-07-18T16:32:44.893 | 2021-07-18T17:10:12.283 | null | null | 11,033,993 | [
"react-native",
"fetch",
"mobile-development"
] |
68,442,705 | 1 | null | null | 0 | 250 | I am making an app to sync my PC and Phone together with bluetooth when they are paired. Since I want to be able to use multiple devices, I want to generate unique UUIDs to identify each phone/computer in the mix. However, according to the [Android Doc pages](https://developer.android.com/guide/topics/connectivity/bluetooth/connect-bluetooth-devices), if I want to connect to a device, I need its UUID. Is there some way to connect hard coding in a UUID? Can I create a server connection just based on the mac address of the device?
| How to make a bluetooth connection between Android Phone and PC without knowing server UUIDs? | CC BY-SA 4.0 | null | 2021-07-19T15:00:00.183 | 2021-07-19T15:00:00.183 | null | null | 13,936,354 | [
"java",
"android",
"android-studio",
"mobile-development"
] |
68,472,445 | 1 | null | null | 0 | 25 | I am making an app that requires bluetooth server communication. I am trying to set it up so that I don't have to use a UUID to find my device's bluetooth server port. Whenever I use the UUID to find the port of my phone's bluetooth server on my PC, it returns 8. I am considering hard coding this port in, but I am unsure if it is app specific, phone specific, or if it is the port that BluetoothServerSocket will always use on every phone. Would someone be able to clarify this for me?
| Does a BluetoothServerSocket always use port 8? | CC BY-SA 4.0 | null | 2021-07-21T15:35:22.083 | 2021-07-21T15:35:22.083 | null | null | 13,936,354 | [
"java",
"android",
"mobile",
"bluetooth",
"mobile-development"
] |
68,502,151 | 1 | 68,502,317 | null | 0 | 85 | to sum up I am trying to change the src of ImageButtons inside my dialog_colors.xml file from MainActivity. However whatever I do I couldnt manage to change it. I tried the same code with ImageButtons inside my activity_main.xml but it doesnt work for buttons inside dialog_colors.xml file.
activity_main.xlm
```
<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=".MainActivity">
<include
android:id="@+id/dialog_colors"
layout="@layout/dialog_colors"/> ...
```
dialog_colors.xml
```
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<LinearLayout
android:id="@+id/ll_paint_colors"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<ImageButton
android:id="@+id/red"
android:layout_width="40sp"
android:layout_height="40sp"
android:src="@drawable/pallet_normal"
android:background="@color/Red"
android:layout_margin="1sp"
android:tag="redTag"
android:clickable="true"
android:onClick="selectColor"
/>...
```
MainActivity.kt
```
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
colorDialog=findViewById<LinearLayout>(R.id.dialog_colors)
firstRowColors=colorDialog.findViewById<LinearLayout>(R.id.ll_paint_colors)
secondRowColors=colorDialog.findViewById<LinearLayout>(R.id.ll_paint_colors2)
drawingView=findViewById<DrawingView>(R.id.drawingView)
pressedColor=secondRowColors[0] as ImageButton
pressedColor!!.setImageResource(R.drawable.pallet_pressed)
}...
```
I tried the same thing with TextViews etc too. It seems like I cannot change anything inside the dialog_colors.xml file.
Do not get confused about the firstRows, secondRows etc, there are many ImageButtons, it doesnt work for any of them.
| Trying to Change src of an ImageButton in another layout folder other than activity_main | CC BY-SA 4.0 | null | 2021-07-23T16:12:06.187 | 2021-07-24T13:59:44.627 | 2021-07-24T10:57:10.390 | 12,355,161 | 12,355,161 | [
"android",
"xml",
"kotlin",
"layout",
"mobile-development"
] |
68,537,071 | 1 | null | null | 0 | 231 | I am trying to make an app that will get the user's clipboard with the press of a button on a notification. The code I have in my notification broadcast receiver is here:
```
if (intent.getAction().equals(SEND_CLIPBOARD_ACTION)) {
ClipboardManager clipboardManager =
(ClipboardManager) context.getSystemService(CLIPBOARD_SERVICE);
ClipData primaryClip = clipboardManager.getPrimaryClip();
if (primaryClip.getItemCount() > 0) {
CharSequence text = primaryClip.getItemAt(0).coerceToText(context);
if (text != null) {
String clipboard = clipboardManager.getPrimaryClip().toString();
Utils utils = Utils.getInstance(context);
utils.getPairedPC(intent.getStringExtra(PC_ADDRESS_KEY))
.setClipboardCache(clipboard);
Toast.makeText(context, "Clipboard Sent!", Toast.LENGTH_SHORT).show();
}
} else {
Toast.makeText(context, "Clipboard Empty!", Toast.LENGTH_SHORT).show();
}
}
```
The button works fine, except when it gets to the line where it checks if there are items in the primary clip, it gives me a null pointer exception. I read on the docs that this is because you can only get a user's clipboard data from the main thread. Is there any possible way to get a user's clipboard data in the background without requiring them to go into the app?
| getPrimaryClip() is returning null object reference | CC BY-SA 4.0 | 0 | 2021-07-26T22:46:51.273 | 2021-07-26T22:46:51.273 | null | null | 13,936,354 | [
"java",
"android",
"mobile",
"mobile-development"
] |
68,567,932 | 1 | 68,568,437 | null | 0 | 180 | I'm an android developer
I have an idea to develop an application that writes on NFC tags data. (Only writing)
I have an Edit Text and a button and when I click on the button I write on the NFC the data written in the field
I searched a lot and tried several codes
The only problem is my NFC tags sticks in the back of the phone and the code i'm using tells me I have to tap/tag the NFC tag to write in it
Is there another way to detect the NFC tag sticked on the back of the phone when clicking the button?
I have two activities main activity that will call methods from my NFCManager
I will share below the NFCManager class
NFCManager class:
```
import android.app.Activity;
import android.app.PendingIntent;
import android.content.Intent;
import android.content.IntentFilter;
import android.nfc.NdefMessage;
import android.nfc.NdefRecord;
import android.nfc.NfcAdapter;
import android.nfc.Tag;
import android.nfc.tech.Ndef;
import android.nfc.tech.NdefFormatable;
import java.io.ByteArrayOutputStream;
import java.util.Locale;
public class NFCManager {
private Activity activity;
private NfcAdapter nfcAdpt;
public NFCManager(Activity activity) {
this.activity = activity;
}
public void verifyNFC() throws NFCNotSupported, NFCNotEnabled {
nfcAdpt = NfcAdapter.getDefaultAdapter(activity);
if (nfcAdpt == null)
throw new NFCNotSupported();
if (!nfcAdpt.isEnabled())
throw new NFCNotEnabled();
}
public void enableDispatch() {
Intent nfcIntent = new Intent(activity, getClass());
nfcIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(activity, 0, nfcIntent, 0);
IntentFilter[] intentFiltersArray = new IntentFilter[] {};
String[][] techList = new String[][] { { android.nfc.tech.Ndef.class.getName() }, { android.nfc.tech.NdefFormatable.class.getName() } };
nfcAdpt.enableForegroundDispatch(activity, pendingIntent, intentFiltersArray, techList);
}
public void disableDispatch() {
nfcAdpt.disableForegroundDispatch(activity);
}
public static class NFCNotSupported extends Exception {
public NFCNotSupported() {
super();
}
}
public static class NFCNotEnabled extends Exception {
public NFCNotEnabled() {
super();
}
}
public void writeTag(Tag tag, NdefMessage message) {
if (tag != null) {
try {
Ndef ndefTag = Ndef.get(tag);
if (ndefTag == null) {
// Let's try to format the Tag in NDEF
NdefFormatable nForm = NdefFormatable.get(tag);
if (nForm != null) {
nForm.connect();
nForm.format(message);
nForm.close();
}
}
else {
ndefTag.connect();
ndefTag.writeNdefMessage(message);
ndefTag.close();
}
}
catch(Exception e) {
e.printStackTrace();
}
}
}
public NdefMessage createUriMessage(String content, String type) {
NdefRecord record = NdefRecord.createUri(type + content);
NdefMessage msg = new NdefMessage(new NdefRecord[]{record});
return msg;
}
public NdefMessage createTextMessage(String content) {
try {
// Get UTF-8 byte
byte[] lang = Locale.getDefault().getLanguage().getBytes("UTF-8");
byte[] text = content.getBytes("UTF-8"); // Content in UTF-8
int langSize = lang.length;
int textLength = text.length;
ByteArrayOutputStream payload = new ByteArrayOutputStream(1 + langSize + textLength);
payload.write((byte) (langSize & 0x1F));
payload.write(lang, 0, langSize);
payload.write(text, 0, textLength);
NdefRecord record = new NdefRecord(NdefRecord.TNF_WELL_KNOWN, NdefRecord.RTD_TEXT, new byte[0], payload.toByteArray());
return new NdefMessage(new NdefRecord[]{record});
}
catch (Exception e) {
e.printStackTrace();
}
return null;
}
public NdefMessage createExternalMessage(String content) {
NdefRecord externalRecord = NdefRecord.createExternal("com.survivingwithandroid", "data", content.getBytes());
NdefMessage ndefMessage = new NdefMessage(new NdefRecord[] { externalRecord });
return ndefMessage;
}
}
```
Methods from my MainActivity:
```
@Override
protected void onResume() {
super.onResume();
try {
nfcMger.verifyNFC();
//nfcMger.enableDispatch();
Intent nfcIntent = new Intent(this, getClass());
nfcIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, nfcIntent, 0);
IntentFilter[] intentFiltersArray = new IntentFilter[] {};
String[][] techList = new String[][] { { android.nfc.tech.Ndef.class.getName() }, { android.nfc.tech.NdefFormatable.class.getName() } };
NfcAdapter nfcAdpt = NfcAdapter.getDefaultAdapter(this);
nfcAdpt.enableForegroundDispatch(this, pendingIntent, intentFiltersArray, techList);
}
catch(NFCManager.NFCNotSupported nfcnsup) {
Snackbar.make(v, "NFC not supported", Snackbar.LENGTH_LONG).show();
}
catch(NFCManager.NFCNotEnabled nfcnEn) {
Snackbar.make(v, "NFC Not enabled", Snackbar.LENGTH_LONG).show();
}
}
@Override
protected void onPause() {
super.onPause();
nfcMger.disableDispatch();
}
@Override
public void onNewIntent(Intent intent) {
super.onNewIntent(intent);
Log.d("Nfc", "New intent");
// It is the time to write the tag
currentTag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
if (message != null) {
nfcMger.writeTag(currentTag, message);
dialog.dismiss();
Snackbar.make(v, "Tag written", Snackbar.LENGTH_LONG).show();
} else {
// Handle intent
}
}
```
| Should I tap NFC tag every time I want to write in it? | CC BY-SA 4.0 | null | 2021-07-28T22:15:54.183 | 2021-07-29T14:31:29.950 | 2021-07-29T14:31:29.950 | 14,333,417 | 12,314,473 | [
"java",
"android",
"nfc",
"mobile-development"
] |
68,570,461 | 1 | null | null | 0 | 1,108 | I am new to flutter. I am working on an app where to show every entry the server sends an sms and fetching data from that sms shows the entry for which it was sent. Its just like the OTP fetching but instead it is done everytime a new order comes and the server sends a message. My boss have the code for andriod but they want to implement it in IOS as well. Is there anyway to read sms and show the entry using flutter?
| Is there anyway we can read data from sms and show an entry in IOS using flutter? | CC BY-SA 4.0 | null | 2021-07-29T05:22:52.127 | 2021-07-29T05:22:52.127 | null | null | 13,083,173 | [
"ios",
"iphone",
"flutter",
"flutter-test",
"mobile-development"
] |
68,662,264 | 1 | 68,663,265 | null | 1 | 1,162 | I have been developing a sample mobile application from React native and I keep getting the following error but I cannot seems to put my finger on what's wrong there. The line does not show any errors and the details in the log do not indicate anything that I should be concern about either. But I keep getting this error.
```
ReferenceError: Can't find variable: useState
This error is located at:
in App (created by ExpoRoot)
in ExpoRoot (at renderApplication.js:45)
in RCTView (at View.js:34)
in View (at AppContainer.js:106)
in DevAppContainer (at AppContainer.js:121)
in RCTView (at View.js:34)
in View (at AppContainer.js:132)
in AppContainer (at renderApplication.js:39)
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:104:6 in reportException
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:171:19 in handleException
at node_modules/react-native/Libraries/Core/setUpErrorHandling.js:24:6 in handleError
at node_modules/expo-error-recovery/build/ErrorRecovery.fx.js:12:21 in ErrorUtils.setGlobalHandler$argument_0
at [native code]:null in flushedQueue
at [native code]:null in invokeCallbackAndReturnFlushedQueue
```
My `App.js` looks as follows
```
import "react-native-gesture-handler";
import { NavigationContainer } from "@react-navigation/native";
import { createStackNavigator } from "@react-navigation/stack";
import * as Font from "expo-font";
import AppLoading from "expo-app-loading";
import React, { useState } from "react";
import useFonts from "./hooks/useFonts";
import TravelPartner from "./src/components/mainPage";
const App = () => {
const [IsReady, SetIsReady] = useState(false);
const LoadFonts = async () => {
await useFonts();
};
if (!IsReady) {
return (
<AppLoading
startAsync={LoadFonts}
onFinish={() => SetIsReady(true)}
onError={() => {}}
/>
);
}
return (
<View styles={styles.container}>
{<Text>test run for the application</Text>}
</View>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#fff",
alignItems: "center",
justifyContent: "center",
},
});
export default App;
```
All the libraries have been installed and everything Is up to date. `useFonts.js` looks as follows
```
import * as Font from "expo-font";
export default useFonts = async () => {
await Font.loadAsync({
"OtomanopeeOne-Regular": require("../src/assets/fonts/OtomanopeeOne-Regular.ttf"),
"VeganStylePersonalUse-5Y58": require("../src/assets/fonts/VeganStylePersonalUse-5Y58.ttf"),
"Festive-Regular": require("../src/assets/fonts/Festive-Regular.ttf"),
"Pacifico-Regular": require("../src/assets/fonts/Pacifico-Regular.ttf"),
});
};
```
This is my `package.json`:
```
{
"main": "index.js",
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"web": "expo start --web",
"start": "react-native start"
},
"dependencies": {
"@react-navigation/native": "^6.0.1",
"@react-navigation/stack": "^6.0.1",
"expo": "~42.0.1",
"expo-app-loading": "^1.1.2",
"expo-font": "~9.2.1",
"expo-splash-screen": "~0.11.2",
"expo-status-bar": "~1.0.4",
"expo-updates": "~0.8.1",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-native": "~0.63.4",
"react-native-elements": "^3.4.2",
"react-native-gesture-handler": "~1.10.2",
"react-native-reanimated": "~2.2.0",
"react-native-screens": "~3.4.0",
"react-native-unimodules": "~0.14.5",
"react-native-web": "~0.13.12"
},
"devDependencies": {
"@babel/core": "^7.9.0"
},
"private": true
}
```
| ReferenceError: Can't find variable: useState - React Native | CC BY-SA 4.0 | null | 2021-08-05T07:25:07.423 | 2021-08-05T08:41:03.937 | 2021-08-05T08:39:22.830 | 13,897,065 | 10,832,040 | [
"react-native",
"use-state",
"react-native-navigation",
"mobile-development"
] |
68,752,681 | 1 | null | null | 1 | 206 | SocketException (SocketException: Failed host lookup: 'firebasestorage.googleapis.com' (OS Error: No address associated with hostname, errno = 7))
| How to solve socket exception in firebase storage? | CC BY-SA 4.0 | null | 2021-08-12T06:36:29.553 | 2021-08-12T06:36:29.553 | null | null | 16,647,368 | [
"flutter",
"dart",
"mobile-development"
] |
68,772,264 | 1 | 69,976,869 | null | 6 | 4,505 | I want to Uninstall Android Studio, but it's not showing in the control panel programs and features, and I can't find the uninstaller. Does anyone know how to uninstall it?
or reinstalling it for the matter?
| Can't uninstall Android Studio on Windows 10 | CC BY-SA 4.0 | null | 2021-08-13T12:23:22.363 | 2022-04-29T15:54:44.013 | 2021-11-16T10:43:19.813 | 8,257,809 | 11,922,376 | [
"android",
"android-studio",
"intellij-idea",
"mobile-development"
] |
68,786,385 | 1 | null | null | 2 | 2,406 | iam a newbie to flutter and mobile development. I am facing a problem for the first time.
When I run my code through the terminal:
```
flutter run
```
But when I try to run it through VSCode - either I use with debugging or without debugging - it just hangs at a white screen in my mobile and the debug console shows `Built build\app\outputs\flutter-apk\app-debug.apk.` and is stuck there for eternity. On the debug consoloe it also shows `Running Gradle task 'assembleDebug'...` in the bottom left of the debug console and it keeps loading . I am using a physical device for testing my app. I am using Vivo S1.
These are the things I have already tried:
1. Reinstalling VsCode clean
2. Clearing my mobile cache
3. Restarting my mobile/Laptop
4. The adb device is connected and showing my device.
5. Checked a different USB port to connect my mobile
6. flutter clean
It is working fine when i run it using terminal.
Below is the result of `flutter run --debug -v`:
```
[ +441 ms] executing: [C:\Users\Aneeb\flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[ +463 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[ +4 ms] f4abaa0735eba4dfd8f33f73363911d63931fe03
[ +4 ms] executing: [C:\Users\Aneeb\flutter/] git tag --points-at f4abaa0735eba4dfd8f33f73363911d63931fe03
[ +211 ms] Exit code 0 from: git tag --points-at f4abaa0735eba4dfd8f33f73363911d63931fe03
[ +3 ms] 2.2.3
[ +45 ms] executing: [C:\Users\Aneeb\flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[ +177 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[ +3 ms] origin/stable
[ +1 ms] executing: [C:\Users\Aneeb\flutter/] git ls-remote --get-url origin
[ +307 ms] Exit code 0 from: git ls-remote --get-url origin
[ +2 ms] https://github.com/flutter/flutter.git
[ +644 ms] executing: [C:\Users\Aneeb\flutter/] git rev-parse --abbrev-ref HEAD
[ +166 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[ +2 ms] stable
[ +685 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[ +3 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[ +3 ms] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[ +3 ms] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[ +28 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[ +3 ms] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[ +3 ms] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[ +3 ms] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[ +3 ms] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[ +2 ms] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[ +3 ms] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +387 ms] executing: C:\Users\Aneeb\AppData\Local\Android\sdk\platform-tools\adb.exe devices -l
[ +244 ms] List of devices attached
AEDI7DEQXCGUJJAQ device product:1907 model:vivo_1907_19 device:1907 transport_id:1
[ +43 ms] C:\Users\Aneeb\AppData\Local\Android\sdk\platform-tools\adb.exe -s AEDI7DEQXCGUJJAQ shell getprop
[ +444 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[ +3 ms] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[ +25 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[ +3 ms] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[ +3 ms] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[ +4 ms] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[ +1 ms] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[ +1 ms] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[ +2 ms] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +611 ms] Skipping pub get: version match.
[ +764 ms] Generating C:\Flutter\MyApps\shop_app\android\app\src\main\java\io\flutter\plugins\GeneratedPluginRegistrant.java
[ +322 ms] ro.hardware = mt6768
[ +3 ms] ro.build.characteristics = default
[ +286 ms] Initializing file store
[ +65 ms] Skipping target: gen_localizations
[ +56 ms] complete
[ +40 ms] Launching lib\main.dart on vivo 1907 19 in debug mode...
[ +66 ms] C:\Users\Aneeb\flutter\bin\cache\dart-sdk\bin\dart.exe --disable-dart-dev C:\Users\Aneeb\flutter\bin\cache\artifacts\engine\windows-x64\frontend_server.dart.snapshot
--sdk-root C:\Users\Aneeb\flutter\bin\cache\artifacts\engine\common\flutter_patched_sdk/ --incremental --target=flutter --debugger-module-names --experimental-emit-debug-metadata
-DFLUTTER_WEB_AUTO_DETECT=true --output-dill C:\Users\Aneeb\AppData\Local\Temp\flutter_tools.87cfdec5\flutter_tool.a1785061\app.dill --packages
C:\Flutter\MyApps\shop_app\.dart_tool\package_config.json -Ddart.vm.profile=false -Ddart.vm.product=false --enable-asserts --track-widget-creation --filesystem-scheme
org-dartlang-root --initialize-from-dill build\3c113a45063dc6628e68a4111abcacad.cache.dill.track.dill --enable-experiment=alternative-invalidation-strategy
[ +102 ms] executing: C:\Users\Aneeb\AppData\Local\Android\sdk\build-tools\31.0.0\aapt dump xmltree C:\Flutter\MyApps\shop_app\build\app\outputs\flutter-apk\app.apk
AndroidManifest.xml
[ +79 ms] Exit code 0 from: C:\Users\Aneeb\AppData\Local\Android\sdk\build-tools\31.0.0\aapt dump xmltree C:\Flutter\MyApps\shop_app\build\app\outputs\flutter-apk\app.apk
AndroidManifest.xml
[ +5 ms] N: android=http://schemas.android.com/apk/res/android
E: manifest (line=2)
A: android:versionCode(0x0101021b)=(type 0x10)0x1
A: android:versionName(0x0101021c)="1.0.0" (Raw: "1.0.0")
A: android:compileSdkVersion(0x01010572)=(type 0x10)0x1e
A: android:compileSdkVersionCodename(0x01010573)="11" (Raw: "11")
A: package="com.example.shop_app" (Raw: "com.example.shop_app")
A: platformBuildVersionCode=(type 0x10)0x1e
A: platformBuildVersionName=(type 0x10)0xb
E: uses-sdk (line=7)
A: android:minSdkVersion(0x0101020c)=(type 0x10)0x10
A: android:targetSdkVersion(0x01010270)=(type 0x10)0x1e
E: uses-permission (line=14)
A: android:name(0x01010003)="android.permission.INTERNET" (Raw: "android.permission.INTERNET")
E: application (line=16)
A: android:label(0x01010001)="shop_app" (Raw: "shop_app")
A: android:icon(0x01010002)=@0x7f080000
A: android:debuggable(0x0101000f)=(type 0x12)0xffffffff
A: android:appComponentFactory(0x0101057a)="androidx.core.app.CoreComponentFactory" (Raw: "androidx.core.app.CoreComponentFactory")
E: activity (line=21)
A: android:theme(0x01010000)=@0x7f0a0000
A: android:name(0x01010003)="com.example.shop_app.MainActivity" (Raw: "com.example.shop_app.MainActivity")
A: android:launchMode(0x0101001d)=(type 0x10)0x1
A: android:configChanges(0x0101001f)=(type 0x11)0x40003fb4
A: android:windowSoftInputMode(0x0101022b)=(type 0x11)0x10
A: android:hardwareAccelerated(0x010102d3)=(type 0x12)0xffffffff
E: meta-data (line=35)
A: android:name(0x01010003)="io.flutter.embedding.android.NormalTheme" (Raw: "io.flutter.embedding.android.NormalTheme")
A: android:resource(0x01010025)=@0x7f0a0001
E: meta-data (line=45)
A: android:name(0x01010003)="io.flutter.embedding.android.SplashScreenDrawable" (Raw: "io.flutter.embedding.android.SplashScreenDrawable")
A: android:resource(0x01010025)=@0x7f040000
E: intent-filter (line=49)
E: action (line=50)
A: android:name(0x01010003)="android.intent.action.MAIN" (Raw: "android.intent.action.MAIN")
E: category (line=52)
A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER")
E: meta-data (line=59)
A: android:name(0x01010003)="flutterEmbedding" (Raw: "flutterEmbedding")
A: android:value(0x01010024)=(type 0x10)0x2
[ +93 ms] executing: C:\Users\Aneeb\AppData\Local\Android\sdk\platform-tools\adb.exe -s AEDI7DEQXCGUJJAQ shell -x logcat -v time -t 1
[ +96 ms] <- compile package:shop_app_course/main.dart
[ +371 ms] executing: C:\Users\Aneeb\AppData\Local\Android\sdk\platform-tools\adb.exe version
[ +530 ms] Android Debug Bridge version 1.0.41
Version 31.0.3-7562133
Installed as C:\Users\Aneeb\AppData\Local\Android\sdk\platform-tools\adb.exe
[ +16 ms] executing: C:\Users\Aneeb\AppData\Local\Android\sdk\platform-tools\adb.exe start-server
[ +102 ms] Building APK
[ +127 ms] Running Gradle task 'assembleDebug'...
[ +33 ms] Using gradle from C:\Flutter\MyApps\shop_app\android\gradlew.bat.
[ +43 ms] executing: C:\Program Files\Android\Android Studio\jre\bin\java -version
[ +477 ms] Exit code 0 from: C:\Program Files\Android\Android Studio\jre\bin\java -version
[ +27 ms] openjdk version "11.0.8" 2020-07-14
OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)
OpenJDK 64-Bit Server VM (build 11.0.8+10-b944.6842174, mixed mode)
[ +9 ms] executing: [C:\Flutter\MyApps\shop_app\android/] C:\Flutter\MyApps\shop_app\android\gradlew.bat -Pverbose=true -Ptarget-platform=android-arm64
-Ptarget=C:\Flutter\MyApps\shop_app\lib\main.dart -Pdart-defines=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ== -Pdart-obfuscation=false -Ptrack-widget-creation=true
-Ptree-shake-icons=false -Pfilesystem-scheme=org-dartlang-root assembleDebug
[+6211 ms] > Task :app:compileFlutterBuildDebug
[ +3 ms] [ +141 ms] executing: [C:\Users\Aneeb\flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[ +86 ms] [ +88 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[ +84 ms] [ ] f4abaa0735eba4dfd8f33f73363911d63931fe03
[ +27 ms] [ +2 ms] executing: [C:\Users\Aneeb\flutter/] git tag --points-at f4abaa0735eba4dfd8f33f73363911d63931fe03
[ +66 ms] [ +62 ms] Exit code 0 from: git tag --points-at f4abaa0735eba4dfd8f33f73363911d63931fe03
[ +4 ms] [ ] 2.2.3
[ +25 ms] [ +13 ms] executing: [C:\Users\Aneeb\flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[ +2 ms] [ +90 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[ +1 ms] [ ] origin/stable
[ +3 ms] [ ] executing: [C:\Users\Aneeb\flutter/] git ls-remote --get-url origin
[ +1 ms] [ +41 ms] Exit code 0 from: git ls-remote --get-url origin
[ +2 ms] [ ] https://github.com/flutter/flutter.git
[ +72 ms] [ +135 ms] executing: [C:\Users\Aneeb\flutter/] git rev-parse --abbrev-ref HEAD
[ +22 ms] [ +37 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[ +31 ms] [ ] stable
[ +7 ms] [ +109 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[ ] [ ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[ ] [ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[ ] [ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[ ] [ +5 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[ ] [ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[ ] [ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[ ] [ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[ ] [ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[ ] [ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[ ] [ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ ] [ +315 ms] Artifact Instance of 'MaterialFonts' is not required, skipping update.
[ +3 ms] [ +5 ms] Artifact Instance of 'GradleWrapper' is not required, skipping update.
[ +11 ms] [ +7 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[ +44 ms] [ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[ +89 ms] [ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[ +61 ms] [ ] Artifact Instance of 'FlutterSdk' is not required, skipping update.
[ +101 ms] [ ] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[ +66 ms] [ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[ +43 ms] [ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[ +94 ms] [ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[ +86 ms] [ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[ +28 ms] [ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[ +30 ms] [ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +3 ms] [ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[ +42 ms] [ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[ +49 ms] [ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[ +6 ms] [ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[ +2 ms] [ ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[ +2 ms] [ ] Artifact Instance of 'FontSubsetArtifacts' is not required, skipping update.
[ +38 ms] [ ] Artifact Instance of 'PubDependencies' is not required, skipping update.
[ +2 ms] [ +158 ms] Initializing file store
[ +2 ms] [ +72 ms] Skipping target: gen_localizations
[ +62 ms] [ +19 ms] kernel_snapshot: Starting due to {}
[ +10 ms] [ +45 ms] C:\Users\Aneeb\flutter\bin\cache\dart-sdk\bin\dart.exe --disable-dart-dev
C:\Users\Aneeb\flutter\bin\cache\artifacts\engine\windows-x64\frontend_server.dart.snapshot --sdk-root
C:\Users\Aneeb\flutter\bin\cache\artifacts\engine\common\flutter_patched_sdk/ --target=flutter --no-print-incremental-dependencies -DFLUTTER_WEB_AUTO_DETECT=true
-Ddart.vm.profile=false -Ddart.vm.product=false --enable-asserts --track-widget-creation --no-link-platform --packages C:\Flutter\MyApps\shop_app\.dart_tool\package_config.json
--output-dill C:\Flutter\MyApps\shop_app\.dart_tool\flutter_build\1af984f4dfa72c51502439bab9fced1e\app.dill --depfile
C:\Flutter\MyApps\shop_app\.dart_tool\flutter_build\1af984f4dfa72c51502439bab9fced1e\kernel_snapshot.d package:shop_app_course/main.dart
[+27038 ms] [+27763 ms] kernel_snapshot: Complete
[+2995 ms] [+3040 ms] debug_android_application: Starting due to {}
[ +811 ms] [ +855 ms] debug_android_application: Complete
[+3199 ms] [+3173 ms] Persisting file store
[ +96 ms] [ +67 ms] Done persisting file store
[ +95 ms] [ +55 ms] build succeeded.
[ +97 ms] [ +110 ms] "flutter assemble" took 35,667ms.
[ +301 ms] [ +292 ms] ensureAnalyticsSent: 259ms
[ +3 ms] [ +9 ms] Running shutdown hooks
[ +3 ms] [ +1 ms] Shutdown hooks complete
[ +4 ms] [ +20 ms] exiting with code 0
[+1194 ms] > Task :app:packLibsflutterBuildDebug UP-TO-DATE
[ +5 ms] > Task :app:preBuild UP-TO-DATE
[ +11 ms] > Task :app:preDebugBuild UP-TO-DATE
[ +4 ms] > Task :app:compileDebugAidl NO-SOURCE
[ +3 ms] > Task :app:compileDebugRenderscript NO-SOURCE
[ +5 ms] > Task :app:generateDebugBuildConfig UP-TO-DATE
[ +172 ms] > Task :app:checkDebugAarMetadata UP-TO-DATE
[ +145 ms] > Task :app:cleanMergeDebugAssets
[ +109 ms] > Task :app:mergeDebugShaders UP-TO-DATE
[ +70 ms] > Task :app:compileDebugShaders NO-SOURCE
[ +6 ms] > Task :app:generateDebugAssets UP-TO-DATE
[ +7 ms] > Task :app:mergeDebugAssets
[+1449 ms] > Task :app:copyFlutterAssetsDebug
[ +44 ms] > Task :app:generateDebugResValues UP-TO-DATE
[ +16 ms] > Task :app:generateDebugResources UP-TO-DATE
[ +4 ms] > Task :app:mergeDebugResources UP-TO-DATE
[ +51 ms] > Task :app:createDebugCompatibleScreenManifests UP-TO-DATE
[ +27 ms] > Task :app:extractDeepLinksDebug UP-TO-DATE
[ +3 ms] > Task :app:processDebugMainManifest UP-TO-DATE
[ +55 ms] > Task :app:processDebugManifest UP-TO-DATE
[ +45 ms] > Task :app:processDebugManifestForPackage UP-TO-DATE
[ +114 ms] > Task :app:processDebugResources UP-TO-DATE
[ +325 ms] > Task :app:compileDebugKotlin UP-TO-DATE
[ +286 ms] > Task :app:javaPreCompileDebug UP-TO-DATE
[ +6 ms] > Task :app:compileDebugJavaWithJavac UP-TO-DATE
[ +7 ms] > Task :app:compileDebugSources UP-TO-DATE
[ +5 ms] > Task :app:mergeDebugNativeDebugMetadata NO-SOURCE
[ +8 ms] > Task :app:compressDebugAssets UP-TO-DATE
[ +4 ms] > Task :app:processDebugJavaRes NO-SOURCE
[ +10 ms] > Task :app:mergeDebugJavaResource UP-TO-DATE
[ +9 ms] > Task :app:checkDebugDuplicateClasses UP-TO-DATE
[ +7 ms] > Task :app:dexBuilderDebug UP-TO-DATE
[ +24 ms] > Task :app:desugarDebugFileDependencies UP-TO-DATE
[ +5 ms] > Task :app:mergeExtDexDebug UP-TO-DATE
[ +4 ms] > Task :app:mergeDexDebug UP-TO-DATE
[ +5 ms] > Task :app:mergeDebugJniLibFolders UP-TO-DATE
[ +3 ms] > Task :app:mergeDebugNativeLibs UP-TO-DATE
[ +27 ms] > Task :app:stripDebugDebugSymbols UP-TO-DATE
[ +11 ms] > Task :app:validateSigningDebug UP-TO-DATE
[ +5 ms] > Task :app:packageDebug UP-TO-DATE
[ +774 ms] > Task :app:assembleDebug
[ +96 ms] Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
[ +3 ms] Use '--warning-mode all' to show the individual deprecation warnings.
[ +4 ms] See https://docs.gradle.org/6.7/userguide/command_line_interface.html#sec:command_line_warnings
[ +4 ms] BUILD SUCCESSFUL in 46s
[ +6 ms] 32 actionable tasks: 5 executed, 27 up-to-date
[ +792 ms] Running Gradle task 'assembleDebug'... (completed in 48.7s)
[ +179 ms] calculateSha: LocalDirectory: 'C:\Flutter\MyApps\shop_app\build\app\outputs\flutter-apk'/app.apk
[+3418 ms] √ Built build\app\outputs\flutter-apk\app-debug.apk.
[ +22 ms] executing: C:\Users\Aneeb\AppData\Local\Android\sdk\build-tools\31.0.0\aapt dump xmltree C:\Flutter\MyApps\shop_app\build\app\outputs\flutter-apk\app.apk
AndroidManifest.xml
[ +88 ms] Exit code 0 from: C:\Users\Aneeb\AppData\Local\Android\sdk\build-tools\31.0.0\aapt dump xmltree C:\Flutter\MyApps\shop_app\build\app\outputs\flutter-apk\app.apk
AndroidManifest.xml
[ +7 ms] N: android=http://schemas.android.com/apk/res/android
E: manifest (line=2)
A: android:versionCode(0x0101021b)=(type 0x10)0x1
A: android:versionName(0x0101021c)="1.0.0" (Raw: "1.0.0")
A: android:compileSdkVersion(0x01010572)=(type 0x10)0x1e
A: android:compileSdkVersionCodename(0x01010573)="11" (Raw: "11")
A: package="com.example.shop_app" (Raw: "com.example.shop_app")
A: platformBuildVersionCode=(type 0x10)0x1e
A: platformBuildVersionName=(type 0x10)0xb
E: uses-sdk (line=7)
A: android:minSdkVersion(0x0101020c)=(type 0x10)0x10
A: android:targetSdkVersion(0x01010270)=(type 0x10)0x1e
E: uses-permission (line=14)
A: android:name(0x01010003)="android.permission.INTERNET" (Raw: "android.permission.INTERNET")
E: application (line=16)
A: android:label(0x01010001)="shop_app" (Raw: "shop_app")
A: android:icon(0x01010002)=@0x7f080000
A: android:debuggable(0x0101000f)=(type 0x12)0xffffffff
A: android:appComponentFactory(0x0101057a)="androidx.core.app.CoreComponentFactory" (Raw: "androidx.core.app.CoreComponentFactory")
E: activity (line=21)
A: android:theme(0x01010000)=@0x7f0a0000
A: android:name(0x01010003)="com.example.shop_app.MainActivity" (Raw: "com.example.shop_app.MainActivity")
A: android:launchMode(0x0101001d)=(type 0x10)0x1
A: android:configChanges(0x0101001f)=(type 0x11)0x40003fb4
A: android:windowSoftInputMode(0x0101022b)=(type 0x11)0x10
A: android:hardwareAccelerated(0x010102d3)=(type 0x12)0xffffffff
E: meta-data (line=35)
A: android:name(0x01010003)="io.flutter.embedding.android.NormalTheme" (Raw: "io.flutter.embedding.android.NormalTheme")
A: android:resource(0x01010025)=@0x7f0a0001
E: meta-data (line=45)
A: android:name(0x01010003)="io.flutter.embedding.android.SplashScreenDrawable" (Raw: "io.flutter.embedding.android.SplashScreenDrawable")
A: android:resource(0x01010025)=@0x7f040000
E: intent-filter (line=49)
E: action (line=50)
A: android:name(0x01010003)="android.intent.action.MAIN" (Raw: "android.intent.action.MAIN")
E: category (line=52)
A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER")
E: meta-data (line=59)
A: android:name(0x01010003)="flutterEmbedding" (Raw: "flutterEmbedding")
A: android:value(0x01010024)=(type 0x10)0x2
[ +40 ms] Stopping app 'app.apk' on vivo 1907 19.
[ +3 ms] executing: C:\Users\Aneeb\AppData\Local\Android\sdk\platform-tools\adb.exe -s AEDI7DEQXCGUJJAQ shell am force-stop com.example.shop_app
[ +260 ms] executing: C:\Users\Aneeb\AppData\Local\Android\sdk\platform-tools\adb.exe -s AEDI7DEQXCGUJJAQ shell pm list packages com.example.shop_app
[ +183 ms] package:com.example.shop_app
[ +11 ms] executing: C:\Users\Aneeb\AppData\Local\Android\sdk\platform-tools\adb.exe -s AEDI7DEQXCGUJJAQ shell cat /data/local/tmp/sky.com.example.shop_app.sha1
[ +146 ms] 7a59f4e109ce148beba3995878fb471da3afa32e
[ +8 ms] Latest build already installed.
[ +2 ms] executing: C:\Users\Aneeb\AppData\Local\Android\sdk\platform-tools\adb.exe -s AEDI7DEQXCGUJJAQ shell -x logcat -v time -t 1
[ +157 ms] executing: C:\Users\Aneeb\AppData\Local\Android\sdk\platform-tools\adb.exe -s AEDI7DEQXCGUJJAQ shell am start -a android.intent.action.RUN -f 0x20000000 --ez
enable-background-compilation true --ez enable-dart-profiling true --ez enable-checked-mode true --ez verify-entry-points true
com.example.shop_app/com.example.shop_app.MainActivity
[ +186 ms] Starting: Intent { act=android.intent.action.RUN flg=0x20000000 cmp=com.example.shop_app/.MainActivity (has extras) }
[ +3 ms] Waiting for observatory port to be available...
[ +30 ms] Error waiting for a debug connection: The log reader stopped unexpectedly
[ +12 ms] Error launching application on vivo 1907 19.
[ +18 ms] "flutter run" took 58,788ms.
[ +29 ms]
#0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
#1 RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:663:9)
<asynchronous suspension>
#2 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1043:27)
<asynchronous suspension>
#3 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#4 CommandRunner.runCommand (package:args/command_runner.dart:196:13)
<asynchronous suspension>
#5 FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:284:9)
<asynchronous suspension>
#6 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#7 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:232:5)
<asynchronous suspension>
#8 run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
<asynchronous suspension>
#9 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#10 main (package:flutter_tools/executable.dart:91:3)
<asynchronous suspension>
[ +286 ms] ensureAnalyticsSent: 260ms
[ +8 ms] Running shutdown hooks
[ +2 ms] Shutdown hooks complete
[ +3 ms] exiting with code 1
```
| flutter app doesn't run from VsCode, but it runs fine from terminal | CC BY-SA 4.0 | null | 2021-08-14T19:22:03.453 | 2022-12-12T15:21:47.383 | 2021-08-14T20:05:05.940 | 16,667,670 | 16,667,670 | [
"flutter",
"visual-studio-code",
"flutter-test",
"mobile-development",
"flutter-run"
] |
68,790,375 | 1 | null | null | 0 | 245 | I have a TextView match parented for whole screen, and a text appended on it.
For example, the Raven poem:
```
Once upon a midnight dreary, while I pondered, weak and weary,
Over many a quaint and curious volume of forgotten lore,
While I nodded, nearly napping, suddenly there came a tapping,
As of some one gently rapping, rapping at my chamber door.
"'Tis some visiter," I muttered, "tapping at my chamber door—
Only this, and nothing more." etc etc etc...
```
I can't see it all on my phone screen.
So the question:
How can I get the index of the last visible character of the text?
[How can I see it](https://i.stack.imgur.com/BS6k1.png)
| Android. TextView. Last visible character of the text | CC BY-SA 4.0 | 0 | 2021-08-15T09:40:56.267 | 2021-08-15T11:23:59.000 | null | null | 14,636,649 | [
"android",
"string",
"kotlin",
"textview",
"mobile-development"
] |
68,800,761 | 1 | null | null | 3 | 66 | I am working on a project to develop a mobile app using Laravel 8.
I have used Laravel sanctum for generating tokens and User authentication.
My project requires to call certain APIs prior to user login for displaying general data on the mobile app. What would be the best way to secure those APIs? I do not want anyone to call those APIs and retrieve information for their own purposes
| How to secure APIs for mobile Application without login authentication | CC BY-SA 4.0 | null | 2021-08-16T09:53:33.427 | 2021-08-16T09:53:33.427 | null | null | 16,297,856 | [
"laravel",
"jwt",
"mobile-development",
"laravel-sanctum"
] |
68,814,066 | 1 | 68,814,308 | null | 1 | 28 | My listview does not update after i click on my button, even though the function call (fillPickupList) fills the array with data, the listview still does not display anything, i even checked the size of the array after the async call in (fillpickupList) function the size says 1. But when i reload the app, using hotreload it temporarily displays the data before reloading the app, it also does the same thing when i hotrestart the app.
```
class OrdersPage extends StatefulWidget {
final String coursecode;
const OrdersPage({Key? key, required this.coursecode}) : super(key: key);
@override
_OrdersPageState createState() => _OrdersPageState();
}
class _OrdersPageState extends State<OrdersPage> {
List<OrdersClass> pendingList = [];
List<OrdersClass> clearedList = [];
bool showPendingPickups = true;
// Map<String,dynamic> eachDocument = {};
void fillPickupList() async {
pendingList = [];
print("size of pending list ${pendingList.length}"); //this prints out zero
await FirebaseFirestore.instance
.collection('Computer science')
.doc("orders")
.collection(widget.coursecode.replaceAll(" ", "").trim().toLowerCase())
.get()
.then(
(QuerySnapshot querySnapshot) => querySnapshot.docs.forEach((doc) {
Map<String, dynamic> eachDocument =
doc.data() as Map<String, dynamic>;
(eachDocument.isEmpty)
? print(doc.id)
: this.pendingList.add(OrdersClass(
firstname: eachDocument["firstname"],
lastname: eachDocument["lastname"],
matnumber: eachDocument["matnumber"],
id: eachDocument["id"],
date: eachDocument["date"],
documentId: doc.id,
pending: true));
}));
print(
"in pending list .. ${pendingList.first.firstname}"); //This prints out the firstname
}
void fillClearedList() async {
// print (widget.coursecode.replaceAll(" ", "").trim().toLowerCase());
await FirebaseFirestore.instance
.collection('Computer science')
.doc("clearedorders")
.collection(widget.coursecode.replaceAll(" ", "").trim().toLowerCase())
.get()
.then(
(QuerySnapshot querySnapshot) => querySnapshot.docs.forEach((doc) {
Map<String, dynamic> eachDocument =
doc.data() as Map<String, dynamic>;
(eachDocument.isEmpty)
? print(doc.id)
: clearedList.add(OrdersClass(
firstname: eachDocument["firstname"],
lastname: eachDocument["lastname"],
matnumber: eachDocument["matnumber"],
id: eachDocument["id"],
date: eachDocument["date"],
documentId: doc.id,
pending: true));
// print (doc.id);
}));
}
@override
void initState() {
// TODO: implement initState
super.initState();
FirebaseFirestore.instance;
// fillPickupList();
// fillClearedList();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
body: Container(
child: Column(
children: [
Container(
height: 100,
child: GridView.count(crossAxisCount: 2, children: [
GestureDetector(
onTap: () {
setState(() {
this.showPendingPickups = true;
// pendingList = [];
});
fillPickupList();
},
child: Card(
child: Center(
child: Text(
"Pending Pickups",
style: TextStyle(
fontSize: 20,
fontStyle: FontStyle.italic,
color: Colors.blue),
),
),
),
),
GestureDetector(
onTap: () {
setState(() {
showPendingPickups = false;
});
fillClearedList();
},
child: Card(
child: Center(
child: Text(
"Picked Up",
style: TextStyle(
fontSize: 20,
fontStyle: FontStyle.italic,
color: Colors.blue),
),
),
),
)
]),
),
Padding(padding: EdgeInsets.only(bottom: 15)),
(showPendingPickups)
? Text(
//prints this successfully
"Pending Pickups ",
style: TextStyle(
fontStyle: FontStyle.italic,
fontWeight: FontWeight.bold,
decoration: TextDecoration.underline,
),
)
: Text(
"Cleared Pickups",
style: TextStyle(
fontStyle: FontStyle.italic,
fontWeight: FontWeight.bold,
decoration: TextDecoration.underline,
),
),
Padding(padding: EdgeInsets.only(bottom: 5)),
(this.showPendingPickups)
? Container(
//does not print this on button tap.
//make this dynamic
height: 300,
child: ListView.separated(
itemBuilder: (context, index) {
// return ListTile(
// leading:
// Text("the $index"), //pendingList[index].date
// title: Text(pendingList[index].firstname +
// " " +
// pendingList[index].lastname +
// "\n" +
// pendingList[index].matnumber),
// subtitle: Text("userid: " + pendingList[index].id),
// trailing: ElevatedButton(
// onPressed: () async {
// // moveUserToPickedUp(
// // index: index, date: pendingList[index].date, firstname: pendingList[index].firstname,
// // documentID: pendingList[index].documentId,
// // id: pendingList[index].id, lastname: pendingList[index].lastname,
// // matnumber: pendingList[index].matnumber);
// // setState(() {
// //
// // });
// },
// child: Text("PickedUp"),
// ),
// );
return Text("the $index");
},
separatorBuilder: (context, index) {
return Divider();
},
itemCount: pendingList.length),
)
: Container(
height: 300,
child: ListView.separated(
itemBuilder: (context, index) {
return ListTile(
leading:
Text("cleared list"), //clearedList[index].date
title: Text(clearedList[index].firstname +
" " +
clearedList[index].lastname +
"\n" +
clearedList[index].matnumber),
subtitle: Text("userid: " + clearedList[index].id),
trailing: ElevatedButton(
onPressed: () async {
// moveUserToPickedUp(
// index: index, date: pendingList[index].date, firstname: pendingList[index].firstname,
// documentID: pendingList[index].documentId,
// id: pendingList[index].id, lastname: pendingList[index].lastname,
// matnumber: pendingList[index].matnumber);
// setState(() {
//
// });
},
child: Text("PickedUp"),
),
);
},
separatorBuilder: (context, index) {
return Divider();
},
itemCount: clearedList.length),
)
],
),
),
);
}
}
```
| ListView not updating after GesutreDetector onPressed | CC BY-SA 4.0 | null | 2021-08-17T08:28:26.833 | 2021-08-17T08:45:45.877 | null | null | 12,453,564 | [
"flutter",
"mobile-development"
] |
68,839,003 | 1 | null | null | 0 | 96 | I am trying to layout the approach and various technologies I would use to create a "fully" offline mobile app with react native. I have settled on the database(SQLite) and frontend frameworks. Seeing as I can't really have a "backend" because nothing is going to be connected to the internet. The app will be taking data from the user, "manipulating" it, and giving it back to the user. I'm just confused where the "manipulation" comes in if there isn't a backend.
Documentation online regarding offline mobile apps isn't very extensive.
| is there a way you can have a backend in a fully offline mobile app with react native | CC BY-SA 4.0 | null | 2021-08-18T20:34:57.773 | 2021-08-18T20:34:57.773 | null | null | null | [
"react-native",
"native",
"offline",
"mobile-development"
] |
68,840,694 | 1 | null | null | 1 | 62 | I am using a notification listener and trying to get the name of the app that sent the notification. I tried using the PackageManager class to get the name of the app, however, I keep getting a NameNotFoundException every time I get a notification. Here is my code:
```
public class NotificationListener extends NotificationListenerService {
private final ArrayList<Integer> postedIds = new ArrayList<>();
@Override
public void onNotificationPosted(StatusBarNotification sbn) {
ArrayList<Integer> connectedThreadNotifications = new ArrayList<>();
for (BluetoothConnectionThread bluetoothConnectionThread :
Utils.getCurrentlyRunningThreads()) {
connectedThreadNotifications.add(bluetoothConnectionThread.getNotificationID());
}
if (sbn.getId() != 800 && !connectedThreadNotifications.contains(sbn.getId())) {
if (!postedIds.contains(sbn.getId())) {
postedIds.add(sbn.getId());
HashMap<String, Object> notification = new HashMap<>();
try {
PackageManager packageManager = getApplicationContext().getPackageManager();
ApplicationInfo appInfo = packageManager.getApplicationInfo(sbn.getPackageName(), 0);
String appName = packageManager.getApplicationLabel(appInfo).toString();
notification.put("appName", appName);
} catch (PackageManager.NameNotFoundException e) {
notification.put("appName", "Unknown");
}
notification.put("title", sbn.getNotification().extras.get("android.title"));
notification.put("subText", sbn.getNotification().extras.get("android.subText"));
notification.put("text", sbn.getNotification().extras.get("android.text"));
notification.put("infoText", sbn.getNotification().extras.get("android.infoText"));
Gson gson = new Gson();
System.out.println(gson.toJson(notification));
}
}
}
@Override
public void onNotificationRemoved(StatusBarNotification sbn) {
if (postedIds.contains(sbn.getId())) {
postedIds.remove((Integer) sbn.getId());
}
}
public void broadcastNotification() {
}
}
```
Any idea how I can get this to work?
| Getting NameNotFoundException when trying to get name of app from StatusBarNotification | CC BY-SA 4.0 | null | 2021-08-19T00:29:24.667 | 2021-09-08T23:47:58.710 | null | null | 13,936,354 | [
"java",
"android",
"notifications",
"mobile-development"
] |
68,857,698 | 1 | 68,858,377 | null | 1 | 77 |
1. I have build a flat list in which customers name are there only names.
2. Now i want to click on that names to show customers details i have details in fire store database.
3. Just need your help to solve this.
4. there is a name and email in this screen there a lot more about this detail in database. like contact number, area, time and date etc.
```
import React, { useEffect, useState } from 'react';
import { FlatList, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
import { db } from "../firebase";
function DetailsScreen() {
const [contacts, setContacts] = useState([]);
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth() + 1;
var yyyy = today.getFullYear();
today = mm + '/' + dd + '/' + yyyy;
// 'createdDate', '>=', last7DayStart FOR LAST WEEK THIS LOGIC
// 'createdDate', '>=', lastMonthThisDay FOR LAST MONTH THIS LOGIC
// var last7DayStart = moment().startOf('day').subtract(1, 'week').format('M/DD/YYYY');
// var lastMonthThisDay = moment().startOf('day').subtract(1, 'month').format('M/DD/YYYY');
// var yesterdayEndOfRange = moment().endOf('day').subtract(1, 'day').format('D/MM/YYYY');
// console.log(last7DayStart);
useEffect(() => {
const fetchData = async () => {
const data = await db.collection("contacts").where('createdDate', '<', today).get();
setContacts(data.docs.map((doc) => ({ ...doc.data(), id: doc.id })));
};
fetchData();
}, []);
function handleUpdate() {
alert("updated")
};
function handleDelete() {
alert("Successfully Removed")
};
return (
<FlatList
style={styles.list}
data={contacts}
renderItem={({ item }) => <Text style={styles.text} numberOfLines={9}>
<Text style={styles.text1}> Student Details </Text>
{"\n"}
{"\n"}
Name: {item.name}
{"\n"}
Email: {item.email}
<TouchableOpacity
onPress={() => handleUpdate()} style={{ paddingTop: 10 }}>
<Text style={{ borderWidth: 0.80 }}> Update </Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() => handleDelete()} style={{ paddingLeft: 20 }}>
<Text style={{ borderWidth: 0.75 }}> Delete </Text>
</TouchableOpacity>
</Text>}
/>
)
};
export default DetailsScreen;
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'flex-start',
alignItems: 'flex-start',
paddingTop: 5,
},
text: {
fontSize: 15,
fontStyle: 'italic',
paddingLeft: 15,
marginHorizontal: 20,
borderBottomWidth: 1,
paddingBottom:10
},
list: {
flex: 1,
paddingTop: 10,
backgroundColor: '#fff'
},
text1: {
flex: 1,
fontSize: 18,
fontWeight: 'bold',
paddingTop:5
}
});
```
| Hi everyone i have build a flatlist in which names are there now i want to click on that name to show its details | CC BY-SA 4.0 | null | 2021-08-20T06:14:05.550 | 2021-08-20T17:00:57.757 | 2021-08-20T06:59:01.560 | 15,362,465 | 15,362,465 | [
"reactjs",
"react-native",
"mobile-development"
] |
68,869,408 | 1 | null | null | 9 | 1,493 | I was trying to compile and install on my iPhone the app I am developing for iOS, everything was fine until at some point XCode started giving me problems, I attach the detail:
```
Details
Unable to install "Runner"
Domain: com.apple.dt.MobileDeviceErrorDomain
Code: -402653081
Recovery Suggestion: Please check your project settings and ensure that a valid product has been built.
--
There was an internal API error.
Domain: com.apple.dt.MobileDeviceErrorDomain
Code: -402653081
User Info: {
DVTRadarComponentKey = 261622;
MobileDeviceErrorCode = "(0xE8000067)";
"com.apple.dtdevicekit.stacktrace" = (
0 DTDeviceKitBase 0x000000011e735e98 DTDKCreateNSErrorFromAMDErrorCode + 272
1 DTDeviceKitBase 0x000000011e771898 __90-[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:]_block_invoke + 160
2 DVTFoundation 0x000000010523f670 DVTInvokeWithStrongOwnership + 76
3 DTDeviceKitBase 0x000000011e7715e4 -[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:] + 1316
4 IDEiOSSupportCore 0x000000011e5ebd40 __118-[DVTiOSDevice(DVTiPhoneApplicationInstallation) processAppInstallSet:appUninstallSet:installOptions:completionBlock:]_block_invoke.294 + 2928
5 DVTFoundation 0x00000001053687fc __DVT_CALLING_CLIENT_BLOCK__ + 16
6 DVTFoundation 0x000000010536a220 __DVTDispatchAsync_block_invoke + 680
7 libdispatch.dylib 0x000000019592e128 _dispatch_call_block_and_release + 32
8 libdispatch.dylib 0x000000019592fec0 _dispatch_client_callout + 20
9 libdispatch.dylib 0x00000001959376a8 _dispatch_lane_serial_drain + 620
10 libdispatch.dylib 0x00000001959382a4 _dispatch_lane_invoke + 404
11 libdispatch.dylib 0x0000000195942b74 _dispatch_workloop_worker_thread + 764
12 libsystem_pthread.dylib 0x0000000195adb89c _pthread_wqthread + 276
13 libsystem_pthread.dylib 0x0000000195ada5d4 start_wqthread + 8
);
}
--
System Information
macOS Version 11.5.2 (Build 20G95)
Xcode 12.5.1 (18212) (Build 12E507)
Timestamp: 2021-08-21T02:59:59+02:00
```
I am also attaching what the Android Studio IDE tells me:
```
No Provisioning Profile was found for your project's Bundle Identifier or your
device. You can create a new Provisioning Profile for your project in Xcode for
your team by:
1- Open the Flutter project's Xcode target with
open ios/Runner.xcworkspace
2- Select the 'Runner' project in the navigator then the 'Runner' target
in the project settings
3- Make sure a 'Development Team' is selected under Signing & Capabilities > Team.
You may need to:
- Log in with your Apple ID in Xcode first
- Ensure you have a valid unique Bundle ID
- Register your device with your Apple Developer Account
- Let Xcode automatically provision a profile for your app
4- Build or run your project again
It's also possible that a previously installed app with the same Bundle
Identifier was signed with a different certificate.
For more information, please visit:
https://flutter.dev/setup/#deploy-to-ios-devices
Or run on an iOS simulator without code signing
════════════════════════════════════════════════════════════════════════════════
Could not run build/ios/iphoneos/Runner.app on 00008101-001C09912180001E.
Try launching Xcode and selecting "Product > Run" to fix the problem:
open ios/Runner.xcworkspace
Error launching application on iPhone.
```
In I have the account that I have registered in Apple developer portal, I also have seated the Team in the and the Bundler identifier
| xCode: Unable to install "Runner" issue on flutter | CC BY-SA 4.0 | 0 | 2021-08-21T01:11:26.507 | 2022-12-27T17:08:14.190 | 2021-12-22T09:01:40.070 | 6,045,800 | 16,717,003 | [
"ios",
"iphone",
"xcode",
"flutter",
"mobile-development"
] |
68,880,769 | 1 | null | null | 2 | 1,262 | TypeError: null is not an object (evaluating 'RNFetchBlob.DocumentDir') Anyone can help me out with this error please RNFetchblob i have installed and imported successfully also.
```
import RNFetchBlob from 'rn-fetch-blob';
const downloadImage = () => {
let date = new Date()
let image_URL = IMAGE_PATH
let ext = getExtention(image_URL)
ext = '.' + ext[0]
const { config, fs } = RNFetchBlob
let PictureDir = fs.dirs.PictureDir
let options = {
fileCache: true,
addAndroidDownloads: {
useDownloadManager: true,
notification: true,
path: PictureDir + '/image_' +
Math.floor(date.getTime() + date.getSeconds() / 2) + ext,
description: 'Image'
}
}
config(options)
.fetch('GET', image_URL)
.then(res => {
console.log('res -> ', JSON.stringify(res))
alert('Image Donwload Successfully')
})
}
```
| TypeError: null is not an object (evaluating 'RNFetchBlob.DocumentDir'). After importing RNFetchBlob this error is coming can anyone please help me | CC BY-SA 4.0 | null | 2021-08-22T11:16:04.177 | 2021-08-22T12:44:46.233 | null | null | 15,362,465 | [
"javascript",
"reactjs",
"react-native",
"hybrid-mobile-app",
"mobile-development"
] |
68,883,970 | 1 | null | null | 1 | 217 | I have this design i am trying to recreate, i want to make a landing page such that when the user swipes it will move on to the next image, replacing the current one, using listView or scrollable Widget i do not get the desired effect, any ideas on how i can acheive this, any link to a resource i could read up on would be great.
[](https://i.stack.imgur.com/qd8Fw.png)
| How to make a landing page in flutter | CC BY-SA 4.0 | null | 2021-08-22T18:12:09.227 | 2021-08-23T03:13:14.887 | null | null | 12,453,564 | [
"flutter",
"mobile-development"
] |
68,893,054 | 1 | 68,903,921 | null | 2 | 86 | I have build a search engine and I am able to fetch data successfully the only thing I want to do is whenever that searched field is selected, it will show the details. (There are further details are also present like age,house_no etc.) It is like another screen have to come with full details.
I am stuck here, please help me out. It is like navigation to another screen with full details for now I am using alert command to show the some details I want another screen please. Thanks.
```
import React, {useState, useEffect} from 'react';
import {
SafeAreaView,
Text,
StyleSheet,
View,
FlatList,
TextInput,
} from 'react-native';
import { db } from '../firebase';
const App = () => {
const [search, setSearch] = useState('');
const [filteredDataSource, setFilteredDataSource] = useState([]);
const [masterDataSource, setMasterDataSource] = useState([]);
useEffect(() => {
const fetchData = async () => {
const data = await db
.collection('Data')
.get();
setFilteredDataSource(data.docs.map((doc) => ({ ...doc.data(), id: doc.id })));
setMasterDataSource(data.docs.map((doc) => ({ ...doc.data(), id: doc.id })));
};
fetchData();
}, []);
const searchFilterFunction = (text) => {
if (text) {
const newData = masterDataSource.filter(
function (item) {
const itemData = item.FM_NAME_EN + item.EPIC_NO + item.MOBILE_NO
? item.FM_NAME_EN.toUpperCase() + item.EPIC_NO.toUpperCase() + item.MOBILE_NO
: ''.toUpperCase();
const textData = text.toUpperCase();
return itemData.indexOf(textData) > -1;
});
setFilteredDataSource(newData);
setSearch(text);
} else {
setFilteredDataSource(masterDataSource);
setSearch(text);
}
};
const ItemView = ({item}) => {
return (
<Text
style={styles.itemStyle}
onPress={() => getItem(item)}>
{item.FM_NAME_EN}
{'\n'}
{item.GENDER.toUpperCase()}
</Text>
);
};
const ItemSeparatorView = () => {
return (
// Flat List Item Separator
<View
style={{
height: 0.5,
width: '100%',
backgroundColor: '#C8C8C8',
}}
/>
);
};
const getItem = (item) => {
alert('Name : ' + item.FM_NAME_EN + ' Epic_no : ' + item.EPIC_NO);
};
return (
<SafeAreaView style={{flex: 1}}>
<View style={styles.container}>
<TextInput
style={styles.textInputStyle}
onChangeText={(text) => searchFilterFunction(text)}
value={search}
underlineColorAndroid="transparent"
placeholder="Search Here"
/>
<FlatList
data={filteredDataSource}
keyExtractor={(item, index) => index.toString()}
ItemSeparatorComponent={ItemSeparatorView}
renderItem={ItemView}
/>
</View>
</SafeAreaView>
);
};
const styles = StyleSheet.create({
container: {
backgroundColor: 'white',
},
itemStyle: {
padding: 10,
},
textInputStyle: {
height: 40,
borderWidth: 1,
paddingLeft: 20,
margin: 5,
borderColor: '#009688',
backgroundColor: '#FFFFFF',
},
});
export default App;
```
| How to see the full details of particular member when it is clicked after search? | CC BY-SA 4.0 | null | 2021-08-23T12:51:16.970 | 2021-08-24T08:09:45.563 | 2021-08-23T13:36:09.893 | 12,358,693 | 15,362,465 | [
"reactjs",
"react-native",
"hybrid-mobile-app",
"mobile-development"
] |
68,955,890 | 1 | null | null | 1 | 1,625 | noob developer here.
I’ve just finished coding my first simple program using C++ in Xcode (that’s the only language I know for now), and I would love to turn it into an IOS app but I can’t seem to find a way to do it other than learning Swift and rewriting it all. Am I missing something here? Thanks.
| Is there a way to make an IOS App using C++? | CC BY-SA 4.0 | null | 2021-08-27T15:22:22.980 | 2021-08-27T16:20:19.413 | null | null | 16,359,749 | [
"c++",
"ios",
"xcode",
"mobile",
"mobile-development"
] |
68,996,573 | 1 | 68,999,337 | null | -1 | 369 | I've been working on a Flutter app for a few days now.
I've implemented a [NavigationRail](https://api.flutter.dev/flutter/material/NavigationRail-class.html) for my app. It works pretty well, excepted for one thing.
When I tap on a [NavigationRailDestination](https://api.flutter.dev/flutter/material/NavigationRailDestination-class.html), it calls the function and goes to the required route.
My problem is that, the property udpates, but then, when the new route is loaded, the selectedIndex goes back to 0.
Here is my code :
```
class SidebarDrawer extends StatefulWidget {
final VoidCallback callbackOnScreenChange;
SidebarDrawer({@required this.callbackOnScreenChange});
@override
_SidebarDrawerState createState() => _SidebarDrawerState();
}
class _SidebarDrawerState extends State<SidebarDrawer> {
int index = 0;
@override
Widget build(BuildContext context) => NavigationRail(
extended: isExtended,
onDestinationSelected: (index) => updateRoute(index),
selectedIndex: index,
leading: IconButton(
icon: Icon(Icons.reorder),
onPressed: () => setState(() => isExtended = !isExtended),
),
destinations: <NavigationRailDestination>[
<Some NavigationRailDestination>
],
);
void updateRoute(index) {
setState(() => this.index = index);
switch (index) {
case 0:
return navigateToScreen(
context, '/home', widget.callbackOnScreenChange);
case 1:
return navigateToScreen(
context, '/orderManager', widget.callbackOnScreenChange);
case 2:
return navigateToScreen(
context, '/manualControl', widget.callbackOnScreenChange);
default:
return navigateToScreen(
context, '/home', widget.callbackOnScreenChange);
}
}
```
The function navigateToScreen() :
```
/// Navigate to given widget
void navigateToScreen(BuildContext context, String route,
VoidCallback callbackOnScreenChange) async {
// Call callback on screen change
if (callbackOnScreenChange != null) {
callbackOnScreenChange();
}
// Check the current route
String currentRoute = ModalRoute.of(context).settings.name;
// If the current route is not the same as the new route change the screen
if (currentRoute != route) {
await Navigator.pushNamed(context, route);
}
}
```
I am new to Flutter, I am struggling a bit to understand how does the state works and updates.
I would really appreciate if you could help me understand it please !
| How to update the selectedIndex after calling my own function inside the NavigationRail? | CC BY-SA 4.0 | 0 | 2021-08-31T09:53:51.107 | 2021-08-31T13:12:54.450 | null | null | 11,771,991 | [
"android",
"flutter",
"dart",
"setstate",
"mobile-development"
] |
69,086,392 | 1 | 69,266,739 | null | 0 | 1,525 | I want to add an auto scrolling system in flutter for few seconds. My is generating a loop of infinity widgets.
Is it possible to scroll this loop for few seconds by clicking on a button?
```
return Container(
height: 125,
width: ScreenSize.width * 0.3,
child: ListWheelScrollView.useDelegate(
diameterRatio: 1,
squeeze: 1.8,
itemExtent: 75,
physics: FixedExtentScrollPhysics(),
onSelectedItemChanged: (index) => print(index),
childDelegate: ListWheelChildLoopingListDelegate(
children: List<Widget>.generate(
slotNames.length,
(index) => Padding(
padding: const EdgeInsets.all(3.0),
child: Container(
decoration: BoxDecoration(
border: Border.all(
color: Colors.blue,
),
borderRadius: BorderRadius.circular(10.0),
),
child: Image.asset(
"assets/$index.png",
width: double.infinity,
height: double.infinity,
),
),
),
),
),
),
);
```
[](https://i.stack.imgur.com/O34lE.gif)
| Flutter ListWheelScrollView.useDelegate Make Auto Scroll for few seconds | CC BY-SA 4.0 | null | 2021-09-07T10:18:42.697 | 2021-09-21T09:44:08.270 | null | null | 11,340,437 | [
"flutter",
"mobile-development",
"flutter-design"
] |
69,243,378 | 1 | null | null | 1 | 216 | ```
Where:
Build file 'C:\Users\****\StudioProjects\testing_app\android\build.gradle' line: 24
* What went wrong:
A problem occurred evaluating root project 'android'.
> A problem occurred configuring project ':app'.
> Could not open proj generic class cache for build file 'C:\Users\****\StudioProjects\testing_app\android\app\build.gradle' (C:\Users\****\.gradle\caches\6.7\scripts\c51ajzpii95tma58d2uea49kr).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 60
* 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.
```
[Screenshot of error](https://i.stack.imgur.com/J0Zzu.png)
| A problem occurred evaluating root project 'android'. flutter dart | CC BY-SA 4.0 | null | 2021-09-19T12:41:02.347 | 2021-09-27T02:52:06.667 | 2021-09-27T02:52:06.667 | 8,253,209 | 16,949,873 | [
"android",
"flutter",
"android-studio",
"dart",
"mobile-development"
] |
69,396,249 | 1 | null | null | 1 | 264 | I am trying to implement a white-label application in react native where I could build and bundle an app without importing "everything" from the project.
For example, I might have `assets_app1` folder weigh 10MB and `assets_app2` weigh 1MB. I get always 11mb in the end, regardless of what project I am compiling and bundling for production.
I have checked multiple sources on how to build white-label with `flavours` and `targets` on Android and iOS respectively, looked up [babel-plugin-module-resolver](https://github.com/tleunen/babel-plugin-module-resolver), but wasn't able to find and build a perfect solution.
The best I could find is [this solution](https://levelup.gitconnected.com/white-label-mobile-app-with-react-native-and-babel-490363ec59) using babel resolver to set the root of the project and use only the components that are needed for the app.
something like this:
```
const brandPath = `./App/brands/${process.env.APP_BRAND}`;
console.log(`Bundling for the brand: ${process.env.APP_BRAND}`);
module.exports = function(api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
plugins: [
['module-resolver', {
root: ['./App', brandPath, './App/brands/default']
}]
]
};
};
```
However, I get a bundle of all files that are included in the project even if I use `require('./reallyLargeImage.png') somewhere in one project. It will always be the same size.
Is there any solution to white labelling a RN application that could build and bundle only the necessary resources for specific config? Is targets/falvours the only way?
| React Native WhiteLabel Application | CC BY-SA 4.0 | null | 2021-09-30T17:05:14.910 | 2021-10-01T06:25:46.423 | null | null | 12,375,343 | [
"android",
"ios",
"react-native",
"babeljs",
"mobile-development"
] |
69,427,289 | 1 | 69,438,357 | null | -1 | 394 | I have tried to import uvc camera project into android studio and after I sync the gradle I try to run the application .But then I get an error and I couldn't solve it.
The Error -:
> Task :opencv:ndkBuild FAILED
Execution failed for task ':opencv:ndkBuild'.
A problem occurred starting process 'command 'null/ndk-build.cmd''
I also attached a screenshot
[](https://i.stack.imgur.com/5kB6M.png)
| Error message: createProcess error=2, The system cannot find the file specified | CC BY-SA 4.0 | null | 2021-10-03T17:30:00.297 | 2021-10-04T15:11:51.667 | 2021-10-03T17:50:36.960 | 522,444 | 17,065,527 | [
"java",
"php",
"android",
"android-studio",
"mobile-development"
] |
69,476,799 | 1 | 69,537,931 | null | 0 | 580 | I have an application where I have a tab screen and few screens.
From tab I navigate in order screen 1 -> screen 2 -> screen 3 .
From screen 3's button click, I want to open screen - 4 i.e listing screen and on backpress I want to navigate agin tab screen.
I dont want to reset full stack using `props.navigation.reset({index: 0,routes: [{name: "home"}],});`, also number of navigating screen between tab screen and screen 4 is not fixed so I can't use `props.navigation.pop(3)` also.
Can anyone guide me, how to achieve this?
Thanks in advance
| How to jump from one screen to another and clear all other screen from stack in ReactNative? | CC BY-SA 4.0 | null | 2021-10-07T07:06:23.013 | 2021-10-12T09:15:51.460 | null | null | 6,920,068 | [
"react-native",
"react-native-navigation",
"mobile-development",
"react-native-navigation-v2"
] |
69,521,321 | 1 | 69,525,728 | null | 2 | 125 | I'm aware that I can create a QR code a user can scan to go to my mobile app's page on App Store or Google Play and install it.
My question is if there's a way for me to include a specific ID in the QR code that I can store on the device to installation when the user scans the QR code. Then after the installation I want my app to check for this ID.
Here's the problem I'm trying to solve. The client we're building the app for has an affiliate program and wants to know which affiliate got a user to install their app. So, the QR code would be specific to the affiliate. All QR codes will point to the same app on App Store and Google Play but also include the affiliate's ID.
This is fairly easy to achieve on a web app. Just not sure if it's possible on mobile apps.
BTW, we're building the app in React Native/Expo.
| Store an ID before installing an app from QR code | CC BY-SA 4.0 | null | 2021-10-11T05:13:53.003 | 2021-10-11T11:49:15.930 | null | null | 1,705,266 | [
"react-native",
"google-play",
"expo",
"app-store",
"mobile-development"
] |
69,598,121 | 1 | 69,598,212 | null | -1 | 567 | I am an android developer new to flutter and i am trying to create 3 grey text widgets where when a user clicks one, the clicked one becomes blue while the others remain grey. This is the code i currently have
```
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: const <Widget>[
InkWell(
child: Text('Click 3',
style: TextStyle(
color: Colors.indigo,
fontSize: 15.0,
fontWeight: FontWeight.bold,
)),
onTap: () => Colors.blue,
),
InkWell(
child: Text('Click 2',
style: TextStyle(
color: Colors.indigo,
fontSize: 15.0,
fontWeight: FontWeight.bold,
)),
onTap: () => Colors.blue,
),
InkWell(
child: Text('Click 3',
style: TextStyle(
color: Colors.indigo,
fontSize: 15.0,
fontWeight: FontWeight.bold,
)),
onTap: () => Colors.blue,
),
],
),
```
Also whatever i put in onTap() i get the error that says
```
invalid constant value
```
| Changing Text Color onTap, Flutter | CC BY-SA 4.0 | null | 2021-10-16T17:43:33.443 | 2021-10-16T17:53:45.990 | null | null | 9,374,735 | [
"ios",
"flutter",
"dart",
"mobile-development"
] |
69,765,894 | 1 | null | null | 0 | 101 | what are options available to run the tasks in background on a regular intervals from mobile
I am using Xamarin forms and developing app for both iOS and Android.
any help will be appreciated
| Repeated service call - Xamarin forms | CC BY-SA 4.0 | null | 2021-10-29T08:36:37.150 | 2021-10-30T01:08:40.650 | null | null | 7,275,524 | [
"c#",
".net",
"xamarin",
"xamarin.forms",
"mobile-development"
] |
69,801,280 | 1 | 72,978,047 | null | 8 | 1,548 | Suppose I have a list of packages which I want to add in my flutter project. I can do the job by simply adding those packages in `pubspec.yaml` file and then in command line write this command `flutter pub get` and get all those packages in my app. But If I want to do the same thing by command line how to do that?
Like to add a single package what we do is `flutter pub add xxx`. What if I want to add multiple packages at the same time in project with a single command line. I have searched but did not get any clue.
| Add multiple packages in single command in flutter | CC BY-SA 4.0 | null | 2021-11-01T18:35:49.850 | 2022-07-14T09:12:45.063 | null | null | 10,599,979 | [
"flutter",
"flutter-dependencies",
"mobile-development"
] |
69,862,077 | 1 | null | null | 0 | 634 | i am getting values from server to dropdown which are inserted previous from static list of dropdown values, but i need to use dropdown when value from server is 'Pending' to update specific record, below my code.
```
List<String> approvalList = ['Pending', 'Approve', 'Discard'];
String dropdownValue="Pending";
Container(
height: MediaQuery.of(context).size.height*0.3,
width: MediaQuery.of(context).size.width,
child:StreamBuilder<List<ApprovalModel>>(
stream: bloc.approvalsStream,
initialData: [],
builder: (context, snapshot) {
return ListView.builder(
itemCount: snapshot.data!.length,
itemBuilder: (context,i){
return snapshot.connectionState==ConnectionState.waiting?Lottie.asset(
'assets/lottieloading.json',
width: 70,
height: 70,
fit: BoxFit.fill,
):ListTile(
title: Text(snapshot.data![i].approverName),
trailing: StatefulBuilder(
builder: (BuildContext context, StateSetter setState) {
return DropdownButton<String>(
value: snapshot.data![i].status==0?'Pending':
snapshot.data![i].status==1?'Approve':
'Discard',
items: approvalList.map((String val) {
return DropdownMenuItem<String>(
value: val,
child: new Text(val),
);
}).toList(),
hint: Text(selectedValue),
onChanged: (val) {
setState(() {
dropdownValue = val!;
});
});
}
),
);
});
}
)
,
),
```
As You see i am setting value from server it is working fine, but when the value is pending i want to use the dropdown to update record in database.
| Flutter issue: DropDown in ListView.Builder | CC BY-SA 4.0 | null | 2021-11-06T07:09:49.037 | 2021-11-06T07:38:42.263 | null | null | 10,313,576 | [
"android",
"flutter",
"mobile-development",
"flutter-dropdownbutton"
] |
69,988,685 | 1 | null | null | 0 | 340 | Im a flutter and noob, and having problems trying too convert latitude and longitude to a current address in flutter using geocoding and store in firebase/firestore in an app im trying to develop. The App stores latitude and longitude in firestore once the user .logs in and enables live loocation, the current latitude and longitude are displayed but the current address is yet to be displayed.
```
import 'dart:async';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:demo/model/user_model.dart';
import 'package:demo/screens/liveMap.dart';
import 'package:geocoding/geocoding.dart';
import 'package:demo/screens/login_screen.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:location/location.dart' as loc;
import 'package:permission_handler/permission_handler.dart';
class HomeScreen extends StatefulWidget {
@override
_HomeScreenState createState() => _HomeScreenState();
}
class _HomeScreenState extends State<HomeScreen> {
User? user = FirebaseAuth.instance.currentUser;
UserModel loggedInUser = UserModel();
final loc.Location location = loc.Location();
StreamSubscription<loc.LocationData>? _locationSubscription;
@override
void initState() {
super.initState();
FirebaseFirestore.instance
.collection('users')
.doc(user!.uid)
.get()
.then((value) {
this.loggedInUser = UserModel.fromMap(value.data());
setState(() {});
});
}
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Welcome'),
centerTitle: true,
),
body: Center(
child: Padding(
padding: EdgeInsets.all(20),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
height: 130,
child: Image.asset(
'assets/images/logo.png',
fit: BoxFit.contain,
),
),
TextButton(
onPressed: () {
_getLocation();
},
child: Text('Enable Live Location'),
),
TextButton(
onPressed: () {
_stopListening();
},
child: Text('Stop Live Location'),
),
Expanded(
child: StreamBuilder(
stream: FirebaseFirestore.instance
.collection('location')
.snapshots(),
builder: (context, AsyncSnapshot<QuerySnapshot> snapshot) {
if (!snapshot.hasData) {
return Center(
child: CircularProgressIndicator(),
);
}
return ListView.builder(
itemCount: snapshot.data?.docs.length,
itemBuilder: (context, index) {
return ListTile(
title: Text(
snapshot.data!.docs[index]['name'].toString()),
subtitle: Row(
children: [
Text(snapshot.data!.docs[index]['latitude']
.toString()),
SizedBox(width: 20),
Text(snapshot.data!.docs[index]['longitude']
.toString()),
],
),
trailing: IconButton(
onPressed: () {
Navigator.of(context).push(MaterialPageRoute(
builder: (context) =>
LiveMap(snapshot.data!.docs[index].id)));
},
icon: Icon(Icons.directions),
),
);
});
},
)),
SizedBox(
height: 10,
),
Text(
'${loggedInUser.name}',
style: TextStyle(color: Colors.black54),
),
Text(
'${loggedInUser.email}',
style: TextStyle(color: Colors.black54),
),
SizedBox(
height: 15,
),
ActionChip(
label: Text('Logout'),
onPressed: () {
logout(context);
})
],
),
),
),
);
}
Future<void> logout(BuildContext context) async {
await FirebaseAuth.instance.signOut();
Navigator.of(context).pushReplacement(
MaterialPageRoute(builder: (context) => LoginScreen()));
}
Future<void> _getLocation() async {
_locationSubscription = location.onLocationChanged.handleError((onError) {
print(onError);
_locationSubscription?.cancel();
setState(() {
_locationSubscription = null;
});
}).listen((loc.LocationData currentLocation) async {
await FirebaseFirestore.instance.collection('location').doc('user1').set({
'latitude': currentLocation.latitude,
'longitude': currentLocation.longitude,
'name': '${loggedInUser.name}',
''
}, SetOptions(merge: true));
});
}
_stopListening() {
_locationSubscription?.cancel();
setState(() {
_locationSubscription = null;
});
}
```
| how to convert latitude and longtitude to a current address in flutter, get time in and time out and time duration and store in firebase | CC BY-SA 4.0 | null | 2021-11-16T11:53:29.480 | 2021-12-26T04:50:42.110 | null | null | 10,301,370 | [
"flutter",
"dart",
"mobile-development"
] |
70,007,633 | 1 | null | null | 0 | 641 | I've laptop having specification as
1. inten i5 10th gen
2. 8GB RAM
3. 256 SSD
4. nvidia mx250
Can I run android studio properly/smoothly ??
| Minimum hardware requirement for android studio in 2021/022? | CC BY-SA 4.0 | null | 2021-11-17T15:55:39.480 | 2021-11-17T16:33:18.200 | null | null | 17,297,801 | [
"java",
"android",
"android-studio",
"kotlin",
"mobile-development"
] |
70,041,513 | 1 | null | null | 0 | 240 | I am trying to load all my markers into Google Map for the other users to see. I'm using Flutter for developing my app in the android studio. The markers are saved in the firebase Realtime Database. There are latitude and longitude and post sections for each marker. The post is a text that displays a msg for other users upon clicking on the marker.
[My firebase RTBD looks like this](https://i.stack.imgur.com/Zl1ye.jpg)
[and how my markers are represented in the page](https://i.stack.imgur.com/pARjr.jpg)
The JSON file is like this:
```
{
"users" : {
"SR7Z4qYbFEPXTelucOyTTHoiI433" : {
"email" : "user1@gmail.com",
"marker" : {
"latitude" : 34.16599,
"longitude" : -118.26079333333334,
"posts" : "coffee?"
},
"phone" : "1111111111",
"uid" : "SR7Z4qYbFEPXTelucOyTTHoiI433",
"username" : "user1"
},
"UwzHxCPeE9dD1Owq8iZeqDyQ2Ar2" : {
"email" : "user2@gmail.com",
"marker" : {
"latitude" : 34.146993333333334,
"longitude" : -118.243845,
"posts" : "library?"
},
"phone" : "2222222222",
"uid" : "UwzHxCPeE9dD1Owq8iZeqDyQ2Ar2",
"username" : "user2"
},
"wyyV5pErxFhaYdSJPVJShZdH6FC3" : {
"email" : "user3@gmail.com",
"marker" : {
"latitude" : 34.05831,
"longitude" : -117.82177166666666,
"posts" : "good food?"
},
"phone" : "3333333333",
"uid" : "wyyV5pErxFhaYdSJPVJShZdH6FC3",
"username" : "user3"
}
}
}
```
The output that I print in debugger works, however, the markers are non shown correctly. For example, initially, the marker is in the user2 location and when I create the post again the marker stays there.
by adding:
```
print(key);
print((values['marker'])["latitude"]);
print((values['marker'])["longitude"]);
```
```
I/flutter ( 6509): SR7Z4qYbFEPXTelucOyTTHoiI433
I/flutter ( 6509): 34.16599
I/flutter ( 6509): -118.26079333333334
I/flutter ( 6509): ------------------------
I/flutter ( 6509): wyyV5pErxFhaYdSJPVJShZdH6FC3
I/flutter ( 6509): 34.05831
I/flutter ( 6509): -117.82177166666666
I/flutter ( 6509): ------------------------
I/flutter ( 6509): UwzHxCPeE9dD1Owq8iZeqDyQ2Ar2
I/flutter ( 6509): 34.146993333333334
I/flutter ( 6509): -118.243845
I/flutter ( 6509): ------------------------
```
This is what I did but for some reasons, the loop is unable to go to the next one!
```
Set<Marker> _markers = {};
void _activeListeners() {
double latitude;
double longitude;
final db = FirebaseDatabase.instance.reference().child("users");
db.once().then((DataSnapshot snapshot) {
Map<dynamic, dynamic> values = snapshot.value;
values.forEach((key, values) {
//print(key);
//setState(() {
_markers.add(
Marker(
position: LatLng((values['marker'])["latitude"], (values['marker'])["longitude"]),
markerId: MarkerId("Marker_Id"),
onTap: () {
// showAlertDialog(context);
}),
); //_markers.add
print("------------------------");
}
);
});
// });
}
```
| How to load all the custom markers from firebase RTDB into google map in flutter(dart) for other users to see? | CC BY-SA 4.0 | null | 2021-11-19T22:20:42.640 | 2021-12-02T13:31:58.967 | 2021-11-23T19:54:59.100 | 17,451,868 | 17,451,868 | [
"android",
"flutter",
"dart",
"firebase-realtime-database",
"mobile-development"
] |
70,093,296 | 1 | 71,825,362 | null | 2 | 262 | I am publishing an app built with Flutter to play store for internal testing, but it appears a dialog show that the app can't be installed.
The problem happened in Samsung S21 Ultra
I am able to install it in Samsung Galaxy Tab A 10.5
[](https://i.stack.imgur.com/23KEd.jpg)
| Google play store internal testing can't install in Samsung S21 Ultra | CC BY-SA 4.0 | null | 2021-11-24T09:07:54.597 | 2022-04-11T09:24:59.590 | null | null | 9,478,226 | [
"android",
"flutter",
"google-play",
"mobile-development",
"google-play-internal-testing"
] |
70,109,067 | 1 | 70,109,390 | null | 0 | 72 | In Android, I used textScaleX to stretch the font. I also used autoSizeTextType to make the font's size responsive. Any idea how to do that in Flutter?
```
<Button
android:id="@+id/buttonMinus"
android:layout_width="0dp"
android:layout_height="0dp"
android:text="-"
android:textScaleX="1.8"
app:autoSizeTextType="uniform"
app:autoSizeMaxTextSize="36sp" />
```
| What is the equivalent of textScaleX and autoSizeTextType in Flutter | CC BY-SA 4.0 | null | 2021-11-25T09:57:54.847 | 2021-11-25T10:22:34.327 | null | null | 4,617,883 | [
"android",
"flutter",
"mobile-development"
] |
70,150,644 | 1 | null | null | 1 | 57 | [Click this link to see my problem](https://i.stack.imgur.com/PzPrZ.png)
please I need help how do I fix this?
| How do I resize my android emulator? software display is just on the top left corner the rest of the screen is just black | CC BY-SA 4.0 | null | 2021-11-29T06:41:02.047 | 2021-11-29T08:01:49.867 | null | null | 17,537,970 | [
"java",
"android",
"android-studio",
"emulation",
"mobile-development"
] |
70,154,495 | 1 | null | null | 0 | 13 | I have many locations of accounts saved in database with their latitude and longitude and theses accounts are sent from backend and I display them as a list.
I want to point my mobile in a specific direction and only accounts in this direction will be displayed on screen.
I tried to use the compass and sent its degree to backend but it wasn't accurate and the accounts displayed are not the real accounts that exist in the direction I want.
| How to filter accounts list according to the direction that mobile is pointed at? | CC BY-SA 4.0 | null | 2021-11-29T12:15:52.407 | 2021-11-29T12:15:52.407 | null | null | 17,539,842 | [
"android",
"ios",
"backend",
"mobile-development"
] |
70,236,994 | 1 | null | null | 0 | 927 | I have a few constants that need to be stored such as List of menu options, default color etc.Where is the best place to store such constants and what would be the best format( declare a class,just static file etc) ?
| Where can I store constants for a flutter app? | CC BY-SA 4.0 | null | 2021-12-05T17:49:52.233 | 2021-12-05T18:06:29.477 | null | null | 10,548,214 | [
"android",
"flutter",
"dart",
"flutter-layout",
"mobile-development"
] |
70,238,138 | 1 | null | null | 0 | 266 | I need to display gif in my Flutter application. From the backend I get the gif as an Uint8List list from the response. Can you help me please how can I display this in the screen?
My code is here:
```
widget.session
.get('/api/caff/getCaff/' + widget.gifId.toString())
.then((response) async {
if (response.statusCode == 200) {
Uint8List bytes = response.bodyBytes;
_gifFile = File.fromRawPath(bytes); // tried this but didn't work
} else {
CaffToast.showError(
'Something went wrong! Please check your network connection!');
}
});
```
And I tried to display it as a file image but it didnt work:
```
@override
Widget build(BuildContext context) {
return Container(
child: Column(
children: [
_gifFile == null ? Container() : Container(
decoration: BoxDecoration(
image: DecorationImage(
image: FileImage(_gifFile!))),
),
],
),
);
}
```
Do you have any suggestions how can I solve this problem?
| Flutter display gif from Uint8List | CC BY-SA 4.0 | null | 2021-12-05T20:11:29.513 | 2021-12-05T20:38:23.717 | null | null | 12,566,403 | [
"flutter",
"gif",
"mobile-development",
"uint8list"
] |
70,257,358 | 1 | null | null | 2 | 845 | FAILURE: Build failed with an exception.
- Where:
Build file '/home/jhondev/Android/myapp/android/app/build.gradle' line: 158- What went wrong:
A problem occurred evaluating project ':app'.
> Could not find method compile() for arguments [project ':react-native-google-places'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
- 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](https://help.gradle.org)
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See [https://docs.gradle.org/7.0.2/userguide/command_line_interface.html#sec:command_line_warnings](https://docs.gradle.org/7.0.2/userguide/command_line_interface.html#sec:command_line_warnings)
BUILD FAILED in 2s
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
[https://facebook.github.io/react-native/docs/getting-started.html](https://facebook.github.io/react-native/docs/getting-started.html)
error Command failed: ./gradlew app:installDebug. Run CLI with --verbose flag for more details.
[](https://i.stack.imgur.com/WYN9g.png)
| Could not find method compile() for arguments project react-native-google-places | CC BY-SA 4.0 | null | 2021-12-07T09:03:23.877 | 2021-12-07T09:03:23.877 | null | null | 14,895,186 | [
"android",
"react-native",
"android-studio",
"mobile-development"
] |
70,278,424 | 1 | 70,278,484 | null | -2 | 346 | I am developing an application aimed at helping school students. Therefore, I do not understand which database to use. The main language is . I will use it as to develop an application for two operating systems(IOS and Android) at once.
| Which database is better for multiplatform developing? Firebase or Realm? | CC BY-SA 4.0 | null | 2021-12-08T16:28:03.443 | 2021-12-08T16:31:56.163 | null | null | 15,125,588 | [
"database",
"firebase",
"realm",
"kotlin-multiplatform",
"mobile-development"
] |
70,411,609 | 1 | null | null | 3 | 656 | I'm looking into Uno Platform and trying to run [Getting-Started-Tutorial-1](https://platform.uno/docs/articles/getting-started-tutorial-1.html) on my laptop. It's very simple: [demo](https://i.stack.imgur.com/hVfVc.gif). But it takes 10 sec to load this simple page on localhost.
On [UnoConf](https://unoconf.com) it was said that [Uno Gallery](https://gallery.platform.uno) is written in uno platform. I measured the time when user see a page and when all background data is loaded. Results:
- - -
Page reload without clearing the cache takes almost the same time.
For comparison I opened [Vuetify Gallery](https://vuetifyjs.com/en/components/alerts/). It takes 3 sec to show page to a user and total load is 30 sec (27 sec page was loaded in the background). So, user see the page and can interact with it in 3 sec.
Is it real Uno Platform WASM performance? Is it the same in mobile apps (Android and iOS)? Any solutions how to speed it up? Can you recommend other frameworks to develop mobile apps + web with better performance?
| Uno Platform WASM performance: good / acceptable / terrible | CC BY-SA 4.0 | null | 2021-12-19T12:57:38.740 | 2022-07-09T13:17:41.143 | 2021-12-19T15:48:21.883 | 17,708,799 | 17,708,799 | [
"web",
"mobile",
"mobile-development",
"uno-platform"
] |
70,530,882 | 1 | 70,530,920 | null | 4 | 8,739 | I'm working on my first Flutter project, I'm building a Login page, I created a variable to store a TextFormFieldController but I got the error above because I deleted the constructor.
When I return this constructor I cant declare a global variable to store the TextFormFieldController.
this is my code : (the Login page) :
```
import 'package:flutter/material.dart';
class LoginScreen extends StatelessWidget {
var loginUsernameController = TextEditingController();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
body: Padding(
padding: const Edge
Insets.all(20.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
"Login",
style: TextStyle(fontSize: 40, fontWeight: FontWeight.bold),
),
const SizedBox(
height: 40,
),
TextFormField(
decoration: const InputDecoration(
labelText: "Email Address",
border: OutlineInputBorder(),
prefixIcon: Icon(Icons.email),
),
keyboardType: TextInputType.emailAddress,
),
const SizedBox(
height: 10,
),
TextFormField(
controller: TextEditingController(),
obscureText: true,
decoration: const InputDecoration(
labelText: "Password",
border: OutlineInputBorder(),
prefixIcon: Icon(Icons.lock),
suffixIcon: Icon(Icons.remove_red_eye),
),
keyboardType: TextInputType.emailAddress,
),
const SizedBox(
height: 20,
),
Container(
width: double.infinity,
child: MaterialButton(
onPressed: () {},
child: const Text(
"LOGIN",
style: TextStyle(color: Colors.white),
),
color: Colors.blue,
),
)
],
),
),
);
}
}
```
this is the main.dart (Where I got the error) :
```
import 'package:flutter/material.dart';
import 'login_screen.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return const MaterialApp(
debugShowCheckedModeBanner: false,
home: LoginScreen(),
);
}
}
```
| Flutter error : The constructor being called isn't a const constructor | CC BY-SA 4.0 | null | 2021-12-30T11:17:07.620 | 2021-12-30T11:34:43.643 | null | null | 14,815,045 | [
"flutter",
"dart",
"mobile",
"mobile-development"
] |
70,547,373 | 1 | 70,605,519 | null | 1 | 2,370 | First day of 2022~! Learning mobile app dev is giving headaches. It can't be this difficult to set up. I've already lost 6 hours. Please help!
My dev environment runs in Ubuntu via VMWare hosted on Windows 10. Within this environment I have:
- -
-
```
Network Error
at node_modules/axios/lib/core/createError.js:15:17 in createError
at node_modules/axios/lib/adapters/xhr.js:114:22 in handleError
at node_modules/react-native/Libraries/Network/XMLHttpRequest.js:609:10 in setReadyState
at node_modules/react-native/Libraries/Network/XMLHttpRequest.js:396:6 in __didCompleteResponse
at node_modules/react-native/Libraries/vendor/emitter/_EventEmitter.js:135:10 in EventEmitter#emit
```
(abbreviated)
```
axios.post('http://localhost:5000/user/login', some-data)
```
- - - -
| Can't send HTTP requests to Localhost Backend from React Native Mobile App | CC BY-SA 4.0 | null | 2022-01-01T06:59:47.060 | 2022-01-06T10:09:57.457 | 2022-01-01T13:23:54.130 | 9,744,790 | 9,744,790 | [
"android",
"node.js",
"react-native",
"expo",
"mobile-development"
] |
70,562,485 | 1 | null | null | 1 | 408 | I try to add a package name as new_version: ^0.2.3. After the terminal return the below error. How can I fix this?
FAILURE: Build failed with an exception.
Where:
Build file 'D:\User\Projects\Flutter\apptech_beta-master.android\Flutter\build.gradle' line: 33
What went wrong:
A problem occurred evaluating project ':flutter'.
> Could not get unknown property 'compileSdkVersion' for extension 'flutter' of type FlutterExtension.
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](https://help.gradle.org)
BUILD FAILED in 1s
This is the build.gradle file
exception: Gradle task assembleStagingDebug failed with exit code 1
```
def flutterPluginVersion = 'managed'
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
compileSdkVersion 30
buildToolsVersion = '30.0.2'
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
defaultConfig {
applicationId "com.app.app"
minSdkVersion 22
targetSdkVersion 30
versionCode 13
versionName "2.1"
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
}
}
flavorDimensions "flavor"
productFlavors {
staging {
dimension "flavor"
}
}
}
buildDir = new File(rootProject.projectDir, "../build/host")
dependencies {
implementation project(':flutter')
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation platform('com.google.firebase:firebase-bom:28.3.1')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.android.material:material:1.4.0'
}
enter code here
```
| How to fix this issue ? FAILURE: Build failed with an exception | CC BY-SA 4.0 | null | 2022-01-03T06:52:48.427 | 2022-04-24T13:54:05.623 | null | null | 13,422,114 | [
"android",
"flutter",
"dart",
"build.gradle",
"mobile-development"
] |
70,600,512 | 1 | null | null | 0 | 39 | I am developing an app comprising a ListView with items that can be clicked to get edited, but try as I might, coding the class ([AlarmsActivity](https://github.com/Detective-Khalifah/MEDIC_--_Localised_Personal_Health_Tracker_Extended/blob/master/app/src/main/java/com/blogspot/thengnet/medic/AlarmsActivity.java)) - ln 65 to ln 90 - that displays the list items to consume a click event, that will open up an activity, where it can be handled isn't functioning; it does work in the [adapter class](https://github.com/Detective-Khalifah/MEDIC_--_Localised_Personal_Health_Tracker_Extended/blob/master/app/src/main/java/com/blogspot/thengnet/medic/AlarmsAdapter.java) - ln 76 to ln 100 - that manages the list items, but such class is bereft of context and other elements I'll eventually need in development. How do I solve it?
I'm trying to do it this way:
```
binding.listviewAlarms.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick (AdapterView<?> adapterView, View row, int position, long id) {
/**
* Dummy data to send to {@link EditAlarmActivity}
* TODO: set up a database to contain the data, and use id to fetch data from it
* instead of passing the data from this {@link AlarmsActivity}
*/
mSelectedAlarmParamsList.addAll(Collections.singleton(alarms.toString()));
// mSelectedScheduleParamsList.add(binding.listviewSchedules.getChildAt(position).toString()); // id of the selected CardView
Alarm selectedAlarm = alarms.get(position);
mSelectedAlarmParams.putStringArray("selected-alarm", new String[]{
selectedAlarm.getTitle(), selectedAlarm.getDescription(),
selectedAlarm.getStartDate(), selectedAlarm.getStartTime(),
selectedAlarm.getEndDate(), selectedAlarm.getEndTime()
}
);
Log.v(this.getClass().getName(), "List item " + position + " clicked!!!");
Snackbar.make(row, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
Toast.makeText(appContext, "List item " + position + " clicked.", Toast.LENGTH_SHORT).show();
startActivity(new Intent(appContext, EditAlarmActivity.class).putExtras(mSelectedAlarmParams));
finish();
}
});
```
| Why isn't this ListItem click handler working? | CC BY-SA 4.0 | null | 2022-01-05T22:49:10.817 | 2022-01-06T02:27:25.897 | null | null | 12,865,343 | [
"android",
"android-listview",
"event-handling",
"listitem",
"mobile-development"
] |
70,613,657 | 1 | 70,613,803 | null | 0 | 251 | I have a function that takes some json and puts the entire object into a dynamic list. I am having trouble looping over that list using the futurebuilder. I always get "the getter 'length' isn't defined for the class 'Future<List>" error. same for the title.
What is the correct way to do this? To access this list in a futurebuilder or listbuilder.
Thanks alot in advance.
```
class _HomeScreenState extends State<HomeScreen> {
final storage = new FlutterSecureStorage();
Future<List<dynamic>> _loadedProducts;
@override
void initState() {
_loadedProducts = _getPolicy();
super.initState();
}
Future<void> _getPolicy() async {
final url = Uri.parse('https://jsonplaceholder.typicode.com/todos/1');
try {
final response = await http.get(url);
final extractedData = json.decode(response.body);
final List<dynamic> loadedProducts = [];
extractedData.forEach((prodId, prodData) {
loadedProducts.addAll(extractedData);
});
_loadedProducts = loadedProducts;
print(_loadedProducts);
} catch (error) {
print('---error-');
throw (error);
}
```
}
Here is the code for the futurebuilder
```
FutureBuilder<List<dynamic>>(
future: _loadedProducts,
builder: (context, snapshot) {
if (snapshot.hasData) {
return AnimatedList(
initialItemCount: snapshot.data.length,
itemBuilder:
(BuildContext context, int index,
Animation animation) {
return new Text(_loadedProducts.title.toString());
},
);
} else if (snapshot.hasError) {
return Text("${snapshot.error}");
}
// By default, show a loading spinner.
return CircularProgressIndicator();
},
);
```
| Futurebuild with dynamic list | CC BY-SA 4.0 | null | 2022-01-06T21:11:15.793 | 2022-01-06T21:43:48.230 | null | null | 14,171,970 | [
"android",
"list",
"flutter",
"dart",
"mobile-development"
] |
70,661,886 | 1 | 70,661,948 | null | 0 | 40 | This is my code which i am using to buld a search bar which shows me the result in the below of the search bar dynamically like facebook or Instagram do.But its not happening i tried multiple times but when i put value in the search it is calling once and then again i have refresh it to get the Api data.
```
import React, { useEffect, useState } from 'react';
import { createStackNavigator } from '@react-navigation/stack';
import searchScreen from './searchScreen';
import { View, Text, Dimensions, TextInput } from 'react-native';
import colors from '../../../res/colors';
export default function searchNavigator() {
const Stack = createStackNavigator();
const [text, setText] = useState("");
const [dataSource, setDataSource] = useState([]);
useEffect(() => {
async function getData(text) {
const api = 'http://188.166.189.237:3001/api/v1/profile/';
await fetch(api + text)
.then((response) => response.json())
.then((responseJson) => {
setDataSource(responseJson)
console.log("Search Data", dataSource);
})
.catch((error) => {
console.log("Seach error", error);
})
};
getData();
}, []);
```
This is the search input where i am putting the value of the search text which is connected to Api. It would be more appreciable if anyone can help me out with this, thanks in advance.
```
<View style={{
marginHorizontal: 5, marginVertical: 10, justifyContent: "center",
alignItems: "center"
}}>
<TextInput
style={{
backgroundColor: colors.textInputBackground,
height: 35,
width: Dimensions.get('screen').width - 10,
fontWeight: 'bold',
borderRadius: 10,
paddingStart: 20,
fontSize: 16,
color: 'white',
}}
onChangeText={(text) => setText(text)}
placeholder="Search"
placeholderTextColor={colors.textFaded2}
/>
</View>
```
| Dynamic Search is not getting build, Data is always showing undefined in the console | CC BY-SA 4.0 | null | 2022-01-11T05:07:43.093 | 2022-01-11T05:15:25.747 | null | null | 15,362,465 | [
"reactjs",
"react-native",
"react-hooks",
"mobile-development"
] |
70,823,224 | 1 | null | null | 0 | 280 | I am trying to display a list of images with different sizes and i want to display them with there full height and width, but the images are not loading on the screen if i didn't specified the height in the image control.
code :
```
<Grid>
<CollectionView ItemsSource="{Binding ImgList}">
<CollectionView.ItemTemplate>
<DataTemplate>
<Grid RowDefinitions="Auto,Auto" ColumnDefinitions="Auto,*">
<Label>Image:</Label>
<Image Grid.Row="1" Grid.ColumnSpan="2" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" Aspect="AspectFill" Source="{Binding .}"></Image>
</Grid>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</Grid>
```
note: ImgList is an observableCollection of Images name string.
| Xamarin Image not Loading | CC BY-SA 4.0 | null | 2022-01-23T14:46:24.547 | 2022-01-25T06:39:43.097 | null | null | 16,445,022 | [
"xamarin",
"xamarin.forms",
"mobile-development"
] |
70,824,134 | 1 | 70,832,557 | null | 0 | 1,225 | I am facing an error trying to implement Stripe payment with react native and Expo SDK.
The scenario is very simple where I add items to the cart and then choose payment option as card to pay, but when I click on Card an error shows up. the error and code are below.
```
import { StatusBar } from "expo-status-bar";
import React from "react";
import {
StyleSheet,
Text,
View,
Button,
Pressable,
Platform,
} from "react-native";
import { StripeProvider } from "@stripe/stripe-react-native";
import { initStripe, useStripe } from "@stripe/stripe-react-native";
import GooglePayMark from "./GooglePayMark";
import ApplePayMark from "./ApplePayMark";
const API_URL = "http://192.168.0.163:3000";
const ProductRow = ({ product, cart, setCart }) => {
const modifyCart = (delta) => {
setCart({ ...cart, [product.id]: cart[product.id] + delta });
};
return (
<View style={styles.productRow}>
<View style={{ flexDirection: "row" }}>
<Text style={{ fontSize: 17, flexGrow: 1 }}>
{product.name} - {product.price}$
</Text>
<Text style={{ fontSize: 17, fontWeight: "700" }}>
{cart[product.id]}
</Text>
</View>
<View
style={{
flexDirection: "row",
justifyContent: "space-between",
marginTop: 8,
}}
>
<Button
disabled={cart[product.id] <= 0}
title="Remove"
onPress={() => modifyCart(-1)}
/>
<Button title="Add" onPress={() => modifyCart(1)} />
</View>
</View>
);
};
const ProductsScreen = ({ products, navigateToCheckout }) => {
/**
* We will save the state of the cart here
* It will have the inital shape:
* {
* [product.id]: 0
* }
*/
const [cart, setCart] = React.useState(
Object.fromEntries(products.map((p) => [p.id, 0]))
);
const handleContinuePress = async () => {
/* Send the cart to the server */
const URL = `${API_URL}/create-payment-intent`;
const response = await fetch(URL, {
method: "POST",
headers: {
"Content-Type": "application-json",
},
body: JSON.stringify(cart),
});
/* Await the response */
const { publishableKey, clientSecret, merchantName } =
await response.json();
/* Navigate to the CheckoutScreen */
/* You can use navigation.navigate from react-navigation */
navigateToCheckout({
publishableKey,
clientSecret,
merchantName,
cart,
products,
});
};
return (
<View style={styles.screen}>
{products.map((p) => {
return (
<ProductRow key={p.id} product={p} cart={cart} setCart={setCart} />
);
})}
<View style={{ marginTop: 16 }}>
<Button title="Continue" onPress={handleContinuePress} />
</View>
</View>
);
};
/**
* CheckoutScreen related components
*/
const CartInfo = ({ products, cart }) => {
return (
<View>
{Object.keys(cart).map((productId) => {
const product = products.filter((p) => p.id === productId)[0];
const quantity = cart[productId];
return (
<View
key={productId}
style={[{ flexDirection: "row" }, styles.productRow]}
>
<Text style={{ flexGrow: 1, fontSize: 17 }}>
{quantity} x {product.name}
</Text>
<Text style={{ fontWeight: "700", fontSize: 17 }}>
{quantity * product.price}$
</Text>
</View>
);
})}
</View>
);
};
const MethodSelector = ({ onPress, paymentMethod }) => {
// ...
return (
<View style={{ marginVertical: 48, width: "75%" }}>
<Text
style={{
fontSize: 14,
letterSpacing: 1.5,
color: "black",
textTransform: "uppercase",
}}
>
Select payment method
</Text>
{/* If there's no paymentMethod selected, show the options */}
{!paymentMethod && (
<Pressable
onPress={onPress}
style={{
flexDirection: "row",
paddingVertical: 8,
alignItems: "center",
}}
>
{Platform.select({
ios: <ApplePayMark height={59} />,
android: <GooglePayMark height={59} />,
})}
<View style={[styles.selectButton, { marginLeft: 16 }]}>
<Text style={[styles.boldText, { color: "#007DFF" }]}>Card</Text>
</View>
</Pressable>
)}
{/* If there's a paymentMethod selected, show it */}
{!!paymentMethod && (
<Pressable
onPress={onPress}
style={{
flexDirection: "row",
justifyContent: "space-between",
alignItems: "center",
paddingVertical: 8,
}}
>
{paymentMethod.label.toLowerCase().includes("apple") && (
<ApplePayMark height={59} />
)}
{paymentMethod.label.toLowerCase().includes("google") && (
<GooglePayMark height={59} />
)}
{!paymentMethod.label.toLowerCase().includes("google") &&
!paymentMethod.label.toLowerCase().includes("apple") && (
<View style={[styles.selectButton, { marginRight: 16 }]}>
<Text style={[styles.boldText, { color: "#007DFF" }]}>
{paymentMethod.label}
</Text>
</View>
)}
<Text style={[styles.boldText, { color: "#007DFF", flex: 1 }]}>
Change payment method
</Text>
</Pressable>
)}
</View>
);
};
const CheckoutScreen = ({
products,
navigateBack,
publishableKey,
clientSecret,
merchantName,
cart,
}) => {
// We will store the selected paymentMethod
const [paymentMethod, setPaymentMethod] = React.useState();
// Import some stripe functions
const { initPaymentSheet, presentPaymentSheet, confirmPaymentSheetPayment } =
useStripe();
// Initialize stripe values upon mounting the screen
React.useEffect(() => {
(async () => {
await initStripe({
publishableKey,
// Only if implementing applePay
// Set the merchantIdentifier to the same
// value in the StripeProvider and
// striple plugin in app.json
merchantIdentifier: "yourMerchantIdentifier",
});
// Initialize the PaymentSheet with the paymentIntent data,
// we will later present and confirm this
await initializePaymentSheet();
})();
}, []);
const initializePaymentSheet = async () => {
const { error, paymentOption } = await initPaymentSheet({
paymentIntentClientSecret: clientSecret,
customFlow: true,
merchantDisplayName: merchantName,
style: "alwaysDark", // If darkMode
googlePay: true, // If implementing googlePay
applePay: true, // If implementing applePay
merchantCountryCode: "ES", // Countrycode of the merchant
testEnv: __DEV__, // Set this flag if it's a test environment
});
if (error) {
console.log(error);
} else {
// Upon initializing if there's a paymentOption
// of choice it will be filled by default
setPaymentMethod(paymentOption);
}
};
const handleSelectMethod = async () => {
const { error, paymentOption } = await presentPaymentSheet({
confirmPayment: false,
});
if (error) {
alert(`Error code: ${error.code}`, error.message);
}
setPaymentMethod(paymentOption);
};
const handleBuyPress = async () => {
if (paymentMethod) {
const response = await confirmPaymentSheetPayment();
if (response.error) {
alert(`Error ${response.error.code}`);
console.error(response.error.message);
} else {
alert("Purchase completed!");
}
}
};
return (
<View style={styles.screen}>
<CartInfo cart={cart} products={products} />
<MethodSelector
onPress={handleSelectMethod}
paymentMethod={paymentMethod}
/>
<View
style={{
flexDirection: "row",
justifyContent: "space-between",
alignSelf: "stretch",
marginHorizontal: 24,
}}
>
<Pressable onPress={navigateBack}>
<Text style={[styles.textButton, styles.boldText]}>Back</Text>
</Pressable>
<Pressable style={styles.buyButton} onPress={handleBuyPress}>
<Text style={[styles.boldText, { color: "white" }]}>Buy</Text>
</Pressable>
</View>
</View>
);
};
const AppContent = () => {
const products = [
{
price: 10,
name: "Pizza Pepperoni",
id: "pizza-pepperoni",
},
{
price: 12,
name: "Pizza 4 Fromaggi",
id: "pizza-fromaggi",
},
{
price: 8,
name: "Pizza BBQ",
id: "pizza-bbq",
},
];
const [screenProps, setScreenProps] = React.useState(null);
const navigateToCheckout = (screenProps) => {
setScreenProps(screenProps);
};
const navigateBack = () => {
setScreenProps(null);
};
return (
<View style={styles.container}>
{!screenProps && (
<ProductsScreen
products={products}
navigateToCheckout={navigateToCheckout}
/>
)}
{!!screenProps && (
<CheckoutScreen {...screenProps} navigateBack={navigateBack} />
)}
</View>
);
};
export default function App() {
return (
<StripeProvider>
<AppContent />
</StripeProvider>
);
}
```
so having this code I was able to get the application running and the items were added to the cart but when I click on card option the error shows up.
I believe the error is generated at the CheckoutScreen.
[error showing](https://i.stack.imgur.com/UJCLt.jpg)
| Error when implementing stripe payment with react native expo | CC BY-SA 4.0 | null | 2022-01-23T16:23:07.090 | 2022-01-24T10:46:29.330 | 2022-01-23T16:34:39.370 | 14,000,366 | 14,000,366 | [
"android",
"react-native",
"expo",
"stripe-payments",
"mobile-development"
] |
70,857,457 | 1 | null | null | 0 | 83 | I am trying to hide a numbers keyboard programmatically with java and I used this code in a `onClick` of a button
```
InputMethodManager inputMethodManager =(InputMethodManager)getSystemService(Activity.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
```
But as a result when the user click the first time the numbers keyboard become strings keyboard (normal keyboard) and when the user click the 2nd time the keyboard hides.
I want the keyboard get hide from the first click, any help ?
| How do I hide keyboard programmatically with java | CC BY-SA 4.0 | null | 2022-01-26T00:41:29.960 | 2022-01-27T13:52:35.107 | 2022-01-27T13:52:35.107 | 455,020 | 17,742,229 | [
"java",
"android",
"android-studio",
"mobile",
"mobile-development"
] |
70,947,176 | 1 | null | null | 50 | 45,341 | I updated my android studio from Android studio fox to Android studio Bumblebee 2021.1.1
but none of my projects can run in . I ended up getting this beautiful error.
![Open to view image](https://i.stack.imgur.com/6zNZF.png)
Here is my gradle file
```
plugins {
id 'com.android.application' version '7.1.0' apply false
id 'com.android.library' version '7.1.0' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
```
| Bumblebee Android studio Plugin [id: 'com.android.application', version: '7.1.0', apply: false] was not found in any of the following sources: | CC BY-SA 4.0 | 0 | 2022-02-01T20:34:28.700 | 2023-02-12T17:15:27.727 | 2022-12-19T10:07:07.813 | 619,673 | 15,721,032 | [
"java",
"android",
"android-studio",
"mobile-development",
"android-update-app"
] |
70,991,350 | 1 | null | null | 0 | 144 | My Application crashes sometimes after location listener I started.
with The Error bellow
2022-02-03 13:05:26.458 2383-2383/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.casontek.farmconnect, PID: 2383
java.lang.AbstractMethodError: abstract method "void android.location.LocationListener.onStatusChanged(java.lang.String, int, android.os.Bundle)"
at android.location.LocationManager$ListenerTransport._handleMessage(LocationManager.java:299)
at android.location.LocationManager$ListenerTransport.-wrap0(Unknown Source:0)
at android.location.LocationManager$ListenerTransport$1.handleMessage(LocationManager.java:237)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6524)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:451)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:888)
2022-02-03 14:05:09.685 13052-13052/? E/AndroidRuntime: FATAL EXCEPTION: main
```
private val locationListener = LocationListener {
//your code here
latitude = it.latitude
longitude = it.longitude
Log.i("_&loc", "location detail: ${it.latitude}, ${it.longitude}")
}
if(ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
&& ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED){
if(locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)){
val manager = getSystemService(Context.LOCATION_SERVICE) as LocationManager
manager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 20000L, 500F, locationListener)
}
}
<uses-feature android:name="android.hardware.location"
android:required="true"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
```
| My Application Crashes after listening to location service | CC BY-SA 4.0 | null | 2022-02-04T18:42:06.810 | 2022-02-04T18:42:06.810 | null | null | 7,173,453 | [
"java",
"android",
"kotlin",
"mobile-development"
] |
70,995,346 | 1 | null | null | 1 | 56 | I am trying to make an app which I am learning from Udemy. The code doesn't read the text in map.i don't know what is wrong and its doesn't say the code is wrong.
```
import 'package:flutter/material.dart';
import './question.dart';
import './answers.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return MyAppState();
}
}
class MyAppState extends State<MyApp> {
var _questionIndex = 0;
void _answerQuestion() {
setState(() {
_questionIndex = _questionIndex + 1;
});
print(_questionIndex);
}
@override
Widget build(BuildContext context) {
var questions = [
{
"question": "What's your favorite color",
"answers": ["green", "red", "blue"]
},
{
"question": "What is your favorite animal",
"answers": ["Tigress", "Viperous", "Mantis", "Panda"]
},
{
"question": "Your favorite instructor.",
"answers": ["Max", "Max", "Max", "Max", "Max"]
},
];
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('QUIZZ'),
centerTitle: true,
),
body: Column(
children: [
Question(
"questions[_questionIndex]['questionText']",
),
...(questions[_questionIndex]['answers'] as List<String>)
.map((answer) {
return Answer(_answerQuestion, answer);
}),
],
),
),
);
}
}
```
```
import 'package:flutter/material.dart';
class Question extends StatelessWidget {
final String questionText;
Question(this.questionText);
@override
Widget build(BuildContext context) {
return Container(
width: double.infinity,
margin: EdgeInsets.all(10),
child: Text(
questionText,
style: TextStyle(fontSize: 28.0),
textAlign: TextAlign.center,
),
);
}
}
```
```
import 'package:flutter/material.dart';
class Answer extends StatelessWidget {
final VoidCallback
selectHandler; // used "Function" instead of voidcallback and that was wrong;
String answerText;
Answer(this.selectHandler, this.answerText);
@override
Widget build(BuildContext context) {
return Container(
width: double.infinity,
child: RaisedButton(
color: Colors.blue,
textColor: Colors.white,
child: Text('Answer 1'),
onPressed: selectHandler,
),
);
}
}
```
[](https://i.stack.imgur.com/wEWIT.png)
I am supposed to get the text that is mapped but instead I get what is as string in Question().
I tried to change the String in question.dart to dynamic still it doesn't seem to work
| Map method does not recognize the strings | CC BY-SA 4.0 | null | 2022-02-05T04:35:50.473 | 2022-02-05T04:57:56.477 | null | null | 16,909,510 | [
"flutter",
"dart",
"mobile-development"
] |
71,002,149 | 1 | 71,007,141 | null | 0 | 164 | How do I effectively hide the sidemenu for printing only, when printing from desktop? I've tried adding CSS to ion-menu, which seems to work, except some things are still offset by the size of the menu (like headers). I'm sure there are other implications, such as different display resolutions or screen sizes if print is invoked from the browser.
Another thing I'm open to is having a whole new page just for printing, but I'm just trying to keep everything together so that I don't have to maintain two pages for the same thing.
| Ionic Print without Sidemenu on Desktop | CC BY-SA 4.0 | null | 2022-02-05T21:05:26.243 | 2022-02-06T12:30:49.580 | null | null | 3,152,516 | [
"angular",
"ionic-framework",
"mobile-development"
] |
71,090,765 | 1 | 71,090,805 | null | 0 | 124 | I am making an app in react-native but wherever I'm using text I want that to be constant as I set it.
For e.g - I don't want my text to be scaled if the user has increased the default font size of his device. In one word - I just want to all the default user preferences/settings on his device.
Thanks!
| I want to ignore default preferences set by the user in react-native | CC BY-SA 4.0 | null | 2022-02-12T09:50:59.603 | 2022-02-12T14:11:19.537 | null | null | null | [
"reactjs",
"react-native",
"mobile-development"
] |
71,092,085 | 1 | 71,100,290 | null | 2 | 1,094 | I created a react-native app, it is working fine.
If I generate a debug APK and install it on the devices, it works fine and fetches data from the local database as it should.
However, if generate `gradlew assembleRelease` the APK's are generated successfully, but when I install it on the devices it does not fetch data from the same network which it fetches from the same network if generate a debug APK.
[Here](https://github.com/sh4rif/react-native-restaurant-app) is the URL of the repo [https://github.com/sh4rif/react-native-restaurant-app](https://github.com/sh4rif/react-native-restaurant-app).
| React Native release apk does not fetch data from local network | CC BY-SA 4.0 | null | 2022-02-12T13:03:46.717 | 2022-02-17T05:04:50.607 | 2022-02-13T04:22:15.887 | 3,750,257 | 9,787,484 | [
"android",
"reactjs",
"react-native",
"apk",
"mobile-development"
] |
71,093,288 | 1 | null | null | 0 | 753 | [i hope this image help](https://i.stack.imgur.com/TokvJ.png)
[as well this one](https://i.stack.imgur.com/zyvPl.png)
when i try to use provider to call async function from another file I get the error.
i dont know that it's a problem in the methode where i call it or in the file that i created the function. at the end i will say thank you because stack overflow says add more details.
the code from pictures
```
void _saveForm() async {
var isValid = _form.currentState?.validate() as bool;
if (!isValid) {
return;
}
_form.currentState?.save();
print(_editedProduct);
if (_editedProduct.id == '') {
print('done');
// ignore: await_only_futures
await Provider.of<Products>(context, listen: false)
.addProduct(_editedProduct); // this is where i get the error.
} else {
Provider.of<Products>(context, listen: false)
.updateProduct(_editedProduct.id, _editedProduct);
}
Navigator.of(context).pop();
```
}
```
Future<void> addProduct(Product product) async {
var httpsUri = Uri(
scheme: 'scheme',
host: 'host',
path: 'path',
);
final uri = Uri.parse(
'host');
try {
var res = await http.post(uri,
body: json.encode({
'title': product.title,
'description': product.description,
'price': product.price,
'isFav': product.isFavorite,
'imageUrl': product.imageUrl
}));
final newProduct = Product(
title: product.title,
description: product.description,
price: product.price,
imageUrl: product.imageUrl,
id: DateTime.now().toString(),
);
_items.add(newProduct);
notifyListeners();
} catch (e) {
print(e);
}
// _items.insert(0, newProduct); // at the start of the list
```
}
| This expression has a type of 'void' so its value can't be used flutter dart | CC BY-SA 4.0 | 0 | 2022-02-12T15:36:47.217 | 2022-02-12T15:54:42.533 | null | null | 16,418,938 | [
"flutter",
"dart",
"mobile-development"
] |
71,145,418 | 1 | null | null | 1 | 43 | Is there any way to create and display music notation inside of a codenameone app?
For Java generally there are some libraries like for example JFugue that let you write music inside a program. Maybe also display it, i didn't try that out.
There is lilypond, which would work in a desktop environment if you were able to run it to make the pdf after generating the file itself.
I wrote a small app in Android Studio and had to write my own music notation logic and drew it with the help of png files on a Canvas. That worked okay for small musical examples of a clef and around 2-7 notes.
Now i want to do something similar in Codenameone and display at least a clef and some notes inside the app (maybe as an image) - they have to be generated with some random element while the program runs.
It would also be great to be able to write and show more than a few notes, displaying it somehow and maybe also with the ability to have it as a pdf file later.
Is it possible to use something that already exists?
Thanks a lot!
| Is there any way to create and display music notation inside of a codenameone app? | CC BY-SA 4.0 | 0 | 2022-02-16T16:15:53.913 | 2022-02-16T16:15:53.913 | null | null | 16,581,562 | [
"cross-platform",
"codenameone",
"mobile-development",
"music-notation"
] |
71,182,395 | 1 | 71,183,589 | null | 0 | 541 | I want to allow a user to click on an button on my to create a new term page. I want a button to be created for navigating to that term. I have created the button to add terms but I can't figure out how to give the newly created button an EventHandler for navigation. This is what I have so far:
```
private string crrntTerm;
private List<Term> termList;
private void addTermBtnForTest()
{
Term termTest = new Term()
{
TermTitle = "Term 1",
CreateDate = System.DateTime.Now
};
using (SQLiteConnection conn = new SQLiteConnection(App.FilePath))
{
conn.CreateTable<Term>();
conn.Insert(termTest);
crrntTerm = termTest.TermID.ToString();
termList = conn.Table<Term>().ToList();
}
Button testBtn = new Button()
{
TextColor = Color.Black,
FontAttributes = FontAttributes.Bold,
FontSize = 20,
Margin = 30,
BackgroundColor = Color.White,
Clicked += GoToTermButton_Clicked //Error: Invalid initializer member declarator
};
testBtn.BindingContext = termTest;
testBtn.SetBinding(Button.TextProperty, "TermTitle");
layout.Children.Add(testBtn);
}//end addTermBtnForTest
private async void GoToTermButton_Clicked(object sender, EventArgs e)
{
// Code to go to appropriate page
}
```
| How to create a button clicked EventHandler in Xamarin.Forms with code-behind? | CC BY-SA 4.0 | null | 2022-02-19T05:21:04.783 | 2022-02-19T09:46:09.093 | 2022-02-19T07:04:15.910 | 5,893,512 | 5,893,512 | [
"c#",
"xamarin.forms",
"mobile-development"
] |
71,208,516 | 1 | null | null | 0 | 721 | I have three cards which needs to be shown individually in the same screen. I am currently hiding 2 of them when 1 is shown which depends on the card that I need to show. I set their states(hidden or shown) by a click of a button. The idea is to simulate navigation from the first card component to the third card component with 'go back' and 'next' buttons. On the third card, there will be no 'go back' button but I still need to be able to go back to the second one by the back function of the phone.
Is there a way to implement this using react-navigation?
This is my code:
```
function Screen (){
const [card1, setCard1] = useState(true)
const [card2, setCard2] = useState(false)
const [card3, setCard3] = useState(false)
const first = () =>{
setCard1(true)
setCard2(false)
setCard3(false)
}
const second = () =>{
setCard1(false
setCard2(true)
setCard3(false)
}
const third = () =>{
setCard1(false)
setCard2(false)
setCard3(true)
}
return(
<View>
{card1 &&
<FirstCard>
<Button title="Next" onPress={second}/>
</FirstCard>
}
{card2 &&
<SecondCard>
<Button title="Cancel" onPress={first}
<Button title="Next" onPress={second}/>
</SecondCard>
}
{card3 &&
<ThirdCard>
<Button title="Submit" onPress={console.log("submitted")}/>
</ThirdCard>
}
</View>
)
}
```
| Navigating through multiple components in the same screen with react-navigation | CC BY-SA 4.0 | null | 2022-02-21T15:03:43.863 | 2022-02-21T15:30:49.327 | null | null | 8,275,006 | [
"react-native",
"react-navigation",
"mobile-development"
] |