Uncategorized

okhttp 3+ post json data

I used compile ‘com.squareup.okhttp3:okhttp:3.5.0’   MediaType JSON = MediaType.parse(“application/json; charset=utf-8”); Map<String, String> params = new HashMap<String, String>(); params.put(“msisdn”, “123123”); params.put(“name”, “your name”); JSONObject parameter = new JSONObject(param); OkHttpClient client = new OkHttpClient(); RequestBody body = RequestBody.create(JSON, parameter.toString()); Request request = new Request.Builder() .url(url) .post(body) .addHeader(“content-type”, “application/json; charset=utf-8”) .build(); client.newCall(request).enqueue(new Callback() { @Override public void onFailure(Call… Continue reading okhttp 3+ post json data

Uncategorized

Change All textview font

Create this class or copy paste it import android.content.Context; import android.graphics.Typeface; import android.util.AttributeSet; import android.widget.TextView; /** * Created by Android Developer on 02-May-16. */ public class MyCustomTextView extends TextView { public MyCustomTextView(Context context, AttributeSet attrs) { super(context, attrs); this.setTypeface(Typeface.createFromAsset(context.getAssets(),”Museo300-Regular.otf”)); } } Then copy and paste your font in assets folder Then paste your font file… Continue reading Change All textview font

Uncategorized

Chat using firebase

Step 1 Create firebase account here and then create a app see in image. Then you can get URL from thereĀ seeĀ in image. My gradle file gadle(Module:app) compare to yours apply plugin: ‘com.android.application’ android { compileSdkVersion 23 buildToolsVersion “23.0.2” defaultConfig { applicationId “com.tranetech.openspace.nanochat” minSdkVersion 16 targetSdkVersion 23 versionCode 1 versionName “1.0” } buildTypes { release {… Continue reading Chat using firebase