Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8759359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:46:57+00:00 2026-06-13T14:46:57+00:00

Hello I want to make an application which uses Multi-touch support. for multitouch i

  • 0

Hello I want to make an application which uses Multi-touch support.

for multitouch i am using this code

Now in that you can see that there is org.metalev.multitouch.photosortr.PhotoSortrActivity Activity
in that the code is like below

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.setTitle(R.string.instructions);
    photoSorter = new PhotoSortrView(this);
    setContentView(photoSorter);
}

it will work fine

but instead of this if i want to add this view in my view i write above code like below…

i have make one XML file named activity_main.xml

<org.metalev.multitouch.photosortr.PhotoSortrView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

</org.metalev.multitouch.photosortr.PhotoSortrView>

and in onCreate method i have change like below

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.setTitle(R.string.instructions);
    photoSorter = new PhotoSortrView(this);
    setContentView(R.layout.activity_main);
}

if i do like this way i will get an error below is logcat

10-30 12:15:29.319: E/AndroidRuntime(6652): java.lang.NullPointerException
10-30 12:15:29.319: E/AndroidRuntime(6652):     at org.metalev.multitouch.photosortr.PhotoSortrView$Img.draw(PhotoSortrView.java:274)
10-30 12:15:29.319: E/AndroidRuntime(6652):     at org.metalev.multitouch.photosortr.PhotoSortrView.onDraw(PhotoSortrView.java:86)
10-30 12:15:29.319: E/AndroidRuntime(6652):     at android.view.View.draw(View.java:6914)
10-30 12:15:29.319: E/AndroidRuntime(6652):     at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
10-30 12:15:29.319: E/AndroidRuntime(6652):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
10-30 12:15:29.319: E/AndroidRuntime(6652):     at android.view.View.draw(View.java:6917)
10-30 12:15:29.319: E/AndroidRuntime(6652):     at android.widget.FrameLayout.draw(FrameLayout.java:357)
10-30 12:15:29.319: E/AndroidRuntime(6652):     at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
10-30 12:15:29.319: E/AndroidRuntime(6652):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
10-30 12:15:29.319: E/AndroidRuntime(6652):     at android.view.ViewGroup.drawChild(ViewGroup.java:1644)

in PhotoSortrView.java file the code is like below where i m getting this error

public void draw(Canvas canvas) {
    canvas.save();
    float dx = (maxX + minX) / 2;
    float dy = (maxY + minY) / 2;
    ---->drawable.setBounds((int) minX, (int) minY, (int) maxX, (int) maxY); // HERE getting drawable == NULL
    canvas.translate(dx, dy);
    canvas.rotate(angle * 180.0f / (float) Math.PI);
    canvas.translate(-dx, -dy);
    drawable.draw(canvas);
    canvas.restore();
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T14:46:58+00:00Added an answer on June 13, 2026 at 2:46 pm

    Only cause might be that drawable used in draw() of Img class is null, since canvas is passed by system, and rest variables in method are primitives. This variable is initialized in load() of Img class , which in turn is called from loadImages() of PhotoSortrView class.

    Now, I guess you are calling loadImages() of photoSorter variable from Activity’s onResume() . But there is another PhotoSortrView instance created from inflating the layout. Make sure you call loadImages() of that instance also.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello I want to make one application in which i am using Absolute layout
Hello In my android application i am using the below code to make sure
Hello i got a problem using Apache-Tomcat v6.0.29. The Problem My application uses apache
I want to make application that when press the button it will make each
I want to make my application Blackberry in different languages. That mean I use
Hello could somebody help me with what i'm doing wrong. I want this application
Hello I have a word press options page and I want to make it
Hello I want to read output of command which gives progress bar like output
Hello I want write my own desktop sharing application in Java. The application should
Hello everyone i need some help. I'm trying to make an application for mac

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.