I'm following a retrofit tutorial https://futurestud.io/tutorials/retrofit-getting-started-and-android-client
The app compiles and runs but doesn't allow you to scroll beyond the first page. Any idea what I'm missing? Does this tutorial even have you show all the repos?
https://github.com/morenoh149/HarryLearnsAndroid/tree/master/HttpDemo
package com.harrymoreno.httpdemo;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ListView;
import android.widget.Toast;
import java.util.List;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import com.harrymoreno.httpdemo.GitHubRepoAdapter;
public class MainActivity extends AppCompatActivity {
private ListView listView;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
listView = (ListView) findViewById(R.id.pagination_list);
Retrofit.Builder builder = new Retrofit.Builder()
.baseUrl("https://api.github.com/")
.addConverterFactory(GsonConverterFactory.create());
Retrofit retrofit = builder.build();
GithubClient client = retrofit.create(GithubClient.class);
Call<List<GithubRepo>> call = client.reposForUser("morenoh149");
call.enqueue(new Callback<List<GithubRepo>>() {
#Override
public void onResponse(Call<List<GithubRepo>> call, Response<List<GithubRepo>> response) {
List<GithubRepo> repos = response.body();
listView.setAdapter(new GitHubRepoAdapter(MainActivity.this, repos));
}
#Override
public void onFailure(Call<List<GithubRepo>> call, Throwable t) {
Toast.makeText(MainActivity.this, "error :(", Toast.LENGTH_SHORT).show();
}
});
}
}
and activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:id="#+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<ListView
android:id="#+id/pagination_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
tools:layout_editor_absoluteX="0dp" />
</RelativeLayout>
use scrollview then listview in xml file
Related
I am uploading video to a localhost webpage. My code is using a Handler (the syntax of which is working in a different class for signup & login to the app.
However when I run the code in the emulator it creates the handler, run the next line, then skips over the code in the handler.post section. (I can see handler appears to be deprecated in the documentation but i'm too far down this road to change now).
Any suggestions would be very much appreciated. (I know there are probably other issues in the code and better ways to do what i'm trying to achieve, I'm just using this as a learning exercise).
Activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<Button
android:id="#+id/captureBtn"
android:layout_width="120dp"
android:layout_height="60dp"
android:layout_centerVertical="true"
android:layout_gravity="bottom"
android:text="Capture Video"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
/>
</RelativeLayout>
build.gradle
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<Button
android:id="#+id/captureBtn"
android:layout_width="120dp"
android:layout_height="60dp"
android:layout_centerVertical="true"
android:layout_gravity="bottom"
android:text="Capture Video"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
/>
</RelativeLayout>
MainActivity
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import android.Manifest;
import android.app.Activity;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
public class MainActivity extends AppCompatActivity {
// Storage Permissions
private static final int REQUEST_EXTERNAL_STORAGE = 1;
private static String[] PERMISSIONS_STORAGE = {
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE
};
Button Upload;
private final String fileURI = "/storeage/emulated/0/DCIM/Camera/VID_20210424_141744.mp4";
private static final String serverUri = "http://192.168.0.116/racewatch/upload.php";
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Upload = findViewById(R.id.captureBtn);
Upload.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
if (ActivityCompat.checkSelfPermission(getApplicationContext(),
Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
Handler handler = new Handler();
System.out.println("Hi from here");
handler.post(new Runnable() {
#Override
public void run() {
// Start of upload thread
//Creating array for parameters
String[] field = new String[4];
field[0] = "username";
field[1] = "userid";
field[2] = "lat";
field[4] = "lon";
//Creating array for data
String[] data = new String[4];
data[0] = "patsky";
data[1] = "21";
data[2] = "53.6";
data[3] = "-6.1";
// instantiate a client - should be a singleton
OkHttpClient client = new OkHttpClient.Builder()
.connectTimeout(10, TimeUnit.SECONDS)
.readTimeout(10, TimeUnit.SECONDS)
.build();
// /storeage/emulated/0/DCIM/Camera/VID_20210424_141744.mp4
RequestBody requestBody = new MultipartBody.Builder()
.setType(MultipartBody.FORM)
.addFormDataPart(field[0], data[0])
.addFormDataPart(field[1], data[1])
.addFormDataPart(field[2], data[2])
.addFormDataPart(field[3], data[3])
.addFormDataPart("file", "test.mp4", RequestBody.create(MediaType.parse("video/mp4"), new File(fileURI)))
.build();
Request request = new Request.Builder()
.url(serverUri)
.post(requestBody)
.build();
client.newCall(request).enqueue(new Callback() {
#Override
public void onFailure(final Call call, final IOException e) {
//Toast.makeText(MainActivity.this, "Error in file upload", Toast.LENGTH_SHORT).show();
Log.e("file uuuupload", "exception", e);
}
#Override
public void onResponse(final Call call, final Response response) throws IOException {
String phpans = response.body().string();//reponse body can be only accessed once
//Toast.makeText(MainActivity.this, phpans, Toast.LENGTH_SHORT).show();
System.out.println("Error messssage" + phpans);
if (!response.isSuccessful()) {
//Toast.makeText(MainActivity.this, "File uploaded successfully", Toast.LENGTH_SHORT).show();
System.out.println("Error messaage" + phpans);
}
// Upload successful
}
});
}
});
} else {
ActivityCompat.requestPermissions(MainActivity.this, new String[]{
Manifest.permission.READ_EXTERNAL_STORAGE}, 44);
}
} // end of onClick
});
} // end of onCreate
}
AndroidManifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.uploadtoserverexample">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:usesCleartextTraffic="true"
android:theme="#style/Theme.UploadToServerExample">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Here's the data in my database:
Here's the code of my project. I found no error. It is not displaying the contents in it, even it is showing a blank page.
Adapter
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.RecyclerView.ViewHolder;
import java.util.ArrayList;
public class MylistAdapter extends RecyclerView.Adapter<MylistAdapter.MylistViewHolder> {
private ArrayList<RequestUser> users;
class MylistViewHolder extends RecyclerView.ViewHolder{
private TextView dispname1;
private TextView dispphn1;
private TextView dispcity1;
private TextView dispaddr1;
private TextView dispnumber1;
private MylistViewHolder(#NonNull View itemView) {
super(itemView);
dispaddr1=itemView.findViewById(R.id.dispaddr);
dispcity1=itemView.findViewById(R.id.dispcity);
dispname1=itemView.findViewById(R.id.dispname);
dispphn1=itemView.findViewById(R.id.disphn);
dispnumber1=itemView.findViewById(R.id.dispnumber);
}
}
public MylistAdapter(ArrayList<RequestUser> usrs) {
this.users= usrs;
}
#Override
public MylistViewHolder onCreateViewHolder(#NonNull ViewGroup parent, int viewType) {
View v=LayoutInflater.from(parent.getContext()).inflate(R.layout.row_item,parent,false);
MylistViewHolder mlvh=new MylistViewHolder(v);
return mlvh;
}
#Override
public void onBindViewHolder(#NonNull MylistViewHolder holder, int position) {
RequestUser curuser=users.get(position);
holder.dispphn1.setText(curuser.getRphn1());
holder.dispname1.setText(curuser.getRname1());
holder.dispcity1.setText(curuser.getRcity1());
holder.dispaddr1.setText(curuser.getRaddr1());
holder.dispnumber1.setText(curuser.getRnumber1());
}
#Override
public int getItemCount() {
return users.size();
}
}
Main Class
Which contains the main functionality
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.os.Build;
import android.os.Bundle;
import android.widget.Toast;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import java.util.ArrayList;
import java.util.Objects;
public class Transport extends AppCompatActivity {
private RecyclerView recyclerView;
private RecyclerView.LayoutManager layoutManager;
private RecyclerView.Adapter adapter;
DatabaseReference dbreferance;
FirebaseAuth firebaseAuth;
FirebaseDatabase firebaseDatabase;
private ArrayList<RequestUser> usrs=new ArrayList<>();
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_transport);
firebaseAuth=FirebaseAuth.getInstance();
firebaseDatabase=FirebaseDatabase.getInstance();
dbreferance= FirebaseDatabase.getInstance().getReference().child("Donate");
dbreferance.addValueEventListener(new ValueEventListener() {
#Override
public void onDataChange(#NonNull DataSnapshot dataSnapshot) {
usrs.clear();
for(DataSnapshot child:dataSnapshot.getChildren())
{
//String id=child.getKey();
RequestUser usr=child.getValue(RequestUser.class);
usrs.add(usr);
//RequestUser usr= (RequestUser) child.getValue();
//usrs.add(usr);
//System.out.println(usr.rname1);
Toast.makeText(Transport.this,usr.getRphn1(),Toast.LENGTH_SHORT).show();
}
}
#Override
public void onCancelled(#NonNull DatabaseError databaseError) {
}
});
recyclerView=(RecyclerView)findViewById(R.id.recyclerView);
recyclerView.setHasFixedSize(true);
layoutManager=new LinearLayoutManager(this);
adapter=new MylistAdapter(usrs);
recyclerView.setLayoutManager(layoutManager);
recyclerView.setAdapter(adapter);
}
}
XML Layouts
for the Recycler view and the card views
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/dispname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Line1"
android:textColor="#android:color/black"
android:textSize="30sp"
android:textStyle="bold" />
<TextView
android:id="#+id/dispcity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/dispname"
android:textSize="25sp"
android:layout_marginStart="8dp"
android:text="Line2"
android:layout_marginLeft="8dp" />
<TextView
android:id="#+id/dispaddr"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/dispcity"
android:textSize="15sp"
android:text="Line3"
android:layout_marginLeft="16dp"/>
<TextView
android:id="#+id/disphn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/dispaddr"
android:textSize="15sp"
android:text="Line4"
android:layout_marginLeft="24dp"/>
<TextView
android:id="#+id/dispnumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/dispaddr"
android:textSize="15sp"
android:text="Line5"
android:layout_marginLeft="24dp"/>
</RelativeLayout>
</androidx.cardview.widget.CardView>
Another Layout
ie for card view
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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=".Transport">
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout_editor_absoluteY="1dp"
tools:ignore="MissingConstraints" />
</RelativeLayout>
When we add listener Android create a separate thread for that and that thread run separately. So in your case we you are adding the listener android is creating the separate thread for that and then it immediately set the adapter for the recyclerView.
Create the adapter before adding the listener and set the adapter with recyclerView in the onDataChanged( ) method after the for loop.
#Override
public void onDataChange(#NonNull DataSnapshot dataSnapshot) {
usrs.clear();
for(DataSnapshot child:dataSnapshot.getChildren())
{
//String id=child.getKey();
RequestUser usr=child.getValue(RequestUser.class);
usrs.add(usr);
//RequestUser usr= (RequestUser) child.getValue();
//usrs.add(usr);
//System.out.println(usr.rname1);
Toast.makeText(Transport.this,usr.getRphn1(),Toast.LENGTH_SHORT).show();
}
recyclerView.setAdapter(adapter);
}
I tried other answers but nothing worked. for some reason RecyclerView only displaying one item. I tried changing layout height to wrap content but it didn't worked, still displaying only one item. I'm passing about 20 items.
I have to type more otherwise stackoverflow won't let me post this question. because it mostly code
feed_list_item.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="#+id/txtStatus"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/txtTransaction"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/txtGeneral"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</RelativeLayout>
</android.support.v7.widget.CardView>
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.Arrays;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
Button btnget;
RecyclerView recycler;
private Session session;
private TextView textViewResult;
ArrayList<Feed> feed ;
private feedadapter feedadap;
String token ="Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJ ";
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
recycler = findViewById(R.id.recyclerView);
recycler.setLayoutManager(new LinearLayoutManager(this));
Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https:url/")
.addConverterFactory(GsonConverterFactory.create())
.build();
JsonPlaceHolderApi jsonPlaceHolderApi = retrofit.create(JsonPlaceHolderApi.class);
Call<Feed> call = jsonPlaceHolderApi.getposts( token);
call.enqueue(new Callback<Feed>() {
#Override
public void onResponse(Call<Feed> call, Response<Feed> response) {
feed = new ArrayList<>(Arrays.asList(response.body()));
feedadap = new feedadapter(MainActivity.this,feed);
recycler.setAdapter(feedadap);
Log.d("msgcontent",feed.toString());
}
#Override
public void onFailure(Call<Feed> call, Throwable t) {
}
});
}
#Override
public void onClick(View view) {
}
}
check getItemCount() in your FeedAdapter.
it's must look like this:
#Override
public int getItemCount() {
return feed.size();
}
I have just created an Android app for delivery boy ,In that admin can assign a duty to him through server.
The problem is that i want a functionality in which app can automatically sends the latitude and longitude to the server every 5 minutes of interval, I had used job scheduler but it is only works in my older phone which is Android Lollipop, it is not working in Android Nougat.
MyService.java
package com.example.dell.firebase;
import android.os.AsyncTask;
import android.util.Log;
import android.widget.Toast;
import com.firebase.jobdispatcher.JobParameters;
import com.firebase.jobdispatcher.JobService;
/**
* Created by DELL on 3/20/2019.
*/
public class MyService extends JobService{
BackgroundTask ba;
#Override
public boolean onStartJob(final JobParameters job) {
ba=new BackgroundTask(){
#Override
protected void onPostExecute(String s) {
Toast.makeText(getApplicationContext(),"hello all "+s,Toast.LENGTH_SHORT).show();
Log.d("dd","hg");
jobFinished(job,false);
}
};
ba.execute();
return true;
}
#Override
public boolean onStopJob(JobParameters job) {
return true;
}
public static class BackgroundTask extends AsyncTask<Void,Void,String>
{
#Override
protected String doInBackground(Void... voids) {
return "hello from background";
}
}
}
My Xml code
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.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="com.example.dell.firebase.MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="150dp"
android:onClick="startjob"
android:text="start" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:onClick="stopjob"
android:text="stop" />
</LinearLayout>
</android.support.constraint.ConstraintLayout>
MainActivity.java
package com.example.dell.firebase;
import android.annotation.SuppressLint;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;
import com.firebase.jobdispatcher.Constraint;
import com.firebase.jobdispatcher.FirebaseJobDispatcher;
import com.firebase.jobdispatcher.GooglePlayDriver;
import com.firebase.jobdispatcher.Job;
import com.firebase.jobdispatcher.Lifetime;
import com.firebase.jobdispatcher.RetryStrategy;
import com.firebase.jobdispatcher.Trigger;
import java.util.concurrent.TimeUnit;
public class MainActivity extends AppCompatActivity {
private static final String jobtag="Mytag";
private FirebaseJobDispatcher jobDispatcher;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
jobDispatcher=new FirebaseJobDispatcher(new GooglePlayDriver(this));
}
public void startjob(View view) {
Job job=jobDispatcher.newJobBuilder()
.setService(MyService.class)
.setLifetime(Lifetime.FOREVER)
.setRecurring(true)
.setTag(jobtag)
.setTrigger(Trigger.executionWindow(10,15))
.setRetryStrategy(RetryStrategy.DEFAULT_EXPONENTIAL)
.setReplaceCurrent(false)
.setConstraints(Constraint.ON_ANY_NETWORK)
.build();
jobDispatcher.mustSchedule(job);
Toast.makeText(this,"job Scheduled",Toast.LENGTH_SHORT).show();
}
public void stopjob(View view) {
jobDispatcher.cancelAll();
Toast.makeText(this,"job Canceled",Toast.LENGTH_SHORT).show();
}
}
I integrated Tap Research sdk on my Android app, but application getting force stop.
Any idea why this might be happening?
This is my code tapresearchactivity.java
import android.app.Activity;
import android.app.Application;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.Toast;
import com.tapr.sdk.TapResearch;
import com.tapr.sdk.TapResearchOnRewardListener;
class MyApp extends Application {
final private String YOUR_API_TOKEN = "fa7dbeeacebe7ae3e0b24e8dccaa6acb";
public class onCreate{} {
super.onCreate();
TapResearch.configure(YOUR_API_TOKEN, this);
}
}
public class TapresearchActivity extends Activity {
private Button show_button;
#Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.activity_tapresearch);
/** Set up button to show an ad when clicked */
show_button = (Button) findViewById(R.id.showbutton);
if (TapResearch.getInstance().isSurveyAvailable()) {
show_button.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
TapResearch.getInstance().showSurvey();
}
});
}
}
}
And this is my xml layout file here activity_tapreserch.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".TapresearchActivity">
<Button
android:layout_width="298dp"
android:layout_height="68dp"
android:enabled="false"
android:id="#+id/showbutton"
android:background="#drawable/button_blue"
android:layout_alignParentBottom="true"
android:layout_marginBottom="10dp"
android:layout_centerHorizontal="true"/>
</RelativeLayout>