Skip to content

Instantly share code, notes, and snippets.

Avatar

Erum engr-erum

View GitHub Profile
View gist:841b15a8de127ec1d28ff44d115b6216
for (int k = 0; k < mOrder.getTmxOrderLine().size(); k++) {
Orderline mOrderLine = mOrder.getTmxOrderLine().get(k);
//match by product master id
if (mOrderLine.getProductMasterId().intValue() == mProduct.getSchemeProductMasterId().intValue()) {
quantityRequiredInOrder += mOrderLine.getOrderQuantity();
}
else
{
//this block will be used to compare productMasterId with child brand and its parent brand
View gist:aa142387796fb1c3b449619d4e6b7418
public static List<CustomerDailyStockData> getCustomerStockDataByCustomerId(int customerMasterId) {
Realm realm = Realm.getDefaultInstance();
RealmResults<CustomerDailyStockData> stockDatas = realm.where(CustomerDailyStockData.class).equalTo(CustomerDailyStockData.CUSTOMER_MASTER_ID, customerMasterId).findAll();
if (stockDatas != null) {
List<CustomerDailyStockData> stockDatasList = (List<CustomerDailyStockData>) realm.copyFromRealm(stockDatas);
return stockDatasList;
}
return null;
}
View gist:7bbf2e41efef496b60229d6359c3f064
http://tlx-sd.azurewebsites.net/qa-api/api/v1/CustomerDailyStock/CreateMultiple
[
{
"AvailableStock": 1,
"CreatedBy": "",
"CreatedDate": "2018-06-12 23:42:01",
"CustomerDailyStockId": 0,
"CustomerMasterId": 12417,
"PJPClusterId": 281343,
"ProductId": 177,
View gist:b661cfedcaf4558fc85a48af87596ba8
E/MediaPlayer: start called in state 2
01-02 12:12:49.970 16745-16745/com.abc.package E/MediaPlayer: error (-38, 0)
01-02 12:12:51.181 16745-16745/com.abc.package E/MediaPlayer: prepareAsync called in state 0
01-02 12:12:51.181 16745-16745/com.abc.package E/com.abc.package.activities.detail.AudioDetailActivity: illegal state exception
01-02 12:12:51.181 16745-16745/com.abc.package W/System.err: java.lang.IllegalStateException
01-02 12:12:51.191 16745-16745/com.abc.package W/System.err: at android.media.MediaPlayer.prepare(Native Method)
01-02 12:12:51.191 16745-16745/com.abc.package W/System.err: at com.abc.package.activities.detail.AudioDetailActivity.playAudio(AudioDetailActivity.java:506)
01-02 12:12:51.191 16745-16745/com.abc.package W/System.err: at com.abc.package.activities.detail.AudioDetailActivity$2.onClick(AudioDetailActivity.java:206)
01-02 12:12:51.201 16745-16745/com.abc.package W/System.err: at android.view.View.performClick(View.java:4753)
01-02 12:12:51.201 16745-16745/com.abc
View gist:190b78af3fefb5d998486f49240143be
public void playAudio() {
if (mediaPlayer == null) {
mediaPlayer = new MediaPlayer();
}
if (!TextUtils.isEmpty(mediaFileUrl)) {
try {
mediaPlayer.reset();
mediaPlayer.setDataSource(mediaFileUrl);
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
View gist:e59fa65610c685d672092a2cb920dd80
[
{
"2EjddfdfdfdfdfdfKLH": {
"edition": 1,
"language": "ap,sp,ai",
"is_public": true
}
},
{
"2dldfdfdfdfdfVzqE": {
View gist:9d88f36b8acbddae96ca8305d6f0c364
public static FailureResponse getErrorMessage(String responseString) {
Log.d(Utils.class.getName(),"responseString:"+responseString);
JsonParser parser = new JsonParser();
JsonElement mJson = null;
mJson = parser.parse(responseString);
Gson gson = new Gson();
FailureResponse failureResponse = gson.fromJson(mJson, FailureResponse.class);
return failureResponse;
}
View gist:3e15ae11f98ddee740a517aad1cfa1f9
// when i m updating language so its continously launching activity ... how will i resolve this issue ?
private void updateLanguageBasedOnLocalStorage() {
languageSelection = SharedPreferencesManager.getSharedPreferenceInstance(context).getSharedPreferenceString(context, getString(R.string.str_language));
if (TextUtils.isEmpty(languageSelection)) {
languageSelection = getString(R.string.str_en);
}
setLocal(languageSelection);
}
View gist:50d73d0de02700acfff370c95677be1e
public void PlayAudio() {
if (mediaPlayer == null) {
mediaPlayer = new MediaPlayer();
}
if (!TextUtils.isEmpty(mediaFileUrl)) {
try {
mediaPlayer.reset();
mediaPlayer.setDataSource(mediaFileUrl);
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
View gist:7697d0084a3706d5c75a56a7f9608294
playAudio();
ivActionPlayVideo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (mediaType == 1) {
if (!mediaPlayer.isPlaying()) {
videoView.setVisibility(View.INVISIBLE);
ivViewTracker.setVisibility(View.VISIBLE);
You can’t perform that action at this time.