passing string data from onPostExecute method of AsyncTask to other activity

In my opinion two options are available on the table! 1.Create your AsyncTask class as an inner class inside your Activity class, and then you can gain access for all super class properties. public class MyActivity extends Activity { int property1; void method1() { } private class MyTask extents AsyncTask<Void, Void, Void> { @Override protected … Read more

Android – Blocks in XML

I would suggest you to use MaterialLeanBack library. You will get a sample example in the code for understanding. Usage In your layout <com.github.florent37.materialleanback.MaterialLeanBack android:id=”@+id/materialLeanBack” android:layout_width=”match_parent” android:layout_height=”match_parent” app:mlb_background=”@color/background” app:mlb_lineSpacing=”30dp” app:mlb_paddingBottom=”30dp” app:mlb_paddingLeft=”30dp” app:mlb_paddingRight=”30dp” app:mlb_paddingTop=”40dp” app:mlb_titleColor=”@android:color/white” /> Requires compile ‘com.github.florent37:materialleanback:1.0.0@aar’ compile ‘com.android.support:cardview-v7:22.2.1’ compile ‘com.android.support:recyclerview-v7:22.2.1’ compile ‘com.nineoldandroids:library:2.4.0’

UNITY: Google Play Authentication failed when download from Google Play store

Thanks Github issues, I had finally solve the solution. The problem is happen with Google app sign in. From https://github.com/playgameservices/play-games-plugin-for-unity/issues/1754#issuecomment-304581707 What I did: Google Play Console -> Select your app -> Release Management -> App signing -> App signing certificate : copy SHA-1 (dont copy word ‘SHA1:’) open console.developers.google.com , select your project -> credentials … Read more

How to show background bitmap on 2D

When looking at the uv-coordinates and the vertex coordinates, one can see that they do not fit together: vertex ———————————————- 0.0f,0.0f,-1.0f, 0.0f, 0.0f, with,0.0f,-1.0f, 0.0f, 1.0f, <– vertex: change in x, uv: change in y with,heigh,-1.0f, 1.0f, 1.0f, 0.0f,heigh,-1.0f 1.0f, 0.0f In addition, you tell OpenGL in this line: GLES20.glVertexAttribPointer(mTextureCoordinateHandle, 3, GLES20.GL_FLOAT, false, 0, uvBuffer); … Read more

Reset a Radio button inside a Radio group

try this : radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, @IdRes int checkedId) { if (checkedId == R.id.radioButton){ //do something } else if(checkedId == R.id.radioButton2){ } else{ } }); xml layout <RadioGroup android:layout_width=”fill_parent” android:layout_height=”90dp” android:layout_below=”@+id/imageView” android:layout_marginTop=”58dp” android:weightSum=”1″ android:id=”@+id/radioGroup” android:layout_alignLeft=”@+id/textView2″ android:layout_alignStart=”@+id/textView2″ android:layout_alignRight=”@+id/textView3″ android:layout_alignEnd=”@+id/textView3″> <RadioButton android:layout_width=”wrap_content” android:layout_height=”55dp” android:text=”Male” android:id=”@+id/radioButton” android:layout_gravity=”center_horizontal” android:checked=”false” android:textSize=”25dp” /> <RadioButton android:layout_width=”wrap_content” android:layout_height=”wrap_content” … Read more

Download binary file from OKHTTP

For what it’s worth, I would recommend response.body().source() from okio (since OkHttp is already supporting it natively) in order to enjoy an easier way to manipulate a large quantity of data that can come when downloading a file. @Override public void onResponse(Call call, Response response) throws IOException { File downloadedFile = new File(context.getCacheDir(), filename); BufferedSink … Read more

Get Value of a Edit Text field

By using getText(): Button mButton; EditText mEdit; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mButton = (Button)findViewById(R.id.button); mEdit = (EditText)findViewById(R.id.edittext); mButton.setOnClickListener( new View.OnClickListener() { public void onClick(View view) { Log.v(“EditText”, mEdit.getText().toString()); } }); }

Run an audio file instantly when clicking on the application button (Android)

1.you add button 2. public class Setting extends Activity implements OnClickListener{ private MediaPlayer Music; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fragment_setting); Music = MediaPlayer.create(this, R.raw.musicname); findViewById(R.id.button).setOnClickListener(this); } public void onClick(View view) { if (view.getId() == R.id.button) { Music.start(); } } } only Preview 😀

Services or intent services to send location updates every 5 sec to server endlessly?

If you want to achieve this using service public class MyService extends Service { @Nullable @Override public IBinder onBind(Intent intent) { return null; } @Override public int onStartCommand(Intent intent, int flags, int startId) { ScheduledExecutorService scheduleTaskExecutor = Executors.newScheduledThreadPool(5); // This schedule a runnable task every x unit of time scheduleTaskExecutor.scheduleAtFixedRate(new Runnable() { public void run() … Read more