Skip to content

Instantly share code, notes, and snippets.

View Ajith-Pandian's full-sized avatar

Ajith Pandian Ajith-Pandian

View GitHub Profile
For MAC:
cd $ANDROID_HOME;
cd tools;
emulator @Nexus_5X_API_23; // Emulator name
@Ajith-Pandian
Ajith-Pandian / Api.js
Created December 22, 2017 10:15
Api with multipart formdata and token
export default class Api {
static headers() {
return {
Accept: "application/json",
"Content-Type": "multipart/form-data"
};
}
static get(route, token) {
return this.request(route, token, null, "GET");
import React from "react";
import { View, Text } from "react-native";
import { TabNavigator } from "react-navigation";
const Tab = () => {
return (
<View style={{ flex: 1, alignItems: "center", justifyContent: "center" }}>
<Text>Im tab</Text>
</View>
);
import React, { Component } from "react";
import { View, Text, PanResponder } from "react-native";
let initialState = { grant: false, move: false };
class Test extends Component {
state = initialState;
constructor() {
super();
}
cd $ANDROID_HOME;
cd tools;
emulator @Nexus_5X_API_23;// emulator @<YOUR_EMULATOR_NAME>
export default class Api {
static headers() {
return {
Accept: "application/json",
"Content-Type": "application/json"
};
}
static get(route) {
return this.request(route, null, "GET");
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
Picker,
Item,
Button,
AsyncStorage,
MediaRecorder recorder = new MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.AMR_NB);
recorder.setOutputFile(audioPath);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
try {
recorder.prepare();
recorder.start();l̥
} catch (Exception exception) {
04-26 12:26:14.025 1307-1706/? W/APM_AudioPolicyManager: getInputForAttr() failed opening input: samplingRate 8000, format 1, channelMask 10
04-26 12:26:14.025 1315-1315/? E/AudioRecord: Could not get audio input for session 1401, record source 1, sample rate 8000, format 0x1, channel mask 0x10, flags 0
04-26 12:26:14.025 1315-1315/? E/StagefrightRecorder: audio source is not initialized
04-26 12:26:14.025 682-682/com.wowconnect E/MediaRecorder: start failed: -2147483648
04-26 12:26:14.026 682-682/com.wowconnect E/RecordAudioActivity: onStart:
java.lang.RuntimeException: start failed.
at android.media.MediaRecorder.start(Native Method)
at com.example.ajit.RecordAudioActivity$3.onClick(RecordAudioActivity.java:164)
at android.view.View.perfor
@Ajith-Pandian
Ajith-Pandian / MyViewPager
Created December 23, 2016 11:26
Custom View Pager
public class MyViewPager extends ViewPager {
public MyViewPager(Context context) {
this(context, null);
}
public MyViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
setPageTransformer(false, new DefaultTransformer());
}