SplashAcvtivity.java File
Code:
package com[.]nijinsha.didyouknow;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.os.Handler;
/**
* Created by Digit on 3/17/2016.
*/
public class SplashActivity extends AppCompatActivity {
// Splash screen timer
private static int SPLASH_TIME_OUT = 3000;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
new Handler().postDelayed(new Runnable() {
/*
* Showing splash screen with a timer. This will be useful when you
* want to show case your app logo / company
*/
@Override
public void run() {
// This method will be executed once the timer is over
// Start your app main activity
Intent i = new Intent(SplashActivity.this, MainActivity.class);
startActivity(i);
// close this activity
finish();
}
}, SPLASH_TIME_OUT);
}
Manifest.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<manifest
package="com.nijinsha.didyouknow">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true">
<activity
android:name=".SplashActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Black.NoTitleBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:theme="@style/Theme.AppCompat.DayNight.NoActionBar"
android:name=".MainActivity"
android:configChanges="keyboardHidden|orientation|screenSize">
</activity>
</application>
</manifest>
LOG FILE
03-17 14:53:21.490 7053-7053/com.nijinsha.didyouknow E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.nijinsha.didyouknow, PID: 7053
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.nijinsha.didyouknow/com.nijinsha.didyouknow.SplashActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2327)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2378)
at android.app.ActivityThread.access$800(ActivityThread.java:155)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1244)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5433)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
at android.support.v7.app.AppCompatDelegateImplV7.createSubDecor(AppCompatDelegateImplV7.java:340)
at android.support.v7.app.AppCompatDelegateImplV7.ensureSubDecor(AppCompatDelegateImplV7.java:309)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:273)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
at com.nijinsha.didyouknow.SplashActivity.onCreate(SplashActivity.java:21)
at android.app.Activity.performCreate(Activity.java:5301)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2291)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2378)*
at android.app.ActivityThread.access$800(ActivityThread.java:155)*
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1244)*
at android.os.Handler.dispatchMessage(Handler.java:102)*
at android.os.Looper.loop(Looper.java:136)*
at android.app.ActivityThread.main(ActivityThread.java:5433)*
at java.lang.reflect.Method.invokeNative(Native Method)*
at java.lang.reflect.Method.invoke(Method.java:515)*
This line
Code:
at com.nijinsha.didyouknow.SplashActivity.onCreate(Sp lashActivity.java:21)
suggest that app crash in:
Code:
setContentView(R.layout.activity_splash);
Your activity extends AppCompatActivity, but in manifest You declared for this activity:
Code:
android:theme="@android:style/Theme.Black.NoTitleBar" >
You need to use another theme for this acitivty.
You must use AppCompat themes with activity that extended from AppCompatActivity class,
Code:
android:theme="@android:style/Theme.AppCompat.Light"
or don't extend your activity from AppCompatActivity.
Code:
public class SplashActivity extends Activity
Related
I have a large set of html-pages (css-formatted, + some javascript) that I want saved inside the project so the user dont have to go online to browse for them from the app.
1) My first question is how do I open a a local html-page (named, for instance "myWebPage.html") in a WebView?
I know I can make a WebView load a html-string with the following code:
main.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<WebView android:id="@+id/webkit"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
</LinearLayout>
WebKitTest.java
Code:
package com.androidspanishcourse.WebKitTest;
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
public class WebKitTest extends Activity {
// Declare webview
WebView browser;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// ?
browser=(WebView)findViewById(R.id.webkit);
// Loads html-string into webview
browser.loadData("<html><body>Hi dude<br><br>Hi again</body></html>", "text/html", "UTF-8");
}
}
But I dont know how to load a specific local html-page.
2) My second question is: where do I put the html-pages? I understand that resources are generally put in the /res/-folder of the project, but do I put them in a specific sub-folder of the res-folder?
http://developer.android.com/reference/android/webkit/WebView.html
1.Webview.loadUrl(String url)
2.The prefix "file:///android_asset/" will cause WebView to load content from the current application's 'assets' folder. For example, a myimage.gif file in the /assets folder can be used in the html image tag as:
<img src="file:///android_asset/myimage.gif">. Same applies to html file.
Thanks a lot, waacow
Also, apparently you need to add "browser.getSettings().setJavaScriptEnabled(true);" for the webview to be able to handle javascript.
Display HTML file from assets folder
Hello,
Just save your HTML file in your assets folder and then load it from assets to webview.
MainActivity.java
package com.deepshikha.htmlfromassets;
import android.app.ProgressDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class MainActivity extends AppCompatActivity {
WebView webview;
ProgressDialog progressDialog;
@override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
init();
}
private void init(){
webview = (WebView)findViewById(R.id.webview);
webview.loadUrl("file:///android_asset/download.html");
webview.requestFocus();
progressDialog = new ProgressDialog(MainActivity.this);
progressDialog.setMessage("Loading");
progressDialog.setCancelable(false);
progressDialog.show();
webview.setWebViewClient(new WebViewClient() {
public void onPageFinished(WebView view, String url) {
try {
progressDialog.dismiss();
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
}
Thanks!
xposed framework handleLoadPackage、 initZygote method not execute.
manifest configuration :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="htt:://schemas.android.com/apk/res/android"
package="com.android.xdemo"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<!-- xposed -->
<meta-data
android:name="xposeddescription"
android:value="xposed test demo" />
<meta-data
android:name="xposedmodule"
android:value="true" />
<meta-data
android:name="xposedminversion"
android:value="54" />
<activity
android:name="com.android.xdemo.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
------------------------
xposed_init configuration :
com.android.xdemo.XDemoMain
---------------------
XDemoMain class :
package com.android.xdemo;
import java.io.File;
import android.os.Environment;
import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.IXposedHookZygoteInit;
import de.robv.android.xposed.callbacks.XC_LoadPackage.Lo adPackageParam;
public class XDemoMain implements IXposedHookLoadPackage, IXposedHookZygoteInit {
@override
public void initZygote(StartupParam startupParam) throws Throwable {
try {
String sd = Environment.getExternalStorageDirectory().getAbsol utePath();
new File(sd, "test").createNewFile();
} catch (Exception e) {
}
}
@override
public void handleLoadPackage(LoadPackageParam lpparam) throws Throwable {
try {
String sd = Environment.getExternalStorageDirectory().getAbsol utePath();
new File(sd, "demo").createNewFile();
} catch (Exception e) {
}
}
}
------------------------------------------------------
These are configured according to the official document, Xposed framework can also be installed on the phone looking for in the module is handleLoadPackage, initZygote these two methods have not been called, did not seem to come in this class, there is not a configuration mistake, please great God pointing
Hi there! I am a beginner to Android Studio and right now trying to create an app with the functionality of trying to display a splash screen and then after 5 seconds, the app will change the layout from the Splashscreen to the login page. I
This are the code i have attempted to used but failed causing the app to crash.
Code:
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Thread startTimer = new Thread() {
public void run() {
try {
sleep(5000);
Intent i = new Intent(MainActivity.this, Login_Page.class);
startActivity(i);
finish();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
};
startTimer.start();
}}
I have a total of 4 layouts
1) Activity_main.xml
2) Content_main.xxml
3) login.xml
4) splash.xml
I have 3 acitivities
1) Login_page
2) MainAcitvity
3) Splash
Error Code
12-04 15:28:47.209 3495-3547/com.yong.combinedhuamtities
E/AndroidRuntime: FATAL EXCEPTION: Thread-148
12-04 15:28:47.209 3495-3547/com.yong.combinedhuamtities E/AndroidRuntime: Process: com.yong.combinedhuamtities, PID: 3495
12-04 15:28:47.209 3495-3547/com.yong.combinedhuamtities E/AndroidRuntime: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.yong.combinedhuamtities/com.yong.combinedhuamtities.Login_Page}; have you declared this activity in your AndroidManifest.xml?
12-04 15:28:47.209 3495-3547/com.yong.combinedhuamtities E/AndroidRuntime: at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1794)
12-04 15:28:47.209 3495-3547/com.yong.combinedhuamtities E/AndroidRuntime: at android.app.Instrumentation.execStartActivity(Instrumentation.java:1512)
12-04 15:28:47.209 3495-3547/com.yong.combinedhuamtities E/AndroidRuntime: at android.app.Activity.startActivityForResult(Activity.java:3917)
12-04 15:28:47.209 3495-3547/com.yong.combinedhuamtities E/AndroidRuntime: at android.app.Activity.startActivityForResult(Activity.java:3877)
12-04 15:28:47.209 3495-3547/com.yong.combinedhuamtities E/AndroidRuntime: at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:784)
12-04 15:28:47.209 3495-3547/com.yong.combinedhuamtities E/AndroidRuntime: at android.app.Activity.startActivity(Activity.java:4200)
12-04 15:28:47.209 3495-3547/com.yong.combinedhuamtities E/AndroidRuntime: at android.app.Activity.startActivity(Activity.java:4168)
12-04 15:28:47.209 3495-3547/com.yong.combinedhuamtities E/AndroidRuntime: at com.yong.combinedhuamtities.MainActivity$1.run(MainActivity.java:25)
12-04 15:28:47.673 3495-3582/com.yong.combinedhuamtities E/Surface: getSlotFromBufferLocked: unknown buffer: 0xb3f97710
Would appreciate if any professional programmer can explain the error of mine... Thank you!
Read the message:
Unable to find explicit activity class {com.yong.combinedhuamtities/com.yong.combinedhuamtities.Login_Page};
have you declared this activity in your AndroidManifest.xml?
<activity
android:name=".SplashActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Translucent.NoTitleBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
</activity>
a26484306 said:
<activity
android:name=".SplashActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Translucent.NoTitleBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
</activity>
Click to expand...
Click to collapse
Thanks for your help!!!
Hello every one,
please help me
showing the already loaded url and not showing the presently loading URL
Main activity
-------------------------
package com.example.amit.myapplication;
import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Window;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class MainActivity extends Activity {
private WebView mWebView;
@override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().requestFeature(Window.FEATURE_NO_TITLE);
mWebView = new WebView(this);
mWebView.loadUrl("**********");
mWebView.setWebViewClient(new WebViewClient() {
@override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
});
this.setContentView(mWebView);
}
@override
public boolean onKeyDown(final int keyCode, final KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_BACK) && mWebView.canGoBack()) {
mWebView.goBack();
return true;
}
return super.onKeyDown(keyCode, event);
}
}
-----------------------------------------------------------------------
Activity main
-----------------
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="linknot avilible"
xmlns:tools="not available"
android:layout_width="match_parent"
android:layout_height="match_parent"
androidaddingBottom="@dimen/activity_vertical_margin"
androidaddingLeft="@dimen/activity_horizontal_margin"
androidaddingRight="@dimen/activity_horizontal_margin"
androidaddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.amit.myapplication.MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!" />
<WebView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/mwebView"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
-----------------------------------------------
AndroidManifest
--------------------
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="link not avaible"
package="com.example.amit.myapplication">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<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>
------------------
what could be the problem ?
thanks alot for answers
Can you please explain it better? What do you mean by already loaded url and by presently loading url?
Hi
Thanks for replay,
I mean after caple days the main page in app dont refresh.
Hello,
i am trying to launch my app on a samsung galaxy s3, but the activity doesn't launch
can someone help me?
error:
06-14 08:36:58.720 24601-24601/plopmenzinc.nsapp E/AndroidRuntime: FATAL EXCEPTION: main
Process: plopmenzinc.nsapp, PID: 24601
java.lang.RuntimeException: Unable to start activity ComponentInfo{plopmenzinc.nsapp/plopmenzinc.nsapp.Start}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2436)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2495)
at android.app.ActivityThread.access$900(ActivityThread.java:170)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1304)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5635)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at plopmenzinc.nsapp.Start.onCreate(Start.java:37)
at android.app.Activity.performCreate(Activity.java:5580)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2400)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2495)*
at android.app.ActivityThread.access$900(ActivityThread.java:170)*
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1304)*
at android.os.Handler.dispatchMessage(Handler.java:102)*
at android.os.Looper.loop(Looper.java:146)*
at android.app.ActivityThread.main(ActivityThread.java:5635)*
at java.lang.reflect.Method.invokeNative(Native Method)*
at java.lang.reflect.Method.invoke(Method.java:515)*
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291)*
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)*
at dalvik.system.NativeStart.main(Native Method)*
start.java:
package plopmenzinc.nsapp;
import android.app.Activity;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.nfc.NfcAdapter;
import android.os.CountDownTimer;
import android.preference.PreferenceManager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageSwitcher;
import android.widget.TextView;
import android.widget.Toast;
public class Start extends AppCompatActivity {
int number = 0;
private ImageSwitcher sw;
public static final String MIME_TEXT_PLAIN = "text/plain";
public static final String TAG = "NfcDemo";
private TextView mTextView;
private NfcAdapter mNfcAdapter;
@override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_start);
mNfcAdapter = NfcAdapter.getDefaultAdapter(this);
sw.setImageResource(R.drawable.reclame);
if (mNfcAdapter == null) {
// Stop here, we definitely need NFC
Toast.makeText(this, "U kunt deze functie helaas niet gebruiken, omdat uw toestel geen NFC heeft.", Toast.LENGTH_LONG).show();
finish();
return;
}
if (!mNfcAdapter.isEnabled()) {
mTextView.setText("Om deze functie te gebruiken moet u NFC aanzetten.");
}
handleIntent(getIntent());
}
@override
protected void onResume() {
super.onResume();
/**
* It's important, that the activity is in the foreground (resumed). Otherwise
* an IllegalStateException is thrown.
*/
setupForegroundDispatch(this, mNfcAdapter);
}
@override
protected void onPause() {
/**
* Call this before onPause, otherwise an IllegalArgumentException is thrown as well.
*/
stopForegroundDispatch(this, mNfcAdapter);
super.onPause();
}
@override
protected void onNewIntent(Intent intent) {
/**
* This method gets called, when a new Intent gets associated with the current activity instance.
* Instead of creating a new activity, onNewIntent will be called. For more information have a look
* at the documentation.
*
* In our case this method gets called, when the user attaches a Tag to the device.
*/
handleIntent(intent);
}
private void handleIntent(Intent intent) {
TextView var = (TextView) findViewById(R.id.score);
number++;
String disp = Integer.toString(number);
var.setText(disp);
final TextView CountDown = (TextView) findViewById(R.id.textView3);
new CountDownTimer(300000, 1000) {
public void onTick(long millisUntilFinished) {
CountDown.setText(millisUntilFinished / 1000 + " sec");
}
public void onFinish() {
CountDown.setText("0 sec");
}
}.start();
}
/**
* @param activity The corresponding {@link Activity} requesting the foreground dispatch.
* @param adapter The {@link NfcAdapter} used for the foreground dispatch.
*/
public void setupForegroundDispatch(final Activity activity, NfcAdapter adapter) {
final Intent intent = new Intent(activity.getApplicationContext(), activity.getClass());
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
final PendingIntent pendingIntent = PendingIntent.getActivity(activity.getApplicationContext(), 0, intent, 0);
IntentFilter[] filters = new IntentFilter[1];
String[][] techList = new String[][]{};
// Notice that this is the same filter as in our manifest.
filters[0] = new IntentFilter();
filters[0].addAction(NfcAdapter.ACTION_NDEF_DISCOVERED);
filters[0].addCategory(Intent.CATEGORY_DEFAULT);
try {
filters[0].addDataType(MIME_TEXT_PLAIN);
} catch (IntentFilter.MalformedMimeTypeException e) {
throw new RuntimeException("Check your mime type.");
}
adapter.enableForegroundDispatch(activity, pendingIntent, filters, techList);
}
public void stopForegroundDispatch(final Activity activity, NfcAdapter adapter) {
adapter.disableForegroundDispatch(activity);
}
public void image_next(){
sw.setImageResource(R.drawable.reclame);
}
public void image_prev(){
sw.setImageResource(R.drawable.reclame2);
}
}
activity:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="(link)"
xmlns:tools="(link)"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
androidrientation="vertical"
androidaddingBottom="@dimen/activity_vertical_margin"
androidaddingLeft="@dimen/activity_horizontal_margin"
androidaddingRight="@dimen/activity_horizontal_margin"
androidaddingTop="@dimen/activity_vertical_margin"
tools:context="plopmenzinc.nsapp.Start"
android:saveEnabled="true">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Uw aantal punten:"
android:id="@+id/textView"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="50dp"
android:singleLine="true"
android:textColor="#FF2646B0"
android:textSize="22sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/disp"
android:id="@+id/score"
android:layout_alignBottom="@+id/textView"
android:layout_toRightOf="@+id/textView"
android:layout_toEndOf="@+id/textView"
android:textSize="22sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Tijd tot U weer kunt scannen:"
android:id="@+id/textView2"
android:layout_below="@+id/textView"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="34dp"
android:singleLine="true"
android:textColor="#FF2646B0"
android:textSize="22sp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0 sec"
android:id="@+id/textView3"
android:singleLine="true"
android:textSize="22sp"
android:layout_alignTop="@+id/textView2"
android:layout_toRightOf="@+id/textView2"
android:layout_toEndOf="@+id/textView2" />
<ImageSwitcher
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageSwitcher"
android:layout_below="@+id/textView"
android:layout_centerHorizontal="true"
android:layout_marginTop="275dp" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="prev"
android:id="@+id/button"
android:layout_alignTop="@+id/button2"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="54dp"
android:layout_marginStart="54dp"
androidnClick="image_prev" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="next"
android:id="@+id/button2"
android:layout_alignParentBottom="true"
android:layout_alignRight="@+id/textView3"
android:layout_alignEnd="@+id/textView3"
androidnClick="image_next" />
</RelativeLayout>
Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="(link)"
package="plopmenzinc.nsapp">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".Start">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.NFC" />
<uses-feature
android:name="android.hardware.nfc"
android:required="true" />
<activity
android:name="net.vrallev.android.nfc.demo.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.nfc.action.TECH_DISCOVERED" />
</intent-filter>
<meta-data
android:name="android.nfc.action.TECH_DISCOVERED"
android:resource="@xml/nfc_tech_filter" />
</activity>
</manifest>
need to get this finished before thursday, so please help me
Well, thus far I see that you are making references to parts of the Layout View but I am not seeing where you are declaring your TextView / ImageView inside your XML layout, see below:
Code:
sw.setImageResource(R.drawable.reclame);
mTextView.setText("Om deze functie te gebruiken moet u NFC aanzetten.");
You need to have something like:
mTextView = (TextView)findViewbyId(R.id.TextViewId);
sw = (ImageView)findViewById(R.id.ImageViewId);
Fix those, try again and then return.